Skip to content

Commit 4aa7ba4

Browse files
feat: add refs support for various fields (#123)
## Issue #, if available: Closes aws-controllers-k8s/community#1513 Closes aws-controllers-k8s/community#1860 ## Description of changes: The following fields have had refs support added: - CacheSubnetGroup.SubnetIDs: ec2.Subnet.Status.SubnetID - ReplicationGroup.CacheParameterGroupName: CacheParameterGroup.Spec.CacheParameterGroupName - ReplicationGroup.CacheSubnetGroupName: CacheSubnetGroup.Spec.CacheSubnetGroupName - ReplicationGroup.SecurityGroupIDs: ec2.SecurityGroup.Status.ID --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 41717fa commit 4aa7ba4

20 files changed

+683
-18
lines changed
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-09-18T21:10:37Z"
3-
build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d
4-
go_version: go1.20.3
5-
version: v0.27.1
6-
api_directory_checksum: 885f952f7ca2ce7a676b9bbf8eb262de71de6238
2+
build_date: "2023-11-22T07:12:46Z"
3+
build_hash: 1cc9b5172d3d1676af578a3411e8672698ec29ce
4+
go_version: go1.21.4
5+
version: v0.27.1-5-g1cc9b51-dirty
6+
api_directory_checksum: bd34f72147706f1dbc990acf4a6c4f6615c1bddb
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: bd93202f4d05393bb2ff98344e8e603e3228cc51
10+
file_checksum: 3f88502d4b7623890c8eff789285f98fa3d84553
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/cache_subnet_group.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ resources:
1313
- InvalidParameterValue
1414
- InvalidParameterCombination
1515
fields:
16+
SubnetIDs:
17+
references:
18+
service_name: ec2
19+
resource: Subnet
20+
path: Status.SubnetID
1621
Events:
1722
is_read_only: true
1823
from:
@@ -50,6 +55,19 @@ resources:
5055
AutomaticFailoverEnabled:
5156
compare:
5257
is_ignored: true
58+
CacheParameterGroupName:
59+
references:
60+
resource: CacheParameterGroup
61+
path: Spec.CacheParameterGroupName
62+
CacheSubnetGroupName:
63+
references:
64+
resource: CacheSubnetGroup
65+
path: Spec.CacheSubnetGroupName
66+
SecurityGroupIDs:
67+
references:
68+
resource: SecurityGroup
69+
service_name: ec2
70+
path: Status.ID
5371
Events:
5472
is_read_only: true
5573
from:

apis/v1alpha1/replication_group.go

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/controller/main.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/elasticache.services.k8s.aws_cachesubnetgroups.yaml

+16-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ spec:
5050
items:
5151
type: string
5252
type: array
53+
subnetRefs:
54+
items:
55+
description: "AWSResourceReferenceWrapper provides a wrapper around
56+
*AWSResourceReference type to provide more user friendly syntax
57+
for references using 'from' field Ex: APIIDRef: \n from: name:
58+
my-api"
59+
properties:
60+
from:
61+
description: AWSResourceReference provides all the values necessary
62+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
63+
properties:
64+
name:
65+
type: string
66+
type: object
67+
type: object
68+
type: array
5369
tags:
5470
description: A list of tags to be added to this resource. A tag is
5571
a key-value pair. A tag key must be accompanied by a tag value,
@@ -72,7 +88,6 @@ spec:
7288
required:
7389
- cacheSubnetGroupDescription
7490
- cacheSubnetGroupName
75-
- subnetIDs
7691
type: object
7792
status:
7893
description: CacheSubnetGroupStatus defines the observed state of CacheSubnetGroup

config/crd/bases/elasticache.services.k8s.aws_replicationgroups.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ spec:
140140
\n * To create a Redis (cluster mode enabled) replication group,
141141
use CacheParameterGroupName=default.redis3.2.cluster.on."
142142
type: string
143+
cacheParameterGroupRef:
144+
description: "AWSResourceReferenceWrapper provides a wrapper around
145+
*AWSResourceReference type to provide more user friendly syntax
146+
for references using 'from' field Ex: APIIDRef: \n from: name: my-api"
147+
properties:
148+
from:
149+
description: AWSResourceReference provides all the values necessary
150+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
151+
properties:
152+
name:
153+
type: string
154+
type: object
155+
type: object
143156
cacheSecurityGroupNames:
144157
description: A list of cache security group names to associate with
145158
this replication group.
@@ -153,6 +166,19 @@ spec:
153166
creating a cluster. For more information, see Subnets and Subnet
154167
Groups (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SubnetGroups.html)."
155168
type: string
169+
cacheSubnetGroupRef:
170+
description: "AWSResourceReferenceWrapper provides a wrapper around
171+
*AWSResourceReference type to provide more user friendly syntax
172+
for references using 'from' field Ex: APIIDRef: \n from: name: my-api"
173+
properties:
174+
from:
175+
description: AWSResourceReference provides all the values necessary
176+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
177+
properties:
178+
name:
179+
type: string
180+
type: object
181+
type: object
156182
dataTieringEnabled:
157183
description: Enables data tiering. Data tiering is only supported
158184
for replication groups using the r6gd node type. This parameter
@@ -326,6 +352,22 @@ spec:
326352
items:
327353
type: string
328354
type: array
355+
securityGroupRefs:
356+
items:
357+
description: "AWSResourceReferenceWrapper provides a wrapper around
358+
*AWSResourceReference type to provide more user friendly syntax
359+
for references using 'from' field Ex: APIIDRef: \n from: name:
360+
my-api"
361+
properties:
362+
from:
363+
description: AWSResourceReference provides all the values necessary
364+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
365+
properties:
366+
name:
367+
type: string
368+
type: object
369+
type: object
370+
type: array
329371
snapshotARNs:
330372
description: "A list of Amazon Resource Names (ARN) that uniquely
331373
identify the Redis RDB snapshot files stored in Amazon S3. The snapshot

config/rbac/cluster-role-controller.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,34 @@ rules:
3131
- list
3232
- patch
3333
- watch
34+
- apiGroups:
35+
- ec2.services.k8s.aws
36+
resources:
37+
- securitygroups
38+
verbs:
39+
- get
40+
- list
41+
- apiGroups:
42+
- ec2.services.k8s.aws
43+
resources:
44+
- securitygroups/status
45+
verbs:
46+
- get
47+
- list
48+
- apiGroups:
49+
- ec2.services.k8s.aws
50+
resources:
51+
- subnets
52+
verbs:
53+
- get
54+
- list
55+
- apiGroups:
56+
- ec2.services.k8s.aws
57+
resources:
58+
- subnets/status
59+
verbs:
60+
- get
61+
- list
3462
- apiGroups:
3563
- elasticache.services.k8s.aws
3664
resources:

generator.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ resources:
1313
- InvalidParameterValue
1414
- InvalidParameterCombination
1515
fields:
16+
SubnetIDs:
17+
references:
18+
service_name: ec2
19+
resource: Subnet
20+
path: Status.SubnetID
1621
Events:
1722
is_read_only: true
1823
from:
@@ -50,6 +55,19 @@ resources:
5055
AutomaticFailoverEnabled:
5156
compare:
5257
is_ignored: true
58+
CacheParameterGroupName:
59+
references:
60+
resource: CacheParameterGroup
61+
path: Spec.CacheParameterGroupName
62+
CacheSubnetGroupName:
63+
references:
64+
resource: CacheSubnetGroup
65+
path: Spec.CacheSubnetGroupName
66+
SecurityGroupIDs:
67+
references:
68+
resource: SecurityGroup
69+
service_name: ec2
70+
path: Status.ID
5371
Events:
5472
is_read_only: true
5573
from:

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
)
2020

