[#12488] feat(kms): Identify keys by provider and keyId - #12489
Conversation
KmsReference should name a configured provider and keyId so the protocol stays in server config instead of the public key identity. Co-authored-by: Cursor <cursoragent@cursor.com>
Operators need the server-config keys that bind each instance to an API. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@lasdf1234 Could you help me review this pull request? |
|
One last small issue: Could the spaces between the commas be removed? Everything else is fine. |
Follow the existing listener convention and drop spaces after commas in the providers list. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@lasdf1234 Removed the spaces after commas. The example is now Nevin |
Co-authored-by: Cursor <cursoragent@cursor.com>
…Fixtures classpath StringUtils.isBlank does not compile from common testFixtures without an explicit dependency. Co-authored-by: Cursor <cursoragent@cursor.com>
…ntifiers The server loads factories by className. A protocol identifier is not part of that contract. Co-authored-by: Cursor <cursoragent@cursor.com>
I have no more comments.I'll approve. LGTM @roryqi Colud take a look? |
| # 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 |
There was a problem hiding this 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.
There was a problem hiding this 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:
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
Nevin
Sent from my 🤖 (Cursor)
Code Coverage Report
Files
|
…tions Example FQCNs looked like shipped AWS and Azure factories. Document the EventListener-style hook instead. Co-authored-by: Cursor <cursoragent@cursor.com>
What changes were proposed in this pull request?
KmsReferencenow identifies a key by configured provider name andkeyIdonly. The KMS protocol (api) stays in server config, and the previoussourcename is replaced byprovider.Callers resolve a client from
KmsClientRegistryby provider. The registry binds each named provider to its API at startup fromgravitino.kms.provider.<name>.api. The public reference no longer carriesapi()orsource().Server config becomes provider-named:
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.mdremain follow-up.Why are the changes needed?
Putting
apiandsourceon the public key identity forced callers to know the protocol and invented a second name for a configured instance. Reviewers asked to change upstreamKmsReferenceinstead of adding a parallel identity type, and to useproviderrather thansource.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
@DeveloperApiKMS contracts:KmsReferenceis{provider, keyId}instead of{api, source, keyId}providerinstead ofapiandsourcegravitino.kms.providersandgravitino.kms.provider.<name>.*instead ofsources/source.<name>.*KmsClientFactory.createand registry lookup take a provider name; registry lookup no longer checksreference.api()There are no REST API changes. Docs for
gravitino-server-config.mdare out of scope here.How was this patch tested?
./gradlew :api:test :common:test :core:testfor KMS tests passedRelated work
Closes: #12488
Related to: #12131, #12132, #12133
Nevin
Sent from my 🤖 (Cursor)
Made with Cursor