Commit f02dfb8
authored
Ensure Ref is not overwritten in Spec (#128)
Issue [#1898](aws-controllers-k8s/community#1898)
Description of changes:
Similarly as the ec2-controller, the ref stored in a
struct is being overwritten during create/update.
With this fix we ensure the ref would not be discarded.
Currently there isn't a way to test this fix, as we can't
run two controllers simultaneously and reference subnet
names in cluster directly.
Instead I will document an example with the fix working in this PR
provided:
```yaml
apiVersion: eks.services.k8s.aws/v1alpha1
kind: Cluster
metadata:
name: my-clust
spec:
name: my-clust
roleARN: <removed>
version: "1.30"
resourcesVPCConfig:
endpointPrivateAccess: true
endpointPublicAccess: false
subnetRefs:
- from:
name: sub1
- from:
name: sub2
```
Creating .spec and status:
```yaml
spec:
accessConfig:
authenticationMode: CONFIG_MAP
bootstrapClusterCreatorAdminPermissions: true
kubernetesNetworkConfig:
ipFamily: ipv4
serviceIPv4CIDR: 172.20.0.0/16
logging:
clusterLogging:
- enabled: false
types:
- api
- audit
- authenticator
- controllerManager
- scheduler
name: my-clust
resourcesVPCConfig:
endpointPrivateAccess: true
endpointPublicAccess: true
publicAccessCIDRs:
- 0.0.0.0/0
subnetRefs:
- from:
name: sub1
- from:
name: sub2
roleARN: <removed>
version: "1.30"
status:
ackResourceMetadata:
arn: <removed>
ownerAccountID: <removed>
region: us-west-2
certificateAuthority: {}
conditions:
- lastTransitionTime: "2024-09-18T20:56:50Z"
status: "True"
type: ACK.ReferencesResolved
- lastTransitionTime: "2024-09-18T20:56:51Z"
status: "False"
type: ACK.ResourceSynced
createdAt: "2024-09-18T20:56:50Z"
health: {}
platformVersion: eks.8
status: CREATING
```
Active:
```yaml
spec:
accessConfig:
authenticationMode: CONFIG_MAP
bootstrapClusterCreatorAdminPermissions: true
kubernetesNetworkConfig:
ipFamily: ipv4
serviceIPv4CIDR: 172.20.0.0/16
logging:
clusterLogging:
- enabled: false
types:
- api
- audit
- authenticator
- controllerManager
- scheduler
name: my-clust
resourcesVPCConfig:
endpointPrivateAccess: true
endpointPublicAccess: true
publicAccessCIDRs:
- 0.0.0.0/0
subnetRefs:
- from:
name: sub1
- from:
name: sub2
roleARN: <removed>
version: "1.30"
status:
ackResourceMetadata:
<removed>
ownerAccountID: <removed>
region: us-west-2
certificateAuthority:
data: <removed>
conditions:
- lastTransitionTime: "2024-09-18T22:00:27Z"
status: "True"
type: ACK.ReferencesResolved
- lastTransitionTime: "2024-09-18T22:00:28Z"
status: "True"
type: ACK.ResourceSynced
createdAt: "2024-09-18T20:56:50Z"
endpoint: https://DFD284F7337766E87670192E4EB46565.gr7.us-west-2.eks.amazonaws.com
health: {}
identity:
oidc:
issuer: https://oidc.eks.us-west-2.amazonaws.com/id/DFD284F7337766E87670192E4EB46565
platformVersion: eks.8
status: ACTIVE
```
Updating:
```yaml
spec:
accessConfig:
authenticationMode: CONFIG_MAP
bootstrapClusterCreatorAdminPermissions: true
kubernetesNetworkConfig:
ipFamily: ipv4
serviceIPv4CIDR: 172.20.0.0/16
logging:
clusterLogging:
- enabled: false
types:
- api
- audit
- authenticator
- controllerManager
- scheduler
name: my-clust
resourcesVPCConfig:
endpointPrivateAccess: true
endpointPublicAccess: false
publicAccessCIDRs:
- 0.0.0.0/0
subnetRefs:
- from:
name: sub1
- from:
name: sub2
roleARN: <removed>
version: "1.30"
status:
ackResourceMetadata:
arn: <removed>
ownerAccountID: <removed>
region: us-west-2
certificateAuthority:
data: <removed>
conditions:
- lastTransitionTime: "2024-09-18T22:04:38Z"
status: "True"
type: ACK.ReferencesResolved
- lastTransitionTime: "2024-09-18T22:04:38Z"
message: Cluster is in 'UPDATING' status
status: "False"
type: ACK.ResourceSynced
- message: cluster in 'UPDATING' state, cannot be modified until 'ACTIVE'
status: "True"
type: ACK.Recoverable
createdAt: "2024-09-18T20:56:50Z"
endpoint: https://DFD284F7337766E87670192E4EB46565.gr7.us-west-2.eks.amazonaws.com
health: {}
identity:
oidc:
issuer: https://oidc.eks.us-west-2.amazonaws.com/id/DFD284F7337766E87670192E4EB46565
platformVersion: eks.8
status: UPDATING
```
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 5256d32 commit f02dfb8
File tree
4 files changed
+36
-5
lines changed- apis/v1alpha1
- pkg/resource/cluster
- templates/hooks/cluster
4 files changed
+36
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
1 | 9 | | |
2 | 10 | | |
3 | 11 | | |
| |||
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
| 17 | + | |
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
1 | 9 | | |
2 | 10 | | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
6 | 14 | | |
7 | | - | |
8 | | - | |
| 15 | + | |
0 commit comments