-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
eks: renaming the cluster would trigger rollback due to not authorized to delete the cluster #29282
Comments
internal tracking: D120674266 |
From CFN's perspective, updating the cluster Name does trigger replacement: So I think it makes sense here. If fact the cluster resource handler role does have aws-cdk/packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts Lines 153 to 166 in cfd93b9
|
OK I guess the best solution is to add a note in the doc to work around like this as it doesn't make sense to allow the cluster admin role to const cluster = new eks.Cluster(this, 'demo-eks-cluster', {
vpc,
clusterName: 'foo', // will rename to 'bar'
defaultCapacity: 0,
version: eks.KubernetesVersion.V1_29,
kubectlLayer: new KubectlLayer(this, 'kubectlLayer'),
});
// allow the cluster admin role to delete the 'foo' cluster
cluster.adminRole.addToPolicy(new iam.PolicyStatement({
actions: ['eks:DeleteCluster'],
resources: [
Stack.of(this).formatArn({ service: 'eks', resource: 'cluster', resourceName: 'foo' }),
]
})) |
related to #24174 |
closing with #29283 |
|
### Issue # (if applicable) As described in #29282 , when renaming the cluster, an additional temporary IAM policy will be required. I am proposing the doc update to clarify this with this PR. Closes #29282 #24174 ### Reason for this change To address this use case. ### Description of changes ### Description of how you validated changes ### Checklist - [x] 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*
Describe the bug
Given the code:
If we rename the clusterName, it would trigger the replacement due to this, which creates a new one and delete the existing one. But we are seeing not authorized error hence rollback.
I am not sure if update clusterName should trigger replacement but obviously we probably need to add the relevant permissions to the cluster resource handler.
Expected Behavior
update the clusterName should not fail. Preferably in-place update but if replacement is necessary, it should not fail and roll back.
Current Behavior
fail and roll back
Reproduction Steps
as described above
Possible Solution
eks:DeleteCluster
on the cluster resource to the custom resource handler role.Additional Information/Context
No response
CDK CLI Version
v2.130.0
Framework Version
No response
Node.js Version
v18.16.0
OS
mac os x
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: