Skip to content

Commit f72b283

Browse files
l-technicoreYashwantGohokar
authored andcommitted
Do not record events for failure to acquire lock for lb sync
1 parent d05e0c6 commit f72b283

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/cloudprovider/providers/oci/load_balancer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ const (
5252
NetworkLoadBalancingPolicyTwoTuple = "TWO_TUPLE"
5353
NetworkLoadBalancingPolicyThreeTuple = "THREE_TUPLE"
5454
NetworkLoadBalancingPolicyFiveTuple = "FIVE_TUPLE"
55-
LbOperationAlreadyExistsFmt = "An operation for the %s: %s already exists."
5655
)
5756

57+
var LbOperationAlreadyExists = errors.New("An operation for the service is already in progress.")
58+
5859
// DefaultLoadBalancerBEProtocol defines the default protocol for load
5960
// balancer listeners created by the CCM.
6061
const DefaultLoadBalancerBEProtocol = "TCP"
@@ -491,7 +492,7 @@ func (cp *CloudProvider) EnsureLoadBalancer(ctx context.Context, clusterName str
491492
loadBalancerService := fmt.Sprintf("%s/%s", service.Namespace, service.Name)
492493
if acquired := cp.lbLocks.TryAcquire(loadBalancerService); !acquired {
493494
logger.Error("Could not acquire lock for Ensuring Load Balancer")
494-
return nil, errors.Errorf(LbOperationAlreadyExistsFmt, loadBalancerType, loadBalancerService)
495+
return nil, LbOperationAlreadyExists
495496
}
496497
defer cp.lbLocks.Release(loadBalancerService)
497498

@@ -1149,7 +1150,7 @@ func (cp *CloudProvider) UpdateLoadBalancer(ctx context.Context, clusterName str
11491150
loadBalancerService := fmt.Sprintf("%s/%s", service.Namespace, service.Name)
11501151
if acquired := cp.lbLocks.TryAcquire(loadBalancerService); !acquired {
11511152
logger.Error("Could not acquire lock for Updating Load Balancer")
1152-
return errors.Errorf(LbOperationAlreadyExistsFmt, loadBalancerType, loadBalancerService)
1153+
return LbOperationAlreadyExists
11531154
}
11541155
defer cp.lbLocks.Release(loadBalancerService)
11551156

@@ -1316,7 +1317,7 @@ func (cp *CloudProvider) EnsureLoadBalancerDeleted(ctx context.Context, clusterN
13161317
loadBalancerService := fmt.Sprintf("%s/%s", service.Namespace, service.Name)
13171318
if acquired := cp.lbLocks.TryAcquire(loadBalancerService); !acquired {
13181319
logger.Error("Could not acquire lock for Deleting Load Balancer")
1319-
return errors.Errorf(LbOperationAlreadyExistsFmt, loadBalancerType, loadBalancerService)
1320+
return LbOperationAlreadyExists
13201321
}
13211322
defer cp.lbLocks.Release(loadBalancerService)
13221323

0 commit comments

Comments
 (0)