Skip to content

Commit 4bbf096

Browse files
committed
try to get nodebalancers by IP before hostname
1 parent 262d789 commit 4bbf096

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cloud/linode/loadbalancers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ func (l *loadbalancers) getLatestServiceLoadBalancerStatus(ctx context.Context,
124124
// most recent LoadBalancer status.
125125
func (l *loadbalancers) getNodeBalancerByStatus(ctx context.Context, service *v1.Service) (nb *linodego.NodeBalancer, err error) {
126126
for _, ingress := range service.Status.LoadBalancer.Ingress {
127-
if ingress.Hostname != "" {
128-
return l.getNodeBalancerByHostname(ctx, service, ingress.Hostname)
129-
}
130127
if ingress.IP != "" {
131128
return l.getNodeBalancerByIPv4(ctx, service, ingress.IP)
132129
}
130+
if ingress.Hostname != "" {
131+
return l.getNodeBalancerByHostname(ctx, service, ingress.Hostname)
132+
}
133133
}
134134
return nil, lbNotFoundError{serviceNn: getServiceNn(service)}
135135
}

0 commit comments

Comments
 (0)