Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(eks): cluster deployment issue when the authentication mode is no…
…t changing (aws#33680) ### Reason for this change The issue happens in a very small edge case: 1. create a eks.Cluster like this ``` new eks.Cluster(this, 'Cluster', { version: eks.KubernetesVersion.V1_32, kubectlLayer: new KubectlV32Layer(this, 'KubectlLayer'), }); ``` 2. In EKS console, modify the Auth model from CONFIG_MAP to API_AND_CONFIG_MAP, wait a few minutes until it completes. 3. Again, update from API_AND_CONFIG_MAP to API from console, wait until it completes 4. Now in CDK, add ``` authenticationMode: eks.AuthenticationMode.API, ``` 5. When we re-deploy, CDK would have a validation error: ``` Received response status [FAILED] from custom resource. Message returned: Cannot update from undefined(CONFIG_MAP) to API ``` It is because in local template, the auth mode is `Config_Map` while the actual resource is using `API` mode. In this case, cdk deployment should ignore the update instead of throwing an error. ### Description of changes Move the code order a little bit. Basically check if the updated auth mode is the same as existing mode first then do some validations. ### Description of how you validated changes Existing unit tests/integration tests passed. I removed 2 unit tests which are not applicable because `DescribeCluster` api call will always return auth mode. Manually tested the change in the edge case. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information