Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add refs support for various fields #123

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2023-09-18T21:10:37Z"
build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d
go_version: go1.20.3
version: v0.27.1
api_directory_checksum: 885f952f7ca2ce7a676b9bbf8eb262de71de6238
build_date: "2023-11-22T07:12:46Z"
build_hash: 1cc9b5172d3d1676af578a3411e8672698ec29ce
go_version: go1.21.4
version: v0.27.1-5-g1cc9b51-dirty
api_directory_checksum: bd34f72147706f1dbc990acf4a6c4f6615c1bddb
api_version: v1alpha1
aws_sdk_go_version: v1.44.93
generator_config_info:
file_checksum: bd93202f4d05393bb2ff98344e8e603e3228cc51
file_checksum: 3f88502d4b7623890c8eff789285f98fa3d84553
original_file_name: generator.yaml
last_modification:
reason: API generation
4 changes: 2 additions & 2 deletions apis/v1alpha1/cache_subnet_group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ resources:
- InvalidParameterValue
- InvalidParameterCombination
fields:
SubnetIDs:
references:
service_name: ec2
resource: Subnet
path: Status.SubnetID
Events:
is_read_only: true
from:
Expand Down Expand Up @@ -50,6 +55,19 @@ resources:
AutomaticFailoverEnabled:
compare:
is_ignored: true
CacheParameterGroupName:
references:
resource: CacheParameterGroup
path: Spec.CacheParameterGroupName
CacheSubnetGroupName:
references:
resource: CacheSubnetGroup
path: Spec.CacheSubnetGroupName
SecurityGroupIDs:
references:
resource: SecurityGroup
service_name: ec2
path: Status.ID
Events:
is_read_only: true
from:
Expand Down
9 changes: 6 additions & 3 deletions apis/v1alpha1/replication_group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cmd/controller/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ spec:
items:
type: string
type: array
subnetRefs:
items:
description: "AWSResourceReferenceWrapper provides a wrapper around
*AWSResourceReference type to provide more user friendly syntax
for references using 'from' field Ex: APIIDRef: \n from: name:
my-api"
properties:
from:
description: AWSResourceReference provides all the values necessary
to reference another k8s resource for finding the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
type: array
tags:
description: A list of tags to be added to this resource. A tag is
a key-value pair. A tag key must be accompanied by a tag value,
Expand All @@ -72,7 +88,6 @@ spec:
required:
- cacheSubnetGroupDescription
- cacheSubnetGroupName
- subnetIDs
type: object
status:
description: CacheSubnetGroupStatus defines the observed state of CacheSubnetGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ spec:
\n * To create a Redis (cluster mode enabled) replication group,
use CacheParameterGroupName=default.redis3.2.cluster.on."
type: string
cacheParameterGroupRef:
description: "AWSResourceReferenceWrapper provides a wrapper around
*AWSResourceReference type to provide more user friendly syntax
for references using 'from' field Ex: APIIDRef: \n from: name: my-api"
properties:
from:
description: AWSResourceReference provides all the values necessary
to reference another k8s resource for finding the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
cacheSecurityGroupNames:
description: A list of cache security group names to associate with
this replication group.
Expand All @@ -153,6 +166,19 @@ spec:
creating a cluster. For more information, see Subnets and Subnet
Groups (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SubnetGroups.html)."
type: string
cacheSubnetGroupRef:
description: "AWSResourceReferenceWrapper provides a wrapper around
*AWSResourceReference type to provide more user friendly syntax
for references using 'from' field Ex: APIIDRef: \n from: name: my-api"
properties:
from:
description: AWSResourceReference provides all the values necessary
to reference another k8s resource for finding the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
dataTieringEnabled:
description: Enables data tiering. Data tiering is only supported
for replication groups using the r6gd node type. This parameter
Expand Down Expand Up @@ -326,6 +352,22 @@ spec:
items:
type: string
type: array
securityGroupRefs:
items:
description: "AWSResourceReferenceWrapper provides a wrapper around
*AWSResourceReference type to provide more user friendly syntax
for references using 'from' field Ex: APIIDRef: \n from: name:
my-api"
properties:
from:
description: AWSResourceReference provides all the values necessary
to reference another k8s resource for finding the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
type: array
snapshotARNs:
description: "A list of Amazon Resource Names (ARN) that uniquely
identify the Redis RDB snapshot files stored in Amazon S3. The snapshot
Expand Down
28 changes: 28 additions & 0 deletions config/rbac/cluster-role-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ rules:
- list
- patch
- watch
- apiGroups:
- ec2.services.k8s.aws
resources:
- securitygroups
verbs:
- get
- list
- apiGroups:
- ec2.services.k8s.aws
resources:
- securitygroups/status
verbs:
- get
- list
- apiGroups:
- ec2.services.k8s.aws
resources:
- subnets
verbs:
- get
- list
- apiGroups:
- ec2.services.k8s.aws
resources:
- subnets/status
verbs:
- get
- list
- apiGroups:
- elasticache.services.k8s.aws
resources:
Expand Down
18 changes: 18 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ resources:
- InvalidParameterValue
- InvalidParameterCombination
fields:
SubnetIDs:
references:
service_name: ec2
resource: Subnet
path: Status.SubnetID
Events:
is_read_only: true
from:
Expand Down Expand Up @@ -50,6 +55,19 @@ resources:
AutomaticFailoverEnabled:
compare:
is_ignored: true
CacheParameterGroupName:
references:
resource: CacheParameterGroup
path: Spec.CacheParameterGroupName
CacheSubnetGroupName:
references:
resource: CacheSubnetGroup
path: Spec.CacheSubnetGroupName
SecurityGroupIDs:
references:
resource: SecurityGroup
service_name: ec2
path: Status.ID
Events:
is_read_only: true
from:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
)

