Skip to content

Commit 663939a

Browse files
authored
add immutability check for nodegroup fields (#152)
Description of changes: - Uses runtime/code-gen `v0.44.0` - Enhances nodegroup field validation by marking immutable fields: - AmiType - InstanceTypes - ClusterName - Name Prevents modifications that EKS does not allow to be changed after creation. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent be8ee62 commit 663939a

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
lines changed

Diff for: apis/v1alpha1/generator.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ resources:
312312
references:
313313
resource: Cluster
314314
path: Spec.Name
315+
is_immutable: true
316+
Name:
317+
is_immutable: true
315318
NodeRole:
316319
references:
317320
service_name: iam
@@ -333,6 +336,10 @@ resources:
333336
resource: Subnet
334337
path: Status.SubnetID
335338
is_immutable: true
339+
AmiType:
340+
is_immutable: true
341+
InstanceTypes:
342+
is_immutable: true
336343
Taints:
337344
compare:
338345
is_ignored: true

Diff for: apis/v1alpha1/nodegroup.go

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

Diff for: config/crd/bases/eks.services.k8s.aws_nodegroups.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ spec:
8585
Amazon EKS, see Customizing managed nodes with launch templates (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html)
8686
in the Amazon EKS User Guide.
8787
type: string
88+
x-kubernetes-validations:
89+
- message: Value is immutable once set
90+
rule: self == oldSelf
8891
capacityType:
8992
description: The capacity type for your node group.
9093
type: string
@@ -96,6 +99,9 @@ spec:
9699
clusterName:
97100
description: The name of your cluster.
98101
type: string
102+
x-kubernetes-validations:
103+
- message: Value is immutable once set
104+
rule: self == oldSelf
99105
clusterRef:
100106
description: "AWSResourceReferenceWrapper provides a wrapper around
101107
*AWSResourceReference\ntype to provide more user friendly syntax
@@ -144,6 +150,9 @@ spec:
144150
items:
145151
type: string
146152
type: array
153+
x-kubernetes-validations:
154+
- message: Value is immutable once set
155+
rule: self == oldSelf
147156
labels:
148157
additionalProperties:
149158
type: string
@@ -169,6 +178,9 @@ spec:
169178
name:
170179
description: The unique name to give your node group.
171180
type: string
181+
x-kubernetes-validations:
182+
- message: Value is immutable once set
183+
rule: self == oldSelf
172184
nodeRole:
173185
description: |-
174186
The Amazon Resource Name (ARN) of the IAM role to associate with your node

Diff for: generator.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ resources:
312312
references:
313313
resource: Cluster
314314
path: Spec.Name
315+
is_immutable: true
316+
Name:
317+
is_immutable: true
315318
NodeRole:
316319
references:
317320
service_name: iam
@@ -333,6 +336,10 @@ resources:
333336
resource: Subnet
334337
path: Status.SubnetID
335338
is_immutable: true
339+
AmiType:
340+
is_immutable: true
341+
InstanceTypes:
342+
is_immutable: true
336343
Taints:
337344
compare:
338345
is_ignored: true

Diff for: helm/crds/eks.services.k8s.aws_nodegroups.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ spec:
8585
Amazon EKS, see Customizing managed nodes with launch templates (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html)
8686
in the Amazon EKS User Guide.
8787
type: string
88+
x-kubernetes-validations:
89+
- message: Value is immutable once set
90+
rule: self == oldSelf
8891
capacityType:
8992
description: The capacity type for your node group.
9093
type: string
@@ -96,6 +99,9 @@ spec:
9699
clusterName:
97100
description: The name of your cluster.
98101
type: string
102+
x-kubernetes-validations:
103+
- message: Value is immutable once set
104+
rule: self == oldSelf
99105
clusterRef:
100106
description: "AWSResourceReferenceWrapper provides a wrapper around
101107
*AWSResourceReference\ntype to provide more user friendly syntax
@@ -144,6 +150,9 @@ spec:
144150
items:
145151
type: string
146152
type: array
153+
x-kubernetes-validations:
154+
- message: Value is immutable once set
155+
rule: self == oldSelf
147156
labels:
148157
additionalProperties:
149158
type: string
@@ -169,6 +178,9 @@ spec:
169178
name:
170179
description: The unique name to give your node group.
171180
type: string
181+
x-kubernetes-validations:
182+
- message: Value is immutable once set
183+
rule: self == oldSelf
172184
nodeRole:
173185
description: |-
174186
The Amazon Resource Name (ARN) of the IAM role to associate with your node

0 commit comments

Comments
 (0)