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 be able to create KMS with abstract socket endpoint
91
+
initial: |
92
+
apiVersion: config.openshift.io/v1
93
+
kind: APIServer
94
+
spec:
95
+
encryption:
96
+
type: KMS
97
+
kms:
98
+
type: External
99
+
endpoint: unix:///@abstractsocket
100
+
expected: |
101
+
apiVersion: config.openshift.io/v1
102
+
kind: APIServer
103
+
spec:
104
+
audit:
105
+
profile: Default
106
+
encryption:
107
+
type: KMS
108
+
kms:
109
+
type: External
110
+
endpoint: unix:///@abstractsocket
111
+
- name: Should fail to create KMS with empty endpoint
90
112
initial: |
91
113
apiVersion: config.openshift.io/v1
92
114
kind: APIServer
93
115
spec:
94
116
encryption:
95
117
type: KMS
96
118
kms:
97
-
type: AWS
98
-
aws:
99
-
keyARN: not-a-kms-arn
100
-
region: us-east-1
101
-
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 (-)."
102
-
- name: Should fail to create AWS KMS with empty region
119
+
type: External
120
+
endpoint: ""
121
+
expectedError: "spec.encryption.kms.endpoint in body should be at least 9 chars long"
122
+
- name: Should fail to create KMS with endpoint containing spaces
Copy file name to clipboardExpand all lines: config/v1/types_kmsencryption.go
+17-38Lines changed: 17 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -2,54 +2,33 @@ package v1
2
2
3
3
// KMSConfig defines the configuration for the KMS instance
4
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
5
typeKMSConfigstruct {
8
-
// type defines the kind of platform for the KMS provider.
9
-
// Available provider types are AWS only.
6
+
// type defines the kind of KMS provider.
7
+
// Valid values are "External".
8
+
// When set to External, the KMS provider is an external plugin accessed via unix socket.
9
+
// When not specified, defaults to External.
10
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
11
+
// +kubebuilder:default=External
20
12
// +optional
21
-
AWS*AWSKMSConfig`json:"aws,omitempty"`
22
-
}
13
+
TypeKMSProviderType`json:"type,omitempty"`
23
14
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.
15
+
// endpoint specifies the unix domain socket endpoint for communicating with the external KMS plugin.
16
+
// The endpoint must follow the format "unix:///path/to/socket" for filesystem-based sockets
17
+
// or "unix:///@abstractname" for abstract sockets.
40
18
//
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."
19
+
// +kubebuilder:validation:MaxLength=120
20
+
// +kubebuilder:validation:MinLength=9
21
+
// +kubebuilder:validation:XValidation:rule="self.matches('^unix:///(@[^/ ]+|[^@ ][^ ]*)$')",message="endpoint must follow the format 'unix:///path' or 'unix:///@abstractname'"
44
22
// +required
45
-
Regionstring`json:"region"`
23
+
Endpointstring`json:"endpoint,omitempty"`
46
24
}
47
25
48
26
// KMSProviderType is a specific supported KMS provider
49
-
// +kubebuilder:validation:Enum=AWS
27
+
// Valid values are "External".
28
+
// +kubebuilder:validation:Enum=External
50
29
typeKMSProviderTypestring
51
30
52
31
const (
53
-
// AWSKMSProvider represents a supported KMS provider for use with AWS KMS
54
-
AWSKMSProviderKMSProviderType="AWS"
32
+
// ExternalKMSProvider represents an external KMS provider accessed via unix socket
0 commit comments