-
Notifications
You must be signed in to change notification settings - Fork 3k
Encryption for REST catalog #13225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
smaheshwar-pltr
wants to merge
11
commits into
apache:main
Choose a base branch
from
smaheshwar-pltr:rest-encrypt-on-main-cherry-pick
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Encryption for REST catalog #13225
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
af672ed
Encryption for REST catalog
smaheshwar-pltr 7ad846d
Nit improvements
smaheshwar-pltr 9ed8d8e
Suppress test method length
smaheshwar-pltr 2d18a6a
Merge branch 'main' into rest-encrypt-on-main-cherry-pick
smaheshwar-pltr 745a959
Spotless
smaheshwar-pltr 1106a26
Merge branch 'main' into rest-encrypt-on-main-cherry-pick
smaheshwar-pltr 8ac5228
Fix conflicts and update test
smaheshwar-pltr 73e0980
Undo 4.0 changes
smaheshwar-pltr a774a9c
Fix checkstyle
smaheshwar-pltr 86abfab
empty
smaheshwar-pltr 1e42400
Nit: Simplify adding encryption keys
smaheshwar-pltr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,8 @@ | |
| import org.apache.iceberg.catalog.Namespace; | ||
| import org.apache.iceberg.catalog.TableCommit; | ||
| import org.apache.iceberg.catalog.TableIdentifier; | ||
| import org.apache.iceberg.encryption.EncryptionUtil; | ||
| import org.apache.iceberg.encryption.KeyManagementClient; | ||
| import org.apache.iceberg.exceptions.AlreadyExistsException; | ||
| import org.apache.iceberg.exceptions.NoSuchNamespaceException; | ||
| import org.apache.iceberg.exceptions.NoSuchTableException; | ||
|
|
@@ -167,6 +169,7 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog | |
| private CloseableGroup closeables = null; | ||
| private Set<Endpoint> endpoints; | ||
| private Supplier<Map<String, String>> mutationHeaders = Map::of; | ||
| private KeyManagementClient keyManagementClient = null; | ||
| private String namespaceSeparator = null; | ||
|
|
||
| private RESTTableCache tableCache; | ||
|
|
@@ -272,6 +275,12 @@ public void initialize(String name, Map<String, String> unresolved) { | |
| mergedProps, | ||
| RESTCatalogProperties.METRICS_REPORTING_ENABLED, | ||
| RESTCatalogProperties.METRICS_REPORTING_ENABLED_DEFAULT); | ||
|
|
||
| if (mergedProps.containsKey(CatalogProperties.ENCRYPTION_KMS_IMPL)) { | ||
| this.keyManagementClient = EncryptionUtil.createKmsClient(mergedProps); | ||
| this.closeables.addCloseable(this.keyManagementClient); | ||
| } | ||
|
|
||
| this.namespaceSeparator = | ||
| PropertyUtil.propertyAsString( | ||
| mergedProps, | ||
|
|
@@ -575,6 +584,7 @@ private Supplier<BaseTable> createTableSupplier( | |
| Map::of, | ||
| mutationHeaders, | ||
| tableFileIO(context, tableConf, credentials), | ||
| keyManagementClient, | ||
| tableMetadata, | ||
| endpoints); | ||
|
|
||
|
|
@@ -674,6 +684,7 @@ public Table registerTable( | |
| Map::of, | ||
| mutationHeaders, | ||
| tableFileIO(context, tableConf, response.credentials()), | ||
| keyManagementClient, | ||
| response.tableMetadata(), | ||
| endpoints); | ||
|
|
||
|
|
@@ -943,6 +954,7 @@ public Table create() { | |
| Map::of, | ||
| mutationHeaders, | ||
| tableFileIO(context, tableConf, response.credentials()), | ||
| keyManagementClient, | ||
| response.tableMetadata(), | ||
| endpoints); | ||
|
|
||
|
|
@@ -976,6 +988,7 @@ public Transaction createTransaction() { | |
| Map::of, | ||
| mutationHeaders, | ||
| tableFileIO(context, tableConf, response.credentials()), | ||
| keyManagementClient, | ||
| RESTTableOperations.UpdateType.CREATE, | ||
| createChanges(meta), | ||
| meta, | ||
|
|
@@ -1041,6 +1054,7 @@ public Transaction replaceTransaction() { | |
| Map::of, | ||
| mutationHeaders, | ||
| tableFileIO(context, tableConf, response.credentials()), | ||
| keyManagementClient, | ||
| RESTTableOperations.UpdateType.REPLACE, | ||
| changes.build(), | ||
| base, | ||
|
|
@@ -1181,6 +1195,7 @@ private FileIO tableFileIO( | |
| * @param mutationHeaderSupplier a supplier for additional HTTP headers to include in mutation | ||
| * requests (POST/DELETE) | ||
| * @param fileIO the FileIO implementation for reading and writing table metadata and data files | ||
| * @param kmsClient the {@link KeyManagementClient} for encrypted tables | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| * @param current the current table metadata | ||
| * @param supportedEndpoints the set of supported REST endpoints | ||
| * @return a new RESTTableOperations instance | ||
|
|
@@ -1191,10 +1206,18 @@ protected RESTTableOperations newTableOps( | |
| Supplier<Map<String, String>> readHeaders, | ||
| Supplier<Map<String, String>> mutationHeaderSupplier, | ||
| FileIO fileIO, | ||
| KeyManagementClient kmsClient, | ||
| TableMetadata current, | ||
| Set<Endpoint> supportedEndpoints) { | ||
| return new RESTTableOperations( | ||
| restClient, path, readHeaders, mutationHeaderSupplier, fileIO, current, supportedEndpoints); | ||
| restClient, | ||
| path, | ||
| readHeaders, | ||
| mutationHeaderSupplier, | ||
| fileIO, | ||
| kmsClient, | ||
| current, | ||
| supportedEndpoints); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1211,6 +1234,7 @@ protected RESTTableOperations newTableOps( | |
| * @param mutationHeaderSupplier a supplier for additional HTTP headers to include in mutation | ||
| * requests (POST/DELETE) | ||
| * @param fileIO the FileIO implementation for reading and writing table metadata and data files | ||
| * @param kmsClient the {@link KeyManagementClient} for encrypted tables | ||
| * @param updateType the {@link RESTTableOperations.UpdateType} being performed | ||
| * @param createChanges the list of metadata updates to apply during table creation or replacement | ||
| * @param current the current table metadata (may be null for CREATE operations) | ||
|
|
@@ -1223,6 +1247,7 @@ protected RESTTableOperations newTableOps( | |
| Supplier<Map<String, String>> readHeaders, | ||
| Supplier<Map<String, String>> mutationHeaderSupplier, | ||
| FileIO fileIO, | ||
| KeyManagementClient kmsClient, | ||
| RESTTableOperations.UpdateType updateType, | ||
| List<MetadataUpdate> createChanges, | ||
| TableMetadata current, | ||
|
|
@@ -1233,6 +1258,7 @@ protected RESTTableOperations newTableOps( | |
| readHeaders, | ||
| mutationHeaderSupplier, | ||
| fileIO, | ||
| kmsClient, | ||
| updateType, | ||
| createChanges, | ||
| current, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you all thought about the IRC remote scan planning and it integration with encryption ?
do we have test for the same.