From 86dc79373be2053f351ba1a79a579af8d3e69be5 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Thu, 4 Jan 2018 14:19:03 +0800 Subject: [PATCH] Add workaround for removing VMSS reference from LB --- .../providers/azure/azure_util_vmss.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/cloudprovider/providers/azure/azure_util_vmss.go b/pkg/cloudprovider/providers/azure/azure_util_vmss.go index 2c8630c2c83..c9b827c308e 100644 --- a/pkg/cloudprovider/providers/azure/azure_util_vmss.go +++ b/pkg/cloudprovider/providers/azure/azure_util_vmss.go @@ -939,5 +939,24 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(poolID, vmSetName string) error { return err } + // Update virtualMachineScaleSet again. This is a workaround for removing VMSS reference from LB. + // TODO: remove this workaround when figuring out the root cause. + if len(newBackendPools) == 0 { + glog.V(3).Infof("VirtualMachineScaleSetsClient.CreateOrUpdate: scale set (%s) - updating second time", vmSetName) + ss.operationPollRateLimiter.Accept() + glog.V(10).Infof("VirtualMachineScaleSetsClient.CreateOrUpdate(%q): start", vmSetName) + respChan, errChan = ss.VirtualMachineScaleSetsClient.CreateOrUpdate(ss.ResourceGroup, vmSetName, virtualMachineScaleSet, nil) + resp = <-respChan + err = <-errChan + glog.V(10).Infof("VirtualMachineScaleSetsClient.CreateOrUpdate(%q): end", vmSetName) + if ss.CloudProviderBackoff && shouldRetryAPIRequest(resp.Response, err) { + glog.V(2).Infof("VirtualMachineScaleSetsClient.CreateOrUpdate: scale set (%s) - updating, err=%v", vmSetName, err) + retryErr := ss.createOrUpdateVMSSWithRetry(virtualMachineScaleSet) + if retryErr != nil { + glog.V(2).Infof("VirtualMachineScaleSetsClient.CreateOrUpdate abort backoff: scale set (%s) - updating", vmSetName) + } + } + } + return nil }