Skip to content

Commit a8e1ec0

Browse files
Add resource references to cluster names (#17)
Description of changes: Add resource references to each of the custom resources to replace `ClusterName`. I have tested these changes manually and, while they work, are currently sub-optimal. The generated code currently does not check for the `ResourceSynced` condition to be `true` before resolving the reference. Therefore, since all of these resources reference the cluster spec field, they immediately resolve. As a result, the resources immediately attempt to create - even though the cluster is still in `CREATING` status. Once aws-controllers-k8s/community#1064 is properly implemented, and the code gating the `ResourceSynced` status is enabled, these resources should work flawlessly. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent dd817be commit a8e1ec0

19 files changed

+394
-22
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-01-09T00:30:18Z"
3-
build_hash: 3e184727de8a4dfd4769e3d88f4f52f885858335
2+
build_date: "2022-01-12T20:00:52Z"
3+
build_hash: b24c062600f1ae90d62e760c23e69651ac167a24
44
go_version: go1.17.1
55
version: v0.16.0
6-
api_directory_checksum: 18423a5aa90c547e267c460f25ce08e5c0b4aaa6
6+
api_directory_checksum: aca79dadb322fdb182185a7e9b9cb44e14b30d0a
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.38.67
99
generator_config_info:
10-
file_checksum: b66d077bc28c12a65378f3eb515c5ab814a93090
10+
file_checksum: 794a511b629b00b81bfe943eaf41eedf7c780ff7
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/addon.go

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

apis/v1alpha1/fargate_profile.go

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

apis/v1alpha1/generator.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
resources:
22
Addon:
3+
fields:
4+
ClusterName:
5+
references:
6+
resource: Cluster
7+
path: Spec.Name
38
renames:
49
operations:
510
CreateAddon:
@@ -58,6 +63,11 @@ resources:
5863
update_operation:
5964
custom_method_name: customUpdate
6065
FargateProfile:
66+
fields:
67+
ClusterName:
68+
references:
69+
resource: Cluster
70+
path: Spec.Name
6171
renames:
6272
operations:
6373
CreateFargateProfile:
@@ -87,6 +97,11 @@ resources:
8797
- MissingParameter
8898
- ValidationError
8999
Nodegroup:
100+
fields:
101+
ClusterName:
102+
references:
103+
resource: Cluster
104+
path: Spec.Name
90105
renames:
91106
operations:
92107
CreateNodegroup:

apis/v1alpha1/nodegroup.go

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

apis/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/eks.services.k8s.aws_addons.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ spec:
4848
clusterName:
4949
description: The name of the cluster to create the add-on for.
5050
type: string
51+
clusterNameRef:
52+
description: 'AWSResourceReferenceWrapper provides a wrapper around
53+
*AWSResourceReference type to provide more user friendly syntax
54+
for references using ''from'' field Ex: APIIDRef: from: name:
55+
my-api'
56+
properties:
57+
from:
58+
description: AWSResourceReference provides all the values necessary
59+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
60+
properties:
61+
name:
62+
type: string
63+
type: object
64+
type: object
5165
name:
5266
description: The name of the add-on. The name must match one of the
5367
names returned by ListAddons (https://docs.aws.amazon.com/eks/latest/APIReference/API_ListAddons.html).
@@ -77,7 +91,6 @@ spec:
7791
both of which you define.
7892
type: object
7993
required:
80-
- clusterName
8194
- name
8295
type: object
8396
status:

config/crd/bases/eks.services.k8s.aws_fargateprofiles.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ spec:
4545
description: The name of the Amazon EKS cluster to apply the Fargate
4646
profile to.
4747
type: string
48+
clusterNameRef:
49+
description: 'AWSResourceReferenceWrapper provides a wrapper around
50+
*AWSResourceReference type to provide more user friendly syntax
51+
for references using ''from'' field Ex: APIIDRef: from: name:
52+
my-api'
53+
properties:
54+
from:
55+
description: AWSResourceReference provides all the values necessary
56+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
57+
properties:
58+
name:
59+
type: string
60+
type: object
61+
type: object
4862
name:
4963
description: The name of the Fargate profile.
5064
type: string
@@ -91,7 +105,6 @@ spec:
91105
Fargate profile, such as the pods that are scheduled with it.
92106
type: object
93107
required:
94-
- clusterName
95108
- name
96109
- podExecutionRoleARN
97110
type: object

config/crd/bases/eks.services.k8s.aws_nodegroups.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ spec:
5858
clusterName:
5959
description: The name of the cluster to create the node group in.
6060
type: string
61+
clusterNameRef:
62+
description: 'AWSResourceReferenceWrapper provides a wrapper around
63+
*AWSResourceReference type to provide more user friendly syntax
64+
for references using ''from'' field Ex: APIIDRef: from: name:
65+
my-api'
66+
properties:
67+
from:
68+
description: AWSResourceReference provides all the values necessary
69+
to reference another k8s resource for finding the identifier(Id/ARN/Name)
70+
properties:
71+
name:
72+
type: string
73+
type: object
74+
type: object
6175
diskSize:
6276
description: The root device disk size (in GiB) for your node group
6377
instances. The default disk size is 20 GiB. If you specify launchTemplate,
@@ -217,7 +231,6 @@ spec:
217231
in the Amazon EKS User Guide.
218232
type: string
219233
required:
220-
- clusterName
221234
- name
222235
- nodeRole
223236
- subnets

generator.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
resources:
22
Addon:
3+
fields:
4+
ClusterName:
5+
references:
6+
resource: Cluster
7+
path: Spec.Name
38
renames:
49
operations:
510
CreateAddon:
@@ -58,6 +63,11 @@ resources:
5863
update_operation:
5964
custom_method_name: customUpdate
6065
FargateProfile:
66+
fields:
67+
ClusterName:
68+
references:
69+
resource: Cluster
70+
path: Spec.Name
6171
renames:
6272
operations:
6373
CreateFargateProfile:
@@ -87,6 +97,11 @@ resources:
8797
- MissingParameter
8898
- ValidationError
8999
Nodegroup:
100+
fields:
101+
ClusterName:
102+
references:
103+
resource: Cluster
104+
path: Spec.Name
90105
renames:
91106
operations:
92107
CreateNodegroup:

0 commit comments

Comments
 (0)