Skip to content

Commit 74db96c

Browse files
committed
move LBPool error check up
1 parent acebeba commit 74db96c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cloud/linode/loadbalancers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri
208208

209209
// check for existing CiliumLoadBalancerIPPool for service
210210
pool, err := l.getCiliumLBIPPool(ctx, service)
211+
if err != nil && !k8serrors.IsNotFound(err) {
212+
klog.Infof("Failed to get CiliumLoadBalancerIPPool: %s", err.Error())
213+
return nil, err
214+
}
211215
// if the CiliumLoadBalancerIPPool doesn't exist, it's not nil, instead an empty struct
212216
// gets returned, so we check if this is so via the Name being empty
213217
if pool != nil && pool.Name != "" {
@@ -217,10 +221,6 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri
217221
Ingress: service.Status.LoadBalancer.Ingress,
218222
}, nil
219223
}
220-
if err != nil && !k8serrors.IsNotFound(err) {
221-
klog.Infof("Failed to get CiliumLoadBalancerIPPool: %s", err.Error())
222-
return nil, err
223-
}
224224

225225
// CiliumLoadBalancerIPPool does not yet exist for the service
226226
var sharedIP string

0 commit comments

Comments
 (0)