Skip to content

Commit fda9486

Browse files
committed
Add encryptionType: kms and kmsConfig in apiserver.config
* feature gated by TechPreviewNoUpgrade and KMSv2 Signed-off-by: Swarup Ghosh <[email protected]>
1 parent 3a4a2d1 commit fda9486

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

config/v1/types_apiserver.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ type APIServerNamedServingCert struct {
173173
ServingCertificate SecretNameReference `json:"servingCertificate"`
174174
}
175175

176+
// APIServerEncryption is used to encrypt sensitive resources on the cluster.
177+
//
178+
// +union
176179
type APIServerEncryption struct {
177180
// type defines what encryption type should be used to encrypt resources at the datastore layer.
178181
// When this field is unset (i.e. when it is set to the empty string), identity is implied.
@@ -191,9 +194,23 @@ type APIServerEncryption struct {
191194
// +unionDiscriminator
192195
// +optional
193196
Type EncryptionType `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.
205+
//
206+
// +openshift:enable:FeatureGate=KMSv2
207+
// +unionMember
208+
// +optional
209+
KMS *KMSConfig `json:"kms,omitempty"`
194210
}
195211

196-
// +kubebuilder:validation:Enum="";identity;aescbc;aesgcm
212+
// +openshift:validation:FeatureSetAwareEnum:featureSet=Default,enum="";identity;aescbc;aesgcm
213+
// +openshift:validation:FeatureSetAwareEnum:featureSet=TechPreviewNoUpgrade,enum="";identity;aescbc;aesgcm;kms
197214
type EncryptionType string
198215

199216
const (
@@ -208,6 +225,13 @@ const (
208225
// aesgcm refers to a type where AES-GCM with random nonce and a 32-byte key
209226
// is used to perform encryption at the datastore layer.
210227
EncryptionTypeAESGCM EncryptionType = "aesgcm"
228+
229+
// kms refers to a type of encryption where the encryption keys are managed
230+
// outside the control plane in a Key Management Service instance,
231+
// encryption is still performed at the datastore layer.
232+
//
233+
// +openshift:enable:FeatureGate=KMSv2
234+
EncryptionTypeKMS EncryptionType = "kms"
211235
)
212236

213237
type APIServerStatus struct {

config/v1/types_kmsencryption.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package v1
2+
3+
// KMSConfig defines the configuration for the KMS instance
4+
// that will be used with KMSv2 encryption
5+
//
6+
// +openshift:enable:FeatureGate=KMSv2
7+
type KMSConfig struct {
8+
// aws defines the key config for using an AWS KMS instance
9+
// for the encryption. The AWS KMS instance is managed
10+
// by the user outside the purview of the control plane.
11+
//
12+
// +optional
13+
AWS *AWSKMSConfig `json:"aws,omitempty"`
14+
}
15+
16+
// AWSKMSConfig defines the KMS config specific to AWS KMS provider
17+
//
18+
// +openshift:enable:FeatureGate=KMSv2
19+
type AWSKMSConfig struct {
20+
// keyARN is the AWS ARN for the symmetric encryption KMS key
21+
//
22+
// +kubebuilder:validation:Pattern=`^arn:aws:kms:[a-z0-9-]+:[0-9]{12}:key/[a-f0-9-]+$`
23+
KeyARN string `json:"keyARN"`
24+
// region is the AWS region where the KMS instance exists
25+
//
26+
// +kubebuilder:validation:Pattern=`^[a-z]{2}-[a-z]+-\d{1,2}$`
27+
Region string `json:"region"`
28+
}

0 commit comments

Comments
 (0)