Skip to content
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: ack prop for potential cluster replacement #30107

Open
1 of 2 tasks
pahud opened this issue May 8, 2024 · 0 comments
Open
1 of 2 tasks

eks: ack prop for potential cluster replacement #30107

pahud opened this issue May 8, 2024 · 0 comments
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@pahud
Copy link
Contributor

pahud commented May 8, 2024

Describe the feature

aws-eks.Cluster has some cluster props that would result in cluster replacement on prop update.

// if there is an update that requires replacement, go ahead and just create
// a new cluster with the new config. The old cluster will automatically be
// deleted by cloudformation upon success.
if (updates.replaceName || updates.replaceRole || updates.replaceVpc) {
// if we are replacing this cluster and the cluster has an explicit
// physical name, the creation of the new cluster will fail with "there is
// already a cluster with that name". this is a common behavior for
// CloudFormation resources that support specifying a physical name.
if (this.oldProps.name === this.newProps.name && this.oldProps.name) {
throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`);
}
return this.onCreate();
}

And users can hardly tell that from cdk diff or cdk deploy as the cluster resource is actually a custom resource and we just notice the custom resource props change in this case.

We only notice that the custom resource would change but in fact the existing cluster would be torn down and replaced, resulting data loss.

image

I think we should have a gatekeeper prop which default value is false and only when you explicit set it as true will the cluster replacement happen.

Use Case

as above

Proposed Solution

I was thinking maybe we can have a removalPolicy prop of the cluster which default to RETAIN and the cluster replacement would only happen when the value is DESTROY

Another option is to have a replaceOnUpdate or allowReplaceOnUpdate prop for eks.Cluster which defaults to false.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

all

Environment details (OS name and version, etc.)

all

@pahud pahud added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 8, 2024
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label May 8, 2024
@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 8, 2024
@pahud pahud self-assigned this May 8, 2024
@pahud pahud changed the title eks: ack prop for cluster replacement eks: ack prop for potential cluster replacement May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

No branches or pull requests

1 participant