2121
require (
22+
github.com/aws-controllers-k8s/ec2-controller v1.0.7 // indirect
2223
github.com/beorn7/perks v1.0.1 // indirect
2324
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
2425
github.com/cespare/xxhash/v2 v2.1.2 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
3838
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
3939
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
4040
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
41+
github.com/aws-controllers-k8s/ec2-controller v1.0.7 h1:7MDu2bq8NFKbgzzgHYPFRT7bf+SmTchgWuq8ixKK0Jc=
42+
github.com/aws-controllers-k8s/ec2-controller v1.0.7/go.mod h1:PvsQehgncHgcu9FiY13M45+GkVsKI98g7G83SrgH7vY=
4143
github.com/aws-controllers-k8s/runtime v0.27.1 h1:tvJRQDioBFkob0kF4DwgS7MsoXZKwkG5QCHWxFEh+2o=
4244
github.com/aws-controllers-k8s/runtime v0.27.1/go.mod h1:oSCqCzbzJLUrzv+cx4TIxCuSUvL75ABJmhxBc87IRqc=
4345
github.com/aws/aws-sdk-go v1.44.93 h1:hAgd9fuaptBatSft27/5eBMdcA8+cIMqo96/tZ6rKl8=

helm/crds/elasticache.services.k8s.aws_cachesubnetgroups.yaml

+16-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ spec:
5050
items:
5151
type: string
5252
type: array
53+
subnetRefs:
54+
items:
55+
description: "AWSResourceReferenceWrapper provides a wrapper around
56+
*AWSResourceReference type to provide more user friendly syntax
57+
for references using 'from' field Ex: APIIDRef: \n from: name:
58+
my-api"
59+
properties:
60+
from:
61+
description: AWSResourceReference provides all the values necessary
62+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
63+
properties:
64+
name:
65+
type: string
66+
type: object
67+
type: object
68+
type: array
5369
tags:
5470
description: A list of tags to be added to this resource. A tag is
5571
a key-value pair. A tag key must be accompanied by a tag value,
@@ -72,7 +88,6 @@ spec:
7288
required:
7389
- cacheSubnetGroupDescription
7490
- cacheSubnetGroupName
75-
- subnetIDs
7691
type: object
7792
status:
7893
description: CacheSubnetGroupStatus defines the observed state of CacheSubnetGroup

0 commit comments

Comments
 (0)