From 27bbe9a2b018841dc5990eae7766fc4a64c94c38 Mon Sep 17 00:00:00 2001 From: knight42 Date: Fri, 28 Aug 2020 19:17:00 +0800 Subject: [PATCH] fix(azure): check error returned by scaleSet.getVMSS Signed-off-by: knight42 --- .../src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go index c1ce257c5d3..34848babce3 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go +++ b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss.go @@ -1406,6 +1406,9 @@ func (ss *scaleSet) ensureBackendPoolDeletedFromVMSS(service *v1.Service, backen for vmssName := range vmssNamesMap { vmss, err := ss.getVMSS(vmssName, azcache.CacheReadTypeDefault) + if err != nil { + return err + } // When vmss is being deleted, CreateOrUpdate API would report "the vmss is being deleted" error. // Since it is being deleted, we shouldn't send more CreateOrUpdate requests for it. @@ -1413,10 +1416,6 @@ func (ss *scaleSet) ensureBackendPoolDeletedFromVMSS(service *v1.Service, backen klog.V(3).Infof("ensureVMSSInPool: found vmss %s being deleted, skipping", vmssName) continue } - - if err != nil { - return err - } if vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == nil { klog.V(4).Infof("EnsureHostInPool: cannot obtain the primary network interface configuration, of vmss %s", vmssName) continue