Skip to content

Commit

Permalink
move LBPool error check up
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine committed May 23, 2024
1 parent 008b934 commit 09fe14b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cloud/linode/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand All @@ -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
Expand Down

0 comments on commit 09fe14b

Please sign in to comment.