fix: don't skip lb attachments when hybrid is enabled

This commit is contained in:
liranp 2021-03-01 13:45:39 +02:00
parent 9d8dec60d6
commit 2abdb90c54
No known key found for this signature in database
GPG Key ID: D5F03857002C1A93
1 changed files with 5 additions and 4 deletions

View File

@ -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"))