Skip to content

Commit 5b3e6ab

Browse files
committed
Support sharing one IP address for multiple services
1 parent 6958db6 commit 5b3e6ab

File tree

3 files changed

+610
-56
lines changed

3 files changed

+610
-56
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_backoff.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242

4343
// operationCanceledErrorMessage means the operation is canceled by another new operation.
4444
operationCanceledErrorMessage = "canceledandsupersededduetoanotheroperation"
45+
46+
cannotDeletePublicIPErrorMessageCode = "PublicIPAddressCannotBeDeleted"
4547
)
4648

4749
// RequestBackoff if backoff is disabled in cloud provider it
@@ -275,6 +277,11 @@ func (az *Cloud) DeletePublicIP(service *v1.Service, pipResourceGroup string, pi
275277
if rerr != nil {
276278
klog.Errorf("PublicIPAddressesClient.Delete(%s) failed: %s", pipName, rerr.Error().Error())
277279
az.Event(service, v1.EventTypeWarning, "DeletePublicIPAddress", rerr.Error().Error())
280+
281+
if strings.Contains(rerr.Error().Error(), cannotDeletePublicIPErrorMessageCode) {
282+
klog.Warningf("DeletePublicIP for public IP %s failed with error %v, this is because other resources are referencing the public IP. The deletion of the service will continue.", pipName, rerr.Error())
283+
return nil
284+
}
278285
return rerr.Error()
279286
}
280287

0 commit comments

Comments
 (0)