From ce3644ca593db0d8f87babfc29804add1c9f05dc Mon Sep 17 00:00:00 2001 From: Dayang Shen Date: Tue, 10 Mar 2020 19:11:42 +0800 Subject: [PATCH] Fix VMSS cache content Using reference to a loop iterator variable is common mistake because it takes different values in each loop iteration. --- .../k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go index e6a028ab9b3..5a820e4bf19 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go +++ b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go @@ -73,7 +73,8 @@ func (ss *scaleSet) newVMSSCache() (*azcache.TimedCache, error) { return nil, rerr.Error() } - for _, scaleSet := range allScaleSets { + for i := range allScaleSets { + scaleSet := allScaleSets[i] if scaleSet.Name == nil || *scaleSet.Name == "" { klog.Warning("failed to get the name of VMSS") continue