From 2abdb90c54e533b798431372a1bfba0354bee3ff Mon Sep 17 00:00:00 2001 From: liranp Date: Mon, 1 Mar 2021 13:45:39 +0200 Subject: [PATCH] fix: don't skip lb attachments when hybrid is enabled --- pkg/model/awsmodel/autoscalinggroup.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/model/awsmodel/autoscalinggroup.go b/pkg/model/awsmodel/autoscalinggroup.go index aa7b62c439..8164531cd4 100644 --- a/pkg/model/awsmodel/autoscalinggroup.go +++ b/pkg/model/awsmodel/autoscalinggroup.go @@ -428,10 +428,11 @@ func (b *AutoscalingGroupModelBuilder) buildAutoScalingGroupTask(c *fi.ModelBuil t.LoadBalancers = []*awstasks.ClassicLoadBalancer{} t.TargetGroups = []*awstasks.TargetGroup{} - // When Spotinst Elastigroups are used, there is no need to create - // a separate task for the attachment of the load balancer since this - // is already done as part of the Elastigroup's creation, if needed. - if !featureflag.Spotinst.Enabled() { + // Spotinst handles load balancer attachments internally, so there's no + // need to create separate attachments for both managed (+Spotinst) and + // hybrid (+SpotinstHybrid) instance groups. + if !featureflag.Spotinst.Enabled() || + (featureflag.SpotinstHybrid.Enabled() && !spotinstmodel.HybridInstanceGroup(ig)) { if b.UseLoadBalancerForAPI() && ig.Spec.Role == kops.InstanceGroupRoleMaster { if b.UseNetworkLoadBalancer() { t.TargetGroups = append(t.TargetGroups, b.LinkToTargetGroup("tcp"))