@@ -202,7 +202,7 @@ func (az *Cloud) CreateOrUpdateSecurityGroup(service *v1.Service, sg network.Sec
202
202
}
203
203
204
204
// Invalidate the cache because another new operation has canceled the current request.
205
- if strings .Contains (strings .ToLower (err .Error ()), operationCancledErrorMessage ) {
205
+ if err != nil && strings .Contains (strings .ToLower (err .Error ()), operationCancledErrorMessage ) {
206
206
az .nsgCache .Delete (* sg .Name )
207
207
}
208
208
@@ -265,7 +265,7 @@ func (az *Cloud) CreateOrUpdateLB(service *v1.Service, lb network.LoadBalancer)
265
265
az .lbCache .Delete (* lb .Name )
266
266
}
267
267
// Invalidate the cache because another new operation has canceled the current request.
268
- if strings .Contains (strings .ToLower (err .Error ()), operationCancledErrorMessage ) {
268
+ if err != nil && strings .Contains (strings .ToLower (err .Error ()), operationCancledErrorMessage ) {
269
269
az .lbCache .Delete (* lb .Name )
270
270
}
271
271
return err
@@ -645,7 +645,7 @@ func (az *Cloud) UpdateVmssVMWithRetry(resourceGroupName string, VMScaleSetName
645
645
resp , err := az .VirtualMachineScaleSetVMsClient .Update (ctx , resourceGroupName , VMScaleSetName , instanceID , parameters , source )
646
646
klog .V (10 ).Infof ("UpdateVmssVMWithRetry: VirtualMachineScaleSetVMsClient.Update(%s,%s): end" , VMScaleSetName , instanceID )
647
647
648
- if strings .Contains (err .Error (), vmssVMNotActiveErrorMessage ) {
648
+ if err != nil && strings .Contains (err .Error (), vmssVMNotActiveErrorMessage ) {
649
649
// When instances are under deleting, updating API would report "not an active Virtual Machine Scale Set VM instanceId" error.
650
650
// Since they're under deleting, we shouldn't send more update requests for it.
651
651
klog .V (3 ).Infof ("UpdateVmssVMWithRetry: VirtualMachineScaleSetVMsClient.Update(%s,%s) gets error message %q, abort backoff because it's probably under deleting" , VMScaleSetName , instanceID , vmssVMNotActiveErrorMessage )
0 commit comments