Skip to content

Commit d6243bb

Browse files
authored
add KMSKeyRef inside DBCluster and DBInstance (#71)
Issue #, if available: aws-controllers-k8s/community#1258 Description of changes: * Add reference for KMSKey inside DBCluster and DBInstance crds * Currently there is no support to test cross-controller resource reference. Once aws-controllers-k8s/community#1266 is resolved, I will add automated e2e tests * I manually tested the referencing KMSKey inside DBInstance works as expected. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 999b740 commit d6243bb

19 files changed

+300
-12
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-04-15T17:51:27Z"
3-
build_hash: 50c64871bcaf88b9ee200eb8d6b8245fa8f675eb
2+
build_date: "2022-04-19T21:22:13Z"
3+
build_hash: db274dc04c0ad2b6a7fc5a8c364909f3cd45ec6c
44
go_version: go1.17.5
5-
version: v0.18.4
6-
api_directory_checksum: c5762d0b5707ca20866f2f0e85bc23863733ca11
5+
version: v0.18.4-3-gdb274dc
6+
api_directory_checksum: e7bbd21f4f975f9cf1e1e804ebd450e8e310023d
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 3afea95265e7836112e0b1e37166290f18511d09
10+
file_checksum: 9526e946bbd1d8b3b4c76b010966f6c0158a6941
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/db_cluster.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/db_instance.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ resources:
9292
is_primary_key: true
9393
MasterUserPassword:
9494
is_secret: true
95+
KmsKeyId:
96+
references:
97+
resource: Key
98+
service_name: kms
99+
path: Status.ACKResourceMetadata.ARN
95100
DBClusterParameterGroup:
96101
renames:
97102
operations:
@@ -156,6 +161,11 @@ resources:
156161
from: DBSecurityGroupName
157162
MasterUserPassword:
158163
is_secret: true
164+
KmsKeyId:
165+
references:
166+
resource: Key
167+
service_name: kms
168+
path: Status.ACKResourceMetadata.ARN
159169
GlobalCluster:
160170
exceptions:
161171
terminal_codes:

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/controller/main.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/rds.services.k8s.aws_dbclusters.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,20 @@ spec:
218218
destination Amazon Web Services Region. This KMS key is used to
219219
encrypt the read replica in that Amazon Web Services Region."
220220
type: string
221+
kmsKeyRef:
222+
description: 'AWSResourceReferenceWrapper provides a wrapper around
223+
*AWSResourceReference type to provide more user friendly syntax
224+
for references using ''from'' field Ex: APIIDRef: from: name:
225+
my-api'
226+
properties:
227+
from:
228+
description: AWSResourceReference provides all the values necessary
229+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
230+
properties:
231+
name:
232+
type: string
233+
type: object
234+
type: object
221235
masterUserPassword:
222236
description: "The password for the master database user. This password
223237
can contain any printable ASCII character except \"/\", \"\"\",

config/crd/bases/rds.services.k8s.aws_dbinstances.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,20 @@ spec:
358358
key when this parameter is empty. You must explicitly specify a
359359
key."
360360
type: string
361+
kmsKeyRef:
362+
description: 'AWSResourceReferenceWrapper provides a wrapper around
363+
*AWSResourceReference type to provide more user friendly syntax
364+
for references using ''from'' field Ex: APIIDRef: from: name:
365+
my-api'
366+
properties:
367+
from:
368+
description: AWSResourceReference provides all the values necessary
369+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
370+
properties:
371+
name:
372+
type: string
373+
type: object
374+
type: object
361375
licenseModel:
362376
description: "License model information for this DB instance. \n Valid
363377
values: license-included | bring-your-own-license | general-public-license

config/rbac/cluster-role-controller.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ rules:
3232
- list
3333
- patch
3434
- watch
35+
- apiGroups:
36+
- kms.services.k8s.aws
37+
resources:
38+
- keys
39+
verbs:
40+
- get
41+
- list
42+
- apiGroups:
43+
- kms.services.k8s.aws
44+
resources:
45+
- keys/status
46+
verbs:
47+
- get
48+
- list
3549
- apiGroups:
3650
- rds.services.k8s.aws
3751
resources:

generator.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ resources:
9292
is_primary_key: true
9393
MasterUserPassword:
9494
is_secret: true
95+
KmsKeyId:
96+
references:
97+
resource: Key
98+
service_name: kms
99+
path: Status.ACKResourceMetadata.ARN
95100
DBClusterParameterGroup:
96101
renames:
97102
operations:
@@ -156,6 +161,11 @@ resources:
156161
from: DBSecurityGroupName
157162
MasterUserPassword:
158163
is_secret: true
164+
KmsKeyId:
165+
references:
166+
resource: Key
167+
service_name: kms
168+
path: Status.ACKResourceMetadata.ARN
159169
GlobalCluster:
160170
exceptions:
161171
terminal_codes:

0 commit comments

Comments
 (0)