-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Prevent unintended resource updates to LB attatchments #9794
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rdrgmnzs 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 |
If someone has other attachment resources in their terraform state, this change would conflict. We may need to expose a way to provide additional ELB names or TG ARNs to be included in these lists. |
@rifelpet not sure I follow. Isn't the external LB resource in Kops providing a way to attach other LB resources already? From what I understand the changes above don't prevent other LBs from being attached with |
Ah I forgot that InstanceGroupSpec already has an ExternalLoadBalancers field. That note in the terraform docs suggests you should use either separate attachment resources or the field in the ASG resource but not both (hence the need to use ignore_changes). The externallb integration test has the |
Ah, see I was reading that note in the docs as you could use That's sort of how I ended up here, while using Either way, moving ExternalLoadBalancers to be inline load_balancers as well seems to be an easy enough change so let me update the diff to take care of that. |
73c242e
to
caefd40
Compare
caefd40
to
1a9f448
Compare
type TargetGroup struct { | ||
Name *string | ||
Lifecycle *fi.Lifecycle | ||
|
||
// ARN is the Amazon Resource Name for the Target Group | ||
ARN *string | ||
|
||
// Shared is set if this is an external LB (one we don't create or own) | ||
Shared *bool | ||
} |
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.
I created the TargetGroup
struct mostly as a skeleton struct so that if someone decides to implement TargetGroup for uses in other places (such as API) they won't then have to figure out how to convert a list of string in AutoscalingGroup
to an actual struct.
9a4b518
to
36a435e
Compare
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.
We'll want a release note instructing anyone using terraform or cloudformation that is also defining LB attachments not using kops (in a separate .tf file in their terraform state, for example) to pass those TGs or ELBs through the ClusterSpec.
/test pull-kops-e2e-k8s-containerd |
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.
I'm wondering if the migration from aws_autoscaling_attachment to inline aws_autoscaling_group fields will be seamless or if there will be a period of time during the terraform apply
in which the ASG is not registered with the ELB / TG which would result in downtime for the service.
Terraform plan shows it as a NOOP using terraform 0.12.29 and I saw no downtime while testing. |
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.
lgtm other than one nit 👍
/hold |
@rdrgmnzs any update on this? looks like its becoming a pretty common issue for terraform users. |
Hey @rifelpet I’ve had this on hold because I found instances where the switch causes the API endpoint to have a downtime when migrating from the old format to the new one. Unfortunately I haven’t been able to find a way around that. What do you think about having a note in the release that indicates folks will most likely experience that when migrating? I’m also open to other suggestions on how to handle this. |
downtime could be problematic to anyone running a nodeport service and a load balancer defined through terraform. I wonder if we could use the Similar to the release notes we had for terraform 0.12 support in 1.17 and 1.18. |
I came across this issue whilst working on #9940 and I like this solution provided users are using Terraform 0.12+, so I'd suggest merging in Kops v1.20 when Terraform 0.11 is deprecated. |
@rdrgmnzs |
baa9a4d
to
9bd0a7a
Compare
/hold cancel Ok, added instructions on switching over without downtime & fixed nit. |
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.
two minor comments but overall lgtm!
/lgtm |
For Terraform when using
aws_autoscaling_attachment
a situation can happen where the LB is attached/detached from it's associated ASG (more details can be found on the Note section of https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_attachment ).This change should prevent this from happening. To simplify the code, I also moved cloudformantion and kops managed to the new attachment format.
Fixes #9891, fixes #9913