@@ -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.
6061const 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