Skip to content

Commit 0700f9b

Browse files
committed
🐛: elbv2: fix checking for existing listeners
We were comparing pointers that were never going to be equal. Let's check their pointed-to values instead. Also added a break when the listener is found. Changed the `createdListeners` list to only include a listener if it was created. This list is currently not used for anything, so this change should have no impact.
1 parent be020fd commit 0700f9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cloud/services/elb/loadbalancer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,8 +1604,9 @@ func (s *Service) reconcileTargetGroupsAndListeners(lbARN string, spec *infrav1.
16041604

16051605
var listener *elbv2.Listener
16061606
for _, l := range existingListeners.Listeners {
1607-
if l.DefaultActions != nil && len(l.DefaultActions) > 0 && l.DefaultActions[0].TargetGroupArn == group.TargetGroupArn {
1607+
if l.DefaultActions != nil && len(l.DefaultActions) > 0 && *l.DefaultActions[0].TargetGroupArn == *group.TargetGroupArn {
16081608
listener = l
1609+
break
16091610
}
16101611
}
16111612

@@ -1614,9 +1615,8 @@ func (s *Service) reconcileTargetGroupsAndListeners(lbARN string, spec *infrav1.
16141615
if err != nil {
16151616
return nil, nil, err
16161617
}
1618+
createdListeners = append(createdListeners, listener)
16171619
}
1618-
1619-
createdListeners = append(createdListeners, listener)
16201620
}
16211621

16221622
return createdTargetGroups, createdListeners, nil

0 commit comments

Comments
 (0)