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
+
managementModel: 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
+
managementModel: 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
+
managementModel: 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
+19-40Lines changed: 19 additions & 40 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
+
// managementModel defines how KMS plugins are managed.
7
+
// Valid values are "External".
8
+
// When set to External, encryption keys are managed by a user-deployed
9
+
// KMS plugin that communicates via unix domain socket using KMS V2 API.
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.
// 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.
16
+
// endpoint specifies the unix domain socket endpoint for communicating with the external KMS plugin.
17
+
// The endpoint must follow the format "unix:///path/to/socket" for filesystem-based sockets
18
+
// or "unix:///@abstractname" for abstract sockets.
40
19
//
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."
20
+
// +kubebuilder:validation:MaxLength=120
21
+
// +kubebuilder:validation:MinLength=9
22
+
// +kubebuilder:validation:XValidation:rule="self.matches('^unix:///(@[^/ ]+|[^@ ][^ ]*)$')",message="endpoint must follow the format 'unix:///path' or 'unix:///@abstractname'"
44
23
// +required
45
-
Regionstring`json:"region"`
24
+
Endpointstring`json:"endpoint,omitempty"`
46
25
}
47
26
48
-
// KMSProviderType is a specific supported KMS provider
49
-
// +kubebuilder:validation:Enum=AWS
50
-
typeKMSProviderTypestring
27
+
// ManagementModel describes how the KMS plugin is managed.
28
+
// Valid values are "External".
29
+
typeManagementModelstring
51
30
52
31
const (
53
-
// AWSKMSProvider represents a supported KMS provider for use with AWS KMS
54
-
AWSKMSProviderKMSProviderType="AWS"
32
+
// External represents a KMS plugin that is managed externally and accessed via unix domain socket
0 commit comments