-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(eks): can't update authMode with the same mode #31043
fix(eks): can't update authMode with the same mode #31043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
@@ -247,6 +247,13 @@ export class ClusterResourceHandler extends ResourceHandler { | |||
this.newProps.accessConfig?.authenticationMode === 'API') { | |||
throw new Error('Cannot update from CONFIG_MAP to API'); | |||
} | |||
// update-authmode will fail if we try to update to the same mode, | |||
// so skip in this case. | |||
const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we try catch this API call to avoid network issues or any other issue that will fail customer handler code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GavinZZ just added the try/catch and manually re-validated it in us-east-1. It deployed with no error.
Discussed offline. The integration and unit tests are hard for this change. We've manually tested it by deploying a stack and verified. |
@mergify update |
❌ Mergify doesn't have permission to updateFor security reasons, Mergify can't update this pull request. Try updating locally. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
The cluster resource handler would fail when updating the authMode with exactly the same mode. This could happen as described in #31032
We need to check if the cluster is already at the desired authMode and gracefully ignore the update.
Issue # (if applicable)
Closes #31032
Reason for this change
Description of changes
Description of how you validated changes
This PR is essentially to address a very special case described in #31032 and not easy to have a unit test or integ test for that. Instead, I validated it using manual deployment.
step 1: initial deployment of a default eks cluster with undefined authenticationMode
step 2: update the cluster and add a s3 bucket that would fail and trigger the rollback. At this point, eks auth mode would update but can't be rolled back. This makes the resource state out of sync with CFN.
step 3: re-deploy the same stack without the s3 bucket but with the same auth mode in step 2. As the cluster has already modified its auth mode, this step should gracefully succeed.
And it's validated in
us-east-1
.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license