-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Don't allow ebs volume TF resource names to begin with digit #10424
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rifelpet The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I don't have a strong preference about this issue or which fix to merge. |
Have we come up with instructions for how to rename an existing cluster's members without disruption? |
Not that I know of. |
I believe that renaming the members in the ClusterSpec would result in the terraform resource names changing, so users would need to |
I agree, but at least they would read the release notes first. |
0c17d05
to
94ea0fd
Compare
We know that simply renaming the etcd members in the ClusterSpec is disruptive to the etcd cluster. Therefore I don't think we can recommend that as a solution in the release notes (along with a I just added text to the top of the release notes to make it more apparent. I likely won't have the opportunity to experiment with etcd member renaming before we want 1.19.0 released so if anyone else wants to give it a shot and try to come up with a graceful renaming strategy, it would be much appreciated. |
I think setting terraform's prevent_destroy on the ebs volumes might help here. https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#prevent_destroy We'll have to see if it works with only the new version of the resource having it set rather than the old version of the resource having it set. We'll need to also consider any workflows that might break by having this set. |
I did check whether
|
So I was thinking about our options here @rifelpet and @hakman. So I think we could do both PRs...
What we'll end up with is no changes for unaffected users, and users that would be affected are unaffected for new clusters. Existing affected clusters will experience a message saying "you must rename using If we agree on this course, I can merge both PRs and then tweak this one to only do the prefixing when an env var is set. |
I think the environment variable approach sounds good, yes. I left a comment in the related GH issue asking for feedback so hopefully we hear from others. I do worry about whether we have other resources that are susceptible to this problem and whether we'd want to "scope" the variable to just the ebs volumes, perhaps require I also wonder if we can prevent this for any new resource types down the road by adding conditional prefixing to the terraform target code. This is a bit tangential, but I know we've discussed requiring single minor version upgrades for kops in the past and this is one situation that would be easier if we had that requirement. We could add the env var check in kops 1.19 and remove it in 1.20 since we'd know that any clusters being upgraded to kops 1.20 will have been updated by kops 1.19 previously. |
First of all I am ok with merging my PR 😀. Adding the |
I saw that - thanks!
I think that's a good idea / point: in theory this could be happening to other resources and we just don't know about it because it's so rare. That said, I think EBS volumes are the one for which this really matters (because stateful) so I think we can probably just scope the env var to EBS volumes (at least for now), and we can likely add the prefix to all other tf resources automatically. I can play with this in more detail on the "third PR" after we merge this one and #10361 (or if you want to experiment, feel free :-) )
Good point. I have to admit that I'm less bothered by a few extra lines of code here and there than many others are :-) If we do something like this, it would be nice to guide the user to avoid mistakes... we do have the logic around |
I'm fine with not requiring the env var be scoped to EBS volumes somehow. As mentioned, they're the most critical terraform resource because they're stateful. I agree we should merge both PRs and open a third PR with the env var requirement. |
/lgtm |
…-upstream-release-1.18 Automated cherry pick of #10424: Don't allow ebs volume TF resource names to begin with digit
…-upstream-release-1.19 Automated cherry pick of #10424: Don't allow ebs volume TF resource names to begin with digit
Fixes #9982
This will fix the issue for both new and existing clusters and only the clusters that are directly impacted by the bug. We could theoretically merge this as well as #10361.
My main concern with this approach is if users don't
terraform state mv
on existing clusters and Terraform deletes and recreates the EBS volumes; their entire etcd state will be lost. We can try to make the release note more prominent but I'm open to other ideas on how to try to prevent people from making that mistake.