You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "nevzheng (via GitHub)" <gi...@apache.org> on 2026/08/18 10:58:59 UTC

[PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

nevzheng opened a new pull request, #12489:
URL: https://github.com/apache/gravitino/pull/12489

   ### What changes were proposed in this pull request?
   
   `KmsReference` now identifies a key by configured provider name and `keyId` only. The KMS protocol (`api`) stays in server config, and the previous `source` name is replaced by `provider`.
   
   Callers resolve a client from `KmsClientRegistry` by provider. The registry binds each named provider to its API at startup from `gravitino.kms.provider.<name>.api`. The public reference no longer carries `api()` or `source()`.
   
   Server config becomes provider-named:
   
   ```
   gravitino.kms.providers=aws-prod,aws-dr,azure-eu
   gravitino.kms.provider.aws-prod.api=aws-kms
   gravitino.kms.provider.aws-dr.api=aws-kms
   gravitino.kms.provider.azure-eu.api=azure-key-vault
   ```
   
   JSON DTO: `{"provider":"aws-prod","keyId":"..."}`.
   
   This implements #12488 on the unreleased Developer API from #12132 and #12133. Enterprise stack, design-pack adapter prose, demo conf, and `gravitino-server-config.md` remain follow-up.
   
   ### Why are the changes needed?
   
   Putting `api` and `source` on the public key identity forced callers to know the protocol and invented a second name for a configured instance. Reviewers asked to change upstream `KmsReference` instead of adding a parallel identity type, and to use `provider` rather than `source`.
   
   Keeping the protocol in server config lets many named providers share one API without leaking that binding onto stored or exchanged key identity.
   
   Fix: #12488
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, for the unreleased `@DeveloperApi` KMS contracts:
   
   - `KmsReference` is `{provider, keyId}` instead of `{api, source, keyId}`
   - DTO JSON uses `provider` instead of `api` and `source`
   - Server config keys are `gravitino.kms.providers` and `gravitino.kms.provider.<name>.*` instead of `sources` / `source.<name>.*`
   - `KmsClientFactory.create` and registry lookup take a provider name; registry lookup no longer checks `reference.api()`
   
   There are no REST API changes. Docs for `gravitino-server-config.md` are out of scope here.
   
   ### How was this patch tested?
   
   - `./gradlew :api:test :common:test :core:test` for KMS tests passed
   
   ### Related work
   
   Closes: #12488
   Related to: #12131, #12132, #12133
   
   Nevin
   Sent from my 🤖 (Cursor)
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803641696


##########
common/src/testFixtures/java/org/apache/gravitino/encryption/kms/FakeKmsClient.java:
##########
@@ -25,23 +25,19 @@
 /** In-memory KMS client for contract and consumer tests. */
 public final class FakeKmsClient implements KmsClient {
 
-  private final String api;
-  private final String source;
+  private final String provider;
   private final Map<String, KeyState> keys = new HashMap<>();
 
   /**
    * Creates an empty fake client.
    *
-   * @param api exact KMS API identifier accepted by the client; lowercase kebab-case with no
-   *     surrounding whitespace
-   * @param source configured source accepted by the client
+   * @param provider configured provider accepted by the client
    */
-  public FakeKmsClient(String api, String source) {
-    this.api = KmsApiIdentifiers.requireValid(api);
-    if (source == null || source.trim().isEmpty()) {
-      throw new IllegalArgumentException("KMS source cannot be blank");
+  public FakeKmsClient(String provider) {
+    if (provider == null || provider.trim().isEmpty()) {
+      throw new IllegalArgumentException("KMS provider cannot be blank");

Review Comment:
   May be Stringutils is better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803947313


##########
common/src/testFixtures/java/org/apache/gravitino/encryption/kms/FakeKmsClient.java:
##########
@@ -25,23 +25,19 @@
 /** In-memory KMS client for contract and consumer tests. */
 public final class FakeKmsClient implements KmsClient {
 
-  private final String api;
-  private final String source;
+  private final String provider;
   private final Map<String, KeyState> keys = new HashMap<>();
 
   /**
    * Creates an empty fake client.
    *
-   * @param api exact KMS API identifier accepted by the client; lowercase kebab-case with no
-   *     surrounding whitespace
-   * @param source configured source accepted by the client
+   * @param provider configured provider accepted by the client
    */
-  public FakeKmsClient(String api, String source) {
-    this.api = KmsApiIdentifiers.requireValid(api);
-    if (source == null || source.trim().isEmpty()) {
-      throw new IllegalArgumentException("KMS source cannot be blank");
+  public FakeKmsClient(String provider) {
+    if (provider == null || provider.trim().isEmpty()) {
+      throw new IllegalArgumentException("KMS provider cannot be blank");

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#issuecomment-5330675418

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|68.78% **`+0.04%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|91.53%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|49.2% **`+0.16%`**|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|42.04%|:green_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|9.92%|:red_circle:|
   |catalog-fileset|79.77%|:green_circle:|
   |catalog-glue|68.95%|:green_circle:|
   |catalog-hive|82.96%|:green_circle:|
   |catalog-jdbc-common|45.7%|:green_circle:|
   |catalog-jdbc-doris|81.8%|:green_circle:|
   |catalog-jdbc-mysql|79.33%|:green_circle:|
   |catalog-jdbc-postgresql|83.39%|:green_circle:|
   |catalog-jdbc-starrocks|79.16%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|59.18%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|84.23%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.48%|:green_circle:|
   |client-java|78.56%|:green_circle:|
   |common|52.75% **`+0.12%`**|:green_circle:|
   |core|83.61% **`+0.05%`**|:green_circle:|
   |filesystem-hadoop3|77.28%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|48.68%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-auth|68.0%|:green_circle:|
   |hadoop-common|12.7%|:red_circle:|
   |hive-metastore-common|53.4%|:green_circle:|
   |iceberg-aliyun-bundle|0.0%|:red_circle:|
   |iceberg-common|64.75%|:green_circle:|
   |iceberg-rest-server|75.0%|:green_circle:|
   |idp-basic|86.02%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|62.92%|:green_circle:|
   |lance-common|31.63%|:red_circle:|
   |lance-rest-server|63.47%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|83.17%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|87.25%|:green_circle:|
   |server-common|79.57%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|45.89%|:green_circle:|
   |tencent|69.84%|:green_circle:|
   |trino-connector|41.56%|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |api|[KmsReference.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/api/src/main/java/org/apache/gravitino/encryption/kms/KmsReference.java)|93.75%|:green_circle:|
   |common|[KmsReferenceDTO.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/common/src/main/java/org/apache/gravitino/dto/encryption/kms/KmsReferenceDTO.java)|85.71%|:green_circle:|
   ||[CallerContext.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/common/src/main/java/org/apache/gravitino/audit/CallerContext.java)|78.26%|:green_circle:|
   ||[KmsClientFactory.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/common/src/main/java/org/apache/gravitino/encryption/kms/KmsClientFactory.java)|0.0%|:red_circle:|
   |core|[KmsConfig.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/core/src/main/java/org/apache/gravitino/encryption/kms/KmsConfig.java)|100.0%|:green_circle:|
   ||[KmsClientRegistry.java](https://github.com/nevzheng/gravitino/blob/280c36e4e9f51ce6efe56377aea6317f18fac289/core/src/main/java/org/apache/gravitino/encryption/kms/KmsClientRegistry.java)|88.57%|:green_circle:|
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803783606


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   @lasdf1234 here's what I'm trying to do. Tell me if this is a good approach or if className is better.
   
   I want named KMS instances so one server can run two AWS vaults and one Azure. Callers only send the instance name plus the key id (`KmsReference{provider, keyId}`). They should not send a protocol or a class.
   
   `gravitino.kms.provider.aws-dr.api=aws-kms` is only the binding from that instance to a protocol. At startup the server picks the `KmsClientFactory` whose `api()` is `aws-kms` and passes the rest of `gravitino.kms.provider.aws-dr.*` into `create`. Two names can share one factory.
   
   I used a short `api` id rather than `className` so `gravitino.conf` stays on identifiers like `aws-kms`, the same way catalogs use `provider` and aux services use a short name. `class` / `className` is the other Gravitino convention (listeners, audit). That would work too:
   
   ```
   gravitino.kms.provider.aws-dr.className=org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory
   ```
   
   Same named-instance model; it would just load the factory by FQCN and skip the SPI match on `api()`.
   
   Do you want className here, or is a short `api` id OK because catalogs already work that way?
   
   Nevin
   Sent from my 🤖 (Cursor)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3809706291


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,42 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance names the `KmsClientFactory` class the server constructs. Two names may
+share one class, which is how you run more than one AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+`className`, or with a class the server cannot construct as a `KmsClientFactory`, fails startup.
+Client construction validates local configuration only; the first call to the provider is a later
+key inspection, not startup.
+
+| Configuration Item                         | Description                                                                                                                                                          | Default Value |
+|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`                  | Comma-separated KMS instance names, with no spaces after commas. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup. | (empty)       |
+| `gravitino.kms.provider.<name>.className`  | Required factory class name for that instance. The class must have a no-arg constructor and implement `KmsClientFactory`.                                          | (none)        |
+| `gravitino.kms.provider.<name>.<key>`      | Any other property under that name is passed to that factory. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                           | (none)        |
+
+Every name in `providers` needs a matching `.className`. A `gravitino.kms.provider.<name>.*` key
+for a name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+Callers name the instance and the key. They do not send `className`. The server already constructed
+the factory for `aws-prod` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod,aws-dr,azure-eu
+
+gravitino.kms.provider.aws-prod.className = org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory

Review Comment:
   Looks better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi merged PR #12489:
URL: https://github.com/apache/gravitino/pull/12489


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#issuecomment-5327435874

   @lasdf1234 Could you help me review this pull request?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803919031


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   The issue is that we should adopt the similar mechanism.
   SecretProvider uses SPI mode. `type` is similar to your `api`. It would better that @nevzheng and @lasdf1234 to keep consistent. 
   Any name is ok for me.
   But nevin adopts the class reflection mode, sai adopts SPI mode.
   Both modes are used in Gravitino repo.
   You can see class `Authenticator` and `CredentialProvider`.
   
   `CredentialProvider` used SPI mode.
   `Authenticator` used class reflection mode.
   
   ```
   @DeveloperApi
   public interface SecretProvider {
   
     /**
      * Initializes this provider after construction.
      *
      * <p>Implementations must override this method and explicitly decide whether configuration is
      * required. An empty body is acceptable for providers that need no setup.
      *
      * @param name the configured provider instance name
      * @param config provider-specific configuration (without the {@code gravitino.secret.provider.
      *     <name>.} prefix)
      */
     void initialize(String name, Map<String, String> config);
   
     /**
      * Returns the provider type identifier.
      *
      * @return the provider type
      */
     String type();
   
     /**
      * Writes a plaintext secret and returns its URN.
      *
      * <p>Provider-specific write metadata is supplied as {@code attributes}. Required keys depend on
      * the provider implementation; for example the in-memory write-through provider expects {@link
      * SecretConstants#ATTR_ENTITY_TYPE}, {@link SecretConstants#ATTR_ENTITY_ID}, and {@link
      * SecretConstants#ATTR_PROPERTY_KEY}.
      *
      * @param plaintext the secret plaintext
      * @param attributes provider-specific write attributes
      * @return the secret URN
      */
     SecretUrn writeSecret(String plaintext, Map<String, String> attributes);
   
     /**
      * Reads a secret by URN.
      *
      * @param urn the secret URN
      * @return the secret plaintext
      */
     String readSecret(SecretUrn urn);
   
     /**
      * Deletes a secret by URN.
      *
      * @param urn the secret URN
      */
     void deleteSecret(SecretUrn urn);
   
     /**
      * Builds a URN for an external secret reference without writing secret material.
      *
      * <p>Providers that only support write-through must leave the default implementation, which
      * rejects external references.
      *
      * @param propertyKey the entity property key that will store the URN
      * @param attributes provider-specific locator attributes
      * @return the external-reference secret URN (must end with {@code propertyKey})
      * @throws UnsupportedOperationException if this provider does not support external references
      * @throws IllegalArgumentException if attributes are invalid for this provider
      */
     default SecretUrn buildReferenceUrn(String propertyKey, Map<String, String> attributes) {
       throw new UnsupportedOperationException(
           type() + " does not support external secret references");
     }
   
     /**
      * Releases resources owned by this provider.
      *
      * <p>Implementations must override this method and explicitly release any held resources. An
      * empty body is acceptable when there is nothing to clean up.
      */
     void close();
   }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803835980


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   @lasdf1234 here's what I'm trying to do.
   
   For now a server talks to one KMS API. In JSON that is one object:
   
   ```json
   { "name": "aws-prod", "api": "aws-kms" }
   ```
   
   `gravitino.conf` is Java properties, so I write the same thing as:
   
   ```properties
   gravitino.kms.providers = aws-prod
   gravitino.kms.provider.aws-prod.api = aws-kms
   ```
   
   `.api` is the protocol. That name gets one loader for that API. Callers send `{provider, keyId}` only.
   
   I'm not trying to set `className`. That would name a Java class, not bind this instance to an API.
   
   Does this look right, or is there another way to write that in Java conf?
   
   Nevin  
   Sent from my 🤖 (Cursor)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803757779


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   May be gravitino.kms.provider.aws-dr.className better. The project convention for gravitino is to load it by setting the className.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3804026867


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   I don't have a strong opinion. what helps is being specific in code review comments (conventional comments for example). i've implemented sai's request



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3804016039


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   It's ok if we are consistent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803919031


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   The issue is that we should adopt the similar mechanism.
   SecretProvider uses SPI mode. `type` is similar to your `api`. It would better that @nevzheng and @lasdf1234 to keep consistent. 
   Any name is ok for me.
   But nevin adopts the class reflection mode, sai adopts SPI mode.
   Both modes are used in Gravitino repo.
   You can see class `Authenticator` and `CredentialProvider`.
   
   `CredentialProvider` used SPI mode.
   `Authenticator` used class reflection mode.
   
   It would better that secret providers and kms providers adopt the consistent mode.
   
   ```
   @DeveloperApi
   public interface SecretProvider {
   
     /**
      * Initializes this provider after construction.
      *
      * <p>Implementations must override this method and explicitly decide whether configuration is
      * required. An empty body is acceptable for providers that need no setup.
      *
      * @param name the configured provider instance name
      * @param config provider-specific configuration (without the {@code gravitino.secret.provider.
      *     <name>.} prefix)
      */
     void initialize(String name, Map<String, String> config);
   
     /**
      * Returns the provider type identifier.
      *
      * @return the provider type
      */
     String type();
   
     /**
      * Writes a plaintext secret and returns its URN.
      *
      * <p>Provider-specific write metadata is supplied as {@code attributes}. Required keys depend on
      * the provider implementation; for example the in-memory write-through provider expects {@link
      * SecretConstants#ATTR_ENTITY_TYPE}, {@link SecretConstants#ATTR_ENTITY_ID}, and {@link
      * SecretConstants#ATTR_PROPERTY_KEY}.
      *
      * @param plaintext the secret plaintext
      * @param attributes provider-specific write attributes
      * @return the secret URN
      */
     SecretUrn writeSecret(String plaintext, Map<String, String> attributes);
   
     /**
      * Reads a secret by URN.
      *
      * @param urn the secret URN
      * @return the secret plaintext
      */
     String readSecret(SecretUrn urn);
   
     /**
      * Deletes a secret by URN.
      *
      * @param urn the secret URN
      */
     void deleteSecret(SecretUrn urn);
   
     /**
      * Builds a URN for an external secret reference without writing secret material.
      *
      * <p>Providers that only support write-through must leave the default implementation, which
      * rejects external references.
      *
      * @param propertyKey the entity property key that will store the URN
      * @param attributes provider-specific locator attributes
      * @return the external-reference secret URN (must end with {@code propertyKey})
      * @throws UnsupportedOperationException if this provider does not support external references
      * @throws IllegalArgumentException if attributes are invalid for this provider
      */
     default SecretUrn buildReferenceUrn(String propertyKey, Map<String, String> attributes) {
       throw new UnsupportedOperationException(
           type() + " does not support external secret references");
     }
   
     /**
      * Releases resources owned by this provider.
      *
      * <p>Implementations must override this method and explicitly release any held resources. An
      * empty body is acceptable when there is nothing to clean up.
      */
     void close();
   }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#issuecomment-5328483718

   > @lasdf1234 Removed the spaces after commas. The example is now `gravitino.kms.providers = aws-prod,aws-dr,azure-eu`.
   > 
   > [fbf7694](https://github.com/apache/gravitino/commit/fbf7694c365146d7fd14b1503b189faad9a757ea)
   > 
   > Nevin Sent from my 🤖 (Cursor)
   
   I have no more comments.I'll approve.  LGTM @roryqi  Colud take a look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3809420243


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,42 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance names the `KmsClientFactory` class the server constructs. Two names may
+share one class, which is how you run more than one AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+`className`, or with a class the server cannot construct as a `KmsClientFactory`, fails startup.
+Client construction validates local configuration only; the first call to the provider is a later
+key inspection, not startup.
+
+| Configuration Item                         | Description                                                                                                                                                          | Default Value |
+|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`                  | Comma-separated KMS instance names, with no spaces after commas. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup. | (empty)       |
+| `gravitino.kms.provider.<name>.className`  | Required factory class name for that instance. The class must have a no-arg constructor and implement `KmsClientFactory`.                                          | (none)        |
+| `gravitino.kms.provider.<name>.<key>`      | Any other property under that name is passed to that factory. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                           | (none)        |
+
+Every name in `providers` needs a matching `.className`. A `gravitino.kms.provider.<name>.*` key
+for a name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+Callers name the instance and the key. They do not send `className`. The server already constructed
+the factory for `aws-prod` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod,aws-dr,azure-eu
+
+gravitino.kms.provider.aws-prod.className = org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory

Review Comment:
   The example FQCNs were the problem. They sat under `org.apache.gravitino...` so they looked shipped.
   
   Key Management now matches Event Listeners: implement `KmsClientFactory`, public no-arg constructor, put the jar on the classpath, set `className`. Gravitino does not ship AWS or Azure factories. The example uses your `Custom` names in `com.example.kms`:
   
   ```text
   gravitino.kms.provider.aws-prod.className = com.example.kms.AwsCustomKmsClientFactory
   gravitino.kms.provider.aws-dr.className = com.example.kms.AwsCustomKmsClientFactory
   gravitino.kms.provider.azure-eu.className = com.example.kms.AzureCustomKmsClientFactory
   ```
   
   d06fa4ac8653032dbeee772eff177f609e18a3b1
   
   Nevin
   Sent from my 🤖 (Cursor)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#issuecomment-5327864398

   One last small issue: Could the spaces between the commas be removed?
   change 'gravitino.kms.providers = aws-prod, aws-dr, azure-eu' to 'gravitino.kms.providers = aws-prod,aws-dr,azure-eu', 
   
   Everything else is fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803947761


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
common/src/testFixtures/java/org/apache/gravitino/encryption/kms/FakeKmsClient.java:
##########
@@ -25,23 +25,19 @@
 /** In-memory KMS client for contract and consumer tests. */
 public final class FakeKmsClient implements KmsClient {
 
-  private final String api;
-  private final String source;
+  private final String provider;
   private final Map<String, KeyState> keys = new HashMap<>();
 
   /**
    * Creates an empty fake client.
    *
-   * @param api exact KMS API identifier accepted by the client; lowercase kebab-case with no
-   *     surrounding whitespace
-   * @param source configured source accepted by the client
+   * @param provider configured provider accepted by the client
    */
-  public FakeKmsClient(String api, String source) {
-    this.api = KmsApiIdentifiers.requireValid(api);
-    if (source == null || source.trim().isEmpty()) {
-      throw new IllegalArgumentException("KMS source cannot be blank");
+  public FakeKmsClient(String provider) {
+    if (provider == null || provider.trim().isEmpty()) {
+      throw new IllegalArgumentException("KMS provider cannot be blank");

Review Comment:
   Switched the blank check to `StringUtils.isBlank(provider)` in `FakeKmsClient`.
   
   fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Applied both of these.
   
   Dropped the `.api=` lines. Each named provider now loads a factory the same way listeners do:
   
   ```text
   gravitino.kms.providers = aws-prod,aws-dr,azure-eu
   gravitino.kms.provider.aws-prod.className = org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory
   gravitino.kms.provider.aws-dr.className = org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory
   gravitino.kms.provider.azure-eu.className = org.apache.gravitino.encryption.kms.azure.AzureKmsClientFactory
   ```
   
   The registry constructs that class with a no-arg constructor. Callers still send `{provider, keyId}` only.
   
   fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3804026867


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   (close thread) I don't have a strong opinion. what helps is being specific in code review comments (conventional comments for example). i've implemented sai's request. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3805600439


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,42 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance names the `KmsClientFactory` class the server constructs. Two names may
+share one class, which is how you run more than one AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+`className`, or with a class the server cannot construct as a `KmsClientFactory`, fails startup.
+Client construction validates local configuration only; the first call to the provider is a later
+key inspection, not startup.
+
+| Configuration Item                         | Description                                                                                                                                                          | Default Value |
+|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`                  | Comma-separated KMS instance names, with no spaces after commas. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup. | (empty)       |
+| `gravitino.kms.provider.<name>.className`  | Required factory class name for that instance. The class must have a no-arg constructor and implement `KmsClientFactory`.                                          | (none)        |
+| `gravitino.kms.provider.<name>.<key>`      | Any other property under that name is passed to that factory. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                           | (none)        |
+
+Every name in `providers` needs a matching `.className`. A `gravitino.kms.provider.<name>.*` key
+for a name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+Callers name the instance and the key. They do not send `className`. The server already constructed
+the factory for `aws-prod` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod,aws-dr,azure-eu
+
+gravitino.kms.provider.aws-prod.className = org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory

Review Comment:
   Could u give a better class name?
   This class name will make the user feel that the code contains the AwsKmsClientFactory.
   Actually, user need to implement his kms client factory.
   From my side, it may be better to use AwsCustomKmsClientFactory.
   It would be better to add some words tell users how to implement a custom kms client factory briefly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#issuecomment-5328050673

   @lasdf1234 Done in fbf7694c365146d7fd14b1503b189faad9a757ea
   
   Nevin
   Sent from my 🤖 (Cursor)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803733642


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Can you elaborate your concern? thanks. If you ask for removal you should suggest a replacement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803719970


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Could u remove gravitino.kms.provider.aws-prod.api = aws-kms?
   Could u remove gravitino.kms.provider.aws-dr.api = aws-kms?
   Could u remove gravitino.kms.provider.azure-eu.api = azure-key-vault?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "nevzheng (via GitHub)" <gi...@apache.org>.
nevzheng commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803783606


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   @lasdf1234 here's what I'm trying to do. Tell me if this is a good approach or if className is better.
   
   I want named KMS instances so one server can run two AWS vaults and one Azure. Callers only send the instance name plus the key id (`KmsReference{provider, keyId}`). They should not send a protocol or a class.
   
   `gravitino.kms.provider.aws-dr.api=aws-kms` is only the binding from that instance to a protocol. At startup the server picks the `KmsClientFactory` whose `api()` is `aws-kms` and passes the rest of `gravitino.kms.provider.aws-dr.*` into `create`. Two names can share one factory.
   
   I used a short `api` id rather than `className` so `gravitino.conf` stays on identifiers like `aws-kms`, the same way catalogs use `provider` and aux services use a short name. `class` / `className` is the other Gravitino convention (listeners, audit). That would work too:
   
   ```
   gravitino.kms.provider.aws-dr.className=org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory
   ```
   
   Same named-instance model; it would just load the factory by FQCN and skip the SPI match on `api()`.
   
   Do you want className here, or is a short `api` id OK because catalogs already work that way?
   
   Nevin
   Sent from my 🤖 (Cursor)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12488] feat(kms): Identify keys by provider and keyId [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on code in PR #12489:
URL: https://github.com/apache/gravitino/pull/12489#discussion_r3803809433


##########
docs/gravitino-server-config.md:
##########
@@ -486,6 +488,53 @@ server, are documented with those services. See
 | `gravitino.job.stagingDirKeepTimeInMs` | How long in milliseconds a finished job's staging files are kept. Use at least 10 minutes outside testing. | `604800000` (7 days)          |
 | `gravitino.job.statusPullIntervalInMs` | Interval in milliseconds between job status polls. Use at least 1 minute outside testing.                  | `300000` (5 minutes)          |
 
+### Key Management
+
+The server talks to KMS instances you name in `gravitino.conf`. Each name is one configured
+instance. Each instance declares the KMS API it speaks. That API selects the `KmsClientFactory`
+implementation on the classpath. Two names may share one API, which is how you run more than one
+AWS or Azure vault.
+
+The list is empty by default, and then the server has no KMS clients. Naming a provider without a
+factory for its API, or without a valid API, fails startup. Client construction validates local
+configuration only; the first call to the provider is a later key inspection, not startup.
+
+| Configuration Item                      | Description                                                                                                                                                                 | Default Value |
+|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| `gravitino.kms.providers`               | Comma-separated KMS instance names. Each name must match `[A-Za-z0-9][A-Za-z0-9_-]*` and cannot contain `.`. Duplicates fail startup.                                       | (empty)       |
+| `gravitino.kms.provider.<name>.api`     | Required KMS API identifier for that instance. Lowercase kebab-case with no surrounding whitespace, matched exactly, for example `aws-kms`. Values are never normalized.    | (none)        |
+| `gravitino.kms.provider.<name>.<key>`   | Any other property under that name is passed to the factory for that API. Nested dots in `<key>` are allowed, as in `endpoint.region`.                                      | (none)        |
+
+Every name in `providers` needs a matching `.api`. A `gravitino.kms.provider.<name>.*` key for a
+name that is not in the list, or any other `gravitino.kms.*` key, fails startup.
+
+`api` is the protocol, not the instance. Set it to the identifier the factory reports from
+`KmsClientFactory.api()`. Identifiers already used by factories include `aws-kms`,
+`google-cloud-kms`, and `azure-key-vault`. A custom factory may use any other lowercase kebab-case
+value. The server does not ship a factory for every identifier; put the matching implementation on
+the classpath or startup fails with no factory for that API.
+
+Callers name the instance and the key. They do not send `api`. The server already bound
+`aws-prod` to `aws-kms` at startup.
+
+```text
+# conf/gravitino.conf
+gravitino.kms.providers = aws-prod, aws-dr, azure-eu
+
+gravitino.kms.provider.aws-prod.api = aws-kms
+gravitino.kms.provider.aws-prod.endpoint.region = us-west-2
+

Review Comment:
   Received. Your reply is very thoughtful. I think "className" is better. Mainly because this is the project convention. It's better to be consistent with the existing project conventions. Just change it like this:
   
   gravitino.kms.provider.aws-dr.className=org.apache.gravitino.encryption.kms.aws.AwsKmsClientFactory
   
   Thank you.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org