diff --git a/cloud/linode/loadbalancers.go b/cloud/linode/loadbalancers.go index 673f27c9..4ff829c7 100644 --- a/cloud/linode/loadbalancers.go +++ b/cloud/linode/loadbalancers.go @@ -208,6 +208,10 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri // check for existing CiliumLoadBalancerIPPool for service pool, err := l.getCiliumLBIPPool(ctx, service) + if err != nil && !k8serrors.IsNotFound(err) { + klog.Infof("Failed to get CiliumLoadBalancerIPPool: %s", err.Error()) + return nil, err + } // if the CiliumLoadBalancerIPPool doesn't exist, it's not nil, instead an empty struct // gets returned, so we check if this is so via the Name being empty if pool != nil && pool.Name != "" { @@ -217,10 +221,6 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri Ingress: service.Status.LoadBalancer.Ingress, }, nil } - if err != nil && !k8serrors.IsNotFound(err) { - klog.Infof("Failed to get CiliumLoadBalancerIPPool: %s", err.Error()) - return nil, err - } // CiliumLoadBalancerIPPool does not yet exist for the service var sharedIP string