From 74db96c69132c77e5067d7d617efd1a8b28af281 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Thu, 23 May 2024 10:26:44 -0400 Subject: [PATCH] move LBPool error check up --- cloud/linode/loadbalancers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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