You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- name: Should fail to create AWS KMS with invalid keyARN format
100
+
initial: |
101
+
apiVersion: config.openshift.io/v1
102
+
kind: APIServer
103
+
spec:
104
+
encryption:
105
+
type: KMS
106
+
kms:
107
+
type: AWS
108
+
aws:
109
+
keyARN: not-a-kms-arn
110
+
region: us-east-1
111
+
expectedError: "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 (-)."
112
+
- name: Should fail to create AWS KMS with empty region
// APIServerEncryption is used to encrypt sensitive resources on the cluster.
177
+
// +openshift:validation:FeatureGateAwareXValidation:featureGate=KMSEncryptionProvider,rule="has(self.type) && self.type == 'KMS' ? has(self.kms) : !has(self.kms)",message="kms config is required when encryption type is KMS, and forbidden otherwise"
178
+
// +union
173
179
typeAPIServerEncryptionstruct {
174
180
// type defines what encryption type should be used to encrypt resources at the datastore layer.
175
181
// When this field is unset (i.e. when it is set to the empty string), identity is implied.
@@ -188,9 +194,23 @@ type APIServerEncryption struct {
188
194
// +unionDiscriminator
189
195
// +optional
190
196
TypeEncryptionType`json:"type,omitempty"`
197
+
198
+
// kms defines the configuration for the external KMS instance that manages the encryption keys,
199
+
// when KMS encryption is enabled sensitive resources will be encrypted using keys managed by an
200
+
// externally configured KMS instance.
201
+
//
202
+
// The Key Management Service (KMS) instance provides symmetric encryption and is responsible for
203
+
// managing the lifecyle of the encryption keys outside of the control plane.
204
+
// This allows integration with an external provider to manage the data encryption keys securely.
// KMSConfig defines the configuration for the KMS instance
4
+
// that will be used with KMSEncryptionProvider encryption
5
+
// +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"
6
+
// +union
7
+
typeKMSConfigstruct {
8
+
// type defines the kind of platform for the KMS provider.
9
+
// Available provider types are AWS only.
10
+
//
11
+
// +unionDiscriminator
12
+
// +required
13
+
TypeKMSProviderType`json:"type"`
14
+
15
+
// aws defines the key config for using an AWS KMS instance
16
+
// for the encryption. The AWS KMS instance is managed
17
+
// by the user outside the purview of the control plane.
18
+
//
19
+
// +unionMember
20
+
// +optional
21
+
AWS*AWSKMSConfig`json:"aws,omitempty"`
22
+
}
23
+
24
+
// AWSKMSConfig defines the KMS config specific to AWS KMS provider
25
+
typeAWSKMSConfigstruct {
26
+
// keyARN specifies the Amazon Resource Name (ARN) of the AWS KMS key used for encryption.
27
+
// The value must adhere to the format `arn:aws:kms:<region>:<account_id>:key/<key_id>`, where:
28
+
// - `<region>` is the AWS region consisting of lowercase letters and hyphens followed by a number.
29
+
// - `<account_id>` is a 12-digit numeric identifier for the AWS account.
30
+
// - `<key_id>` is a unique identifier for the KMS key, consisting of lowercase hexadecimal characters and hyphens.
31
+
//
32
+
// +kubebuilder:validation:MaxLength=128
33
+
// +kubebuilder:validation:MinLength=1
34
+
// +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 (-)."
35
+
// +required
36
+
KeyARNstring`json:"keyARN"`
37
+
// region specifies the AWS region where the KMS instance exists, and follows the format
// Only lowercase letters and hyphens followed by numbers are allowed.
40
+
//
41
+
// +kubebuilder:validation:MaxLength=64
42
+
// +kubebuilder:validation:MinLength=1
43
+
// +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."
44
+
// +optional
45
+
Regionstring`json:"region"`
46
+
}
47
+
48
+
// KMSProviderType is a specific supported KMS provider
49
+
// +kubebuilder:validation:Enum=AWS
50
+
typeKMSProviderTypestring
51
+
52
+
const (
53
+
// AWSKMSProvider represents a supported KMS provider for use with AWS KMS
0 commit comments