Skip to content

Commit 24cfb41

Browse files
authored
Merge pull request kubernetes#94991 from nilo19/feature/support-shared-pip
Azure: Support multiple services sharing one IP address
2 parents b2730aa + 5b3e6ab commit 24cfb41

File tree

6 files changed

+1248
-90
lines changed

6 files changed

+1248
-90
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)