|
1 | 1 | package v1 |
2 | 2 |
|
| 3 | +// Start: TOMBSTONE |
| 4 | + |
3 | 5 | // KMSConfig defines the configuration for the KMS instance |
4 | 6 | // that will be used with KMSEncryptionProvider encryption |
5 | | -// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Manual' ? (has(self.manual) && has(self.manual.name) && self.manual.name != '') : !has(self.manual)",message="manual config with non-empty name is required when kms provider type is Manual, and forbidden otherwise" |
6 | 7 | // +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" |
7 | 8 | // +union |
8 | | -type KMSConfig struct { |
9 | | - // type defines the kind of platform for the KMS provider. |
10 | | - // Available provider types are AWS, Manual. |
11 | | - // |
12 | | - // +unionDiscriminator |
13 | | - // +required |
14 | | - Type KMSProviderType `json:"type"` |
15 | | - |
16 | | - // manual defines the configuration for manually managed KMS plugins. |
17 | | - // The KMS plugin must be deployed as a static pod by the cluster admin. |
18 | | - // |
19 | | - // +unionMember |
20 | | - // +optional |
21 | | - Manual *ManualKMSConfig `json:"manual,omitempty"` |
22 | | - |
23 | | - // aws defines the key config for using an AWS KMS instance |
24 | | - // for the encryption. The AWS KMS instance is managed |
25 | | - // by the user outside the purview of the control plane. |
26 | | - // Deprecated: There is no logic listening to this resource type, we plan to remove it in next release. |
27 | | - // |
28 | | - // +unionMember |
29 | | - // +optional |
30 | | - AWS *AWSKMSConfig `json:"aws,omitempty"` |
31 | | -} |
32 | | - |
33 | | -// ManualKMSConfig defines the configuration for manually managed KMS plugins |
34 | | -type ManualKMSConfig struct { |
35 | | - // name specifies the KMS plugin name. |
36 | | - // This name is templated into the UNIX domain socket path: unix:///var/run/kmsplugin/<name>.sock |
37 | | - // and is between 1 and 80 characters in length. |
38 | | - // The KMS plugin must listen at this socket path. |
39 | | - // The name must be a safe socket filename and must not contain '/' or '..'. |
40 | | - // |
41 | | - // +kubebuilder:validation:MaxLength=80 |
42 | | - // +kubebuilder:validation:MinLength=1 |
43 | | - // +kubebuilder:validation:XValidation:rule="!self.contains('/') && !self.contains('..')",message="name must be a safe socket filename (must not contain '/' or '..')" |
44 | | - // +optional |
45 | | - Name string `json:"name,omitempty"` |
46 | | -} |
| 9 | +//type KMSConfig struct { |
| 10 | +// type defines the kind of platform for the KMS provider. |
| 11 | +// Available provider types are AWS only. |
| 12 | +// |
| 13 | +// +unionDiscriminator |
| 14 | +// +required |
| 15 | +//Type KMSProviderType `json:"type"` |
| 16 | + |
| 17 | +// aws defines the key config for using an AWS KMS instance |
| 18 | +// for the encryption. The AWS KMS instance is managed |
| 19 | +// by the user outside the purview of the control plane. |
| 20 | +// |
| 21 | +// +unionMember |
| 22 | +// +optional |
| 23 | +//AWS *AWSKMSConfig `json:"aws,omitempty"` |
| 24 | +//} |
47 | 25 |
|
48 | 26 | // AWSKMSConfig defines the KMS config specific to AWS KMS provider |
49 | | -// Deprecated: There is no logic listening to this resource type, we plan to remove it in next release. |
50 | | -type AWSKMSConfig struct { |
51 | | - // keyARN specifies the Amazon Resource Name (ARN) of the AWS KMS key used for encryption. |
52 | | - // The value must adhere to the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`, where: |
53 | | - // - `<region>` is the AWS region consisting of lowercase letters and hyphens followed by a number. |
54 | | - // - `<account_id>` is a 12-digit numeric identifier for the AWS account. |
55 | | - // - `<key_id>` is a unique identifier for the KMS key, consisting of lowercase hexadecimal characters and hyphens. |
56 | | - // |
57 | | - // +kubebuilder:validation:MaxLength=128 |
58 | | - // +kubebuilder:validation:MinLength=1 |
59 | | - // +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 (-)." |
60 | | - // +required |
61 | | - KeyARN string `json:"keyARN"` |
62 | | - // region specifies the AWS region where the KMS instance exists, and follows the format |
63 | | - // `<region-prefix>-<region-name>-<number>`, e.g.: `us-east-1`. |
64 | | - // Only lowercase letters and hyphens followed by numbers are allowed. |
65 | | - // |
66 | | - // +kubebuilder:validation:MaxLength=64 |
67 | | - // +kubebuilder:validation:MinLength=1 |
68 | | - // +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." |
69 | | - // +required |
70 | | - Region string `json:"region"` |
71 | | -} |
| 27 | +//type AWSKMSConfig struct { |
| 28 | +// keyARN specifies the Amazon Resource Name (ARN) of the AWS KMS key used for encryption. |
| 29 | +// The value must adhere to the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`, where: |
| 30 | +// - `<region>` is the AWS region consisting of lowercase letters and hyphens followed by a number. |
| 31 | +// - `<account_id>` is a 12-digit numeric identifier for the AWS account. |
| 32 | +// - `<key_id>` is a unique identifier for the KMS key, consisting of lowercase hexadecimal characters and hyphens. |
| 33 | +// |
| 34 | +// +kubebuilder:validation:MaxLength=128 |
| 35 | +// +kubebuilder:validation:MinLength=1 |
| 36 | +// +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 (-)." |
| 37 | +// +required |
| 38 | +//KeyARN string `json:"keyARN"` |
| 39 | +// region specifies the AWS region where the KMS instance exists, and follows the format |
| 40 | +// `<region-prefix>-<region-name>-<number>`, e.g.: `us-east-1`. |
| 41 | +// Only lowercase letters and hyphens followed by numbers are allowed. |
| 42 | +// |
| 43 | +// +kubebuilder:validation:MaxLength=64 |
| 44 | +// +kubebuilder:validation:MinLength=1 |
| 45 | +// +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." |
| 46 | +// +required |
| 47 | +//Region string `json:"region"` |
| 48 | +//} |
72 | 49 |
|
73 | 50 | // KMSProviderType is a specific supported KMS provider |
74 | | -// +kubebuilder:validation:Enum=AWS;Manual |
75 | | -type KMSProviderType string |
| 51 | +// +kubebuilder:validation:Enum=AWS |
| 52 | +//type KMSProviderType string |
76 | 53 |
|
77 | | -const ( |
78 | | - // AWSKMSProvider represents a supported KMS provider for use with AWS KMS |
79 | | - // Deprecated: There is no logic listening to this resource type, we plan to remove it in next release. |
80 | | - AWSKMSProvider KMSProviderType = "AWS" |
| 54 | +//const ( |
| 55 | +// AWSKMSProvider represents a supported KMS provider for use with AWS KMS |
| 56 | +// AWSKMSProvider KMSProviderType = "AWS" |
| 57 | +//) |
81 | 58 |
|
82 | | - // ManualKMSProvider represents a supported KMS provider is managed by user manually not by OpenShift. |
83 | | - // KMS plugin is supposed to be run as static pods on each control plane |
84 | | - ManualKMSProvider KMSProviderType = "Manual" |
85 | | -) |
| 59 | +// End: TOMBSTONE |
0 commit comments