-
Notifications
You must be signed in to change notification settings - Fork 585
CNTRLPLANE-2241: Update KMSConfig to allow manualy managed kms plugins #2622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ardaguclu
wants to merge
2
commits into
openshift:master
Choose a base branch
from
ardaguclu:kms-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,59 @@ | ||
| package v1 | ||
|
|
||
| // Start: TOMBSTONE | ||
|
|
||
| // KMSConfig defines the configuration for the KMS instance | ||
| // that will be used with KMSEncryptionProvider encryption | ||
| // +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'AWS' ? has(self.aws) : !has(self.aws)",message="aws config is required when kms provider type is AWS, and forbidden otherwise" | ||
| // +union | ||
| type KMSConfig struct { | ||
| // type defines the kind of platform for the KMS provider. | ||
| // Available provider types are AWS only. | ||
| // | ||
| // +unionDiscriminator | ||
| // +required | ||
| Type KMSProviderType `json:"type"` | ||
| //type KMSConfig struct { | ||
| // type defines the kind of platform for the KMS provider. | ||
| // Available provider types are AWS only. | ||
| // | ||
| // +unionDiscriminator | ||
| // +required | ||
| //Type KMSProviderType `json:"type"` | ||
|
|
||
| // aws defines the key config for using an AWS KMS instance | ||
| // for the encryption. The AWS KMS instance is managed | ||
| // by the user outside the purview of the control plane. | ||
| // | ||
| // +unionMember | ||
| // +optional | ||
| AWS *AWSKMSConfig `json:"aws,omitempty"` | ||
| } | ||
| // aws defines the key config for using an AWS KMS instance | ||
| // for the encryption. The AWS KMS instance is managed | ||
| // by the user outside the purview of the control plane. | ||
| // | ||
| // +unionMember | ||
| // +optional | ||
| //AWS *AWSKMSConfig `json:"aws,omitempty"` | ||
| //} | ||
|
|
||
| // AWSKMSConfig defines the KMS config specific to AWS KMS provider | ||
| type AWSKMSConfig struct { | ||
| // keyARN specifies the Amazon Resource Name (ARN) of the AWS KMS key used for encryption. | ||
| // The value must adhere to the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`, where: | ||
| // - `<region>` is the AWS region consisting of lowercase letters and hyphens followed by a number. | ||
| // - `<account_id>` is a 12-digit numeric identifier for the AWS account. | ||
| // - `<key_id>` is a unique identifier for the KMS key, consisting of lowercase hexadecimal characters and hyphens. | ||
| // | ||
| // +kubebuilder:validation:MaxLength=128 | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^arn:aws:kms:[a-z0-9-]+:[0-9]{12}:key/[a-f0-9-]+$')",message="keyARN must follow the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`. The account ID must be a 12 digit number and the region and key ID should consist only of lowercase hexadecimal characters and hyphens (-)." | ||
| // +required | ||
| KeyARN string `json:"keyARN"` | ||
| // region specifies the AWS region where the KMS instance exists, and follows the format | ||
| // `<region-prefix>-<region-name>-<number>`, e.g.: `us-east-1`. | ||
| // Only lowercase letters and hyphens followed by numbers are allowed. | ||
| // | ||
| // +kubebuilder:validation:MaxLength=64 | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^[a-z0-9]+(-[a-z0-9]+)*$')",message="region must be a valid AWS region, consisting of lowercase characters, digits and hyphens (-) only." | ||
| // +required | ||
| Region string `json:"region"` | ||
| } | ||
| //type AWSKMSConfig struct { | ||
| // keyARN specifies the Amazon Resource Name (ARN) of the AWS KMS key used for encryption. | ||
| // The value must adhere to the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`, where: | ||
| // - `<region>` is the AWS region consisting of lowercase letters and hyphens followed by a number. | ||
| // - `<account_id>` is a 12-digit numeric identifier for the AWS account. | ||
| // - `<key_id>` is a unique identifier for the KMS key, consisting of lowercase hexadecimal characters and hyphens. | ||
| // | ||
| // +kubebuilder:validation:MaxLength=128 | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^arn:aws:kms:[a-z0-9-]+:[0-9]{12}:key/[a-f0-9-]+$')",message="keyARN must follow the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`. The account ID must be a 12 digit number and the region and key ID should consist only of lowercase hexadecimal characters and hyphens (-)." | ||
| // +required | ||
| //KeyARN string `json:"keyARN"` | ||
| // region specifies the AWS region where the KMS instance exists, and follows the format | ||
| // `<region-prefix>-<region-name>-<number>`, e.g.: `us-east-1`. | ||
| // Only lowercase letters and hyphens followed by numbers are allowed. | ||
| // | ||
| // +kubebuilder:validation:MaxLength=64 | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^[a-z0-9]+(-[a-z0-9]+)*$')",message="region must be a valid AWS region, consisting of lowercase characters, digits and hyphens (-) only." | ||
| // +required | ||
| //Region string `json:"region"` | ||
| //} | ||
|
|
||
| // KMSProviderType is a specific supported KMS provider | ||
| // +kubebuilder:validation:Enum=AWS | ||
| type KMSProviderType string | ||
| //type KMSProviderType string | ||
|
|
||
| //const ( | ||
| // AWSKMSProvider represents a supported KMS provider for use with AWS KMS | ||
| // AWSKMSProvider KMSProviderType = "AWS" | ||
| //) | ||
|
|
||
| const ( | ||
| // AWSKMSProvider represents a supported KMS provider for use with AWS KMS | ||
| AWSKMSProvider KMSProviderType = "AWS" | ||
| ) | ||
| // End: TOMBSTONE | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For serialization safety and to adhere to v1 API guarantees, we do not allow removal of any fields directly, even if it was only accessible in tech preview. Instead, we ask to tombstone them (removal with a comment), see some examples #2256 and #2576
This also means that the field name may not be used again, so we should be certain that we're ok with the removal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review. That makes sense. I'll update this PR based on your comments, once we finalize the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of directly removing it, I've marked fields as deprecated for now. In next release I'm planning to remove them entirely (by tombstoning as suggested ^^)