@@ -52,9 +52,10 @@ const (
52
52
NetworkLoadBalancingPolicyTwoTuple = "TWO_TUPLE"
53
53
NetworkLoadBalancingPolicyThreeTuple = "THREE_TUPLE"
54
54
NetworkLoadBalancingPolicyFiveTuple = "FIVE_TUPLE"
55
- LbOperationAlreadyExistsFmt = "An operation for the %s: %s already exists."
56
55
)
57
56
57
+ var LbOperationAlreadyExists = errors .New ("An operation for the service is already in progress." )
58
+
58
59
// DefaultLoadBalancerBEProtocol defines the default protocol for load
59
60
// balancer listeners created by the CCM.
60
61
const DefaultLoadBalancerBEProtocol = "TCP"
@@ -491,7 +492,7 @@ func (cp *CloudProvider) EnsureLoadBalancer(ctx context.Context, clusterName str
491
492
loadBalancerService := fmt .Sprintf ("%s/%s" , service .Namespace , service .Name )
492
493
if acquired := cp .lbLocks .TryAcquire (loadBalancerService ); ! acquired {
493
494
logger .Error ("Could not acquire lock for Ensuring Load Balancer" )
494
- return nil , errors . Errorf ( LbOperationAlreadyExistsFmt , loadBalancerType , loadBalancerService )
495
+ return nil , LbOperationAlreadyExists
495
496
}
496
497
defer cp .lbLocks .Release (loadBalancerService )
497
498
@@ -1149,7 +1150,7 @@ func (cp *CloudProvider) UpdateLoadBalancer(ctx context.Context, clusterName str
1149
1150
loadBalancerService := fmt .Sprintf ("%s/%s" , service .Namespace , service .Name )
1150
1151
if acquired := cp .lbLocks .TryAcquire (loadBalancerService ); ! acquired {
1151
1152
logger .Error ("Could not acquire lock for Updating Load Balancer" )
1152
- return errors . Errorf ( LbOperationAlreadyExistsFmt , loadBalancerType , loadBalancerService )
1153
+ return LbOperationAlreadyExists
1153
1154
}
1154
1155
defer cp .lbLocks .Release (loadBalancerService )
1155
1156
@@ -1316,7 +1317,7 @@ func (cp *CloudProvider) EnsureLoadBalancerDeleted(ctx context.Context, clusterN
1316
1317
loadBalancerService := fmt .Sprintf ("%s/%s" , service .Namespace , service .Name )
1317
1318
if acquired := cp .lbLocks .TryAcquire (loadBalancerService ); ! acquired {
1318
1319
logger .Error ("Could not acquire lock for Deleting Load Balancer" )
1319
- return errors . Errorf ( LbOperationAlreadyExistsFmt , loadBalancerType , loadBalancerService )
1320
+ return LbOperationAlreadyExists
1320
1321
}
1321
1322
defer cp .lbLocks .Release (loadBalancerService )
1322
1323
0 commit comments