require (
github.com/aws-controllers-k8s/ec2-controller v1.0.7 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aws-controllers-k8s/ec2-controller v1.0.7 h1:7MDu2bq8NFKbgzzgHYPFRT7bf+SmTchgWuq8ixKK0Jc=
github.com/aws-controllers-k8s/ec2-controller v1.0.7/go.mod h1:PvsQehgncHgcu9FiY13M45+GkVsKI98g7G83SrgH7vY=
github.com/aws-controllers-k8s/runtime v0.27.1 h1:tvJRQDioBFkob0kF4DwgS7MsoXZKwkG5QCHWxFEh+2o=
github.com/aws-controllers-k8s/runtime v0.27.1/go.mod h1:oSCqCzbzJLUrzv+cx4TIxCuSUvL75ABJmhxBc87IRqc=
github.com/aws/aws-sdk-go v1.44.93 h1:hAgd9fuaptBatSft27/5eBMdcA8+cIMqo96/tZ6rKl8=
Expand Down
17 changes: 16 additions & 1 deletion helm/crds/elasticache.services.k8s.aws_cachesubnetgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ spec:
items:
type: string
type: array
subnetRefs:
items:
description: "AWSResourceReferenceWrapper provides a wrapper around
*AWSResourceReference type to provide more user friendly syntax
for references using 'from' field Ex: APIIDRef: \n from: name:
my-api"
properties:
from:
description: AWSResourceReference provides all the values necessary
to reference another k8s resource for finding the identifier(Id/ARN/Name)
properties:
name:
type: string
type: object
type: object
type: array
tags:
description: A list of tags to be added to this resource. A tag is
a key-value pair. A tag key must be accompanied by a tag value,
Expand All @@ -72,7 +88,6 @@ spec:
required:
- cacheSubnetGroupDescription
- cacheSubnetGroupName
- subnetIDs
type: object
status:
description: CacheSubnetGroupStatus defines the observed state of CacheSubnetGroup
Expand Down
Loading