From 9bd0a7aedb9018fc72a5d7b521fd95639c061038 Mon Sep 17 00:00:00 2001 From: Rodrigo Menezes Date: Mon, 26 Oct 2020 18:11:46 -0700 Subject: [PATCH] Add instruction for no downtime --- docs/releases/1.19-NOTES.md | 12 ++++++++++++ pkg/model/awsmodel/autoscalinggroup.go | 2 +- upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go | 12 ++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/releases/1.19-NOTES.md b/docs/releases/1.19-NOTES.md index 615f0f5282..c190c1b1a2 100644 --- a/docs/releases/1.19-NOTES.md +++ b/docs/releases/1.19-NOTES.md @@ -74,6 +74,18 @@ has been updated by a newer version of kops unless it is given the `--allow-kops * See note about [Openstack Cinder plugin](#openstack-cinder-plugin) above. +* Terraform users, in order to prevent downtime you will have to remove the state of the existing ELB attatchments from your terraform state file. This is due to us migrating to setting the loadbalancer attatchment when defining the ASG resource. The migration was required due to a bug described in #9913. + +To prevent downtime, follow these steps with the new version of Kops: + ``` + kops update cluster --target terraform ... + terraform plan + terraform state list | grep aws_autoscaling_attachment | xargs -L1 terraform state rm + terraform plan + # Ensure these resources are no longer being destroyed and recreated + terraform apply + ``` + * If you are using Terraform with an additional .tf file and using "aws_autoscaling_attachment" to attach additional Load Balancers or ALB/NLB Target Groups you'll need to migrate to [attaching them through the InstanceGroup spec instead](https://kops.sigs.k8s.io/instance_groups/#externalloadbalancers). # Deprecations diff --git a/pkg/model/awsmodel/autoscalinggroup.go b/pkg/model/awsmodel/autoscalinggroup.go index 1ab33a4fe1..a097de1368 100644 --- a/pkg/model/awsmodel/autoscalinggroup.go +++ b/pkg/model/awsmodel/autoscalinggroup.go @@ -372,7 +372,7 @@ func (b *AutoscalingGroupModelBuilder) buildAutoScalingGroupTask(c *fi.ModelBuil } if extLB.TargetGroupARN != nil { - t.TargetGroupARNs = append(t.TargetGroupARNs, &awstasks.TargetGroup{Name: extLB.TargetGroupARN, ARN: extLB.TargetGroupARN}) + t.TargetGroups = append(t.TargetGroups, &awstasks.TargetGroup{Name: extLB.TargetGroupARN, ARN: extLB.TargetGroupARN}) } } diff --git a/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go b/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go index 8405868fa6..ffadebd7cf 100644 --- a/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go +++ b/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go @@ -87,8 +87,8 @@ type AutoscalingGroup struct { SuspendProcesses *[]string // Tags is a collection of keypairs to apply to the node on launch Tags map[string]string - // TargetGroupARNs is a list of ALB/NLB target group ARNs to add to the autoscaling group - TargetGroupARNs []*TargetGroup + // TargetGroups is a list of ALB/NLB target group ARNs to add to the autoscaling group + TargetGroups []*TargetGroup } var _ fi.CompareWithID = &AutoscalingGroup{} @@ -121,7 +121,7 @@ func (e *AutoscalingGroup) Find(c *fi.Context) (*AutoscalingGroup, error) { } for _, tg := range g.TargetGroupARNs { - actual.TargetGroupARNs = append(actual.TargetGroupARNs, &TargetGroup{ARN: aws.String(*tg)}) + actual.TargetGroups = append(actual.TargetGroups, &TargetGroup{ARN: aws.String(*tg)}) } if g.VPCZoneIdentifier != nil { @@ -280,7 +280,7 @@ func (v *AutoscalingGroup) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *Autos request.LoadBalancerNames = append(request.LoadBalancerNames, k.GetName()) } - for _, tg := range e.TargetGroupARNs { + for _, tg := range e.TargetGroups { request.TargetGroupARNs = append(request.TargetGroupARNs, tg.ARN) } @@ -787,7 +787,7 @@ func (_ *AutoscalingGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, c } terraform.SortLiterals(tf.LoadBalancers) - for _, tg := range e.TargetGroupARNs { + for _, tg := range e.TargetGroups { tf.TargetGroupARNs = append(tf.TargetGroupARNs, tg.TerraformLink()) } terraform.SortLiterals(tf.TargetGroupARNs) @@ -1023,7 +1023,7 @@ func (_ *AutoscalingGroup) RenderCloudformation(t *cloudformation.Cloudformation cf.LoadBalancerNames = append(cf.LoadBalancerNames, k.CloudformationLink()) } - for _, tg := range e.TargetGroupARNs { + for _, tg := range e.TargetGroups { cf.TargetGroupARNs = append(cf.TargetGroupARNs, tg.CloudformationLink()) }