Skip to content

Commit 79e1297

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#61531 from feiskyer/delete-node
Automatic merge from submit-queue (batch tested with PRs 61434, 61501, 59609, 61467, 61531). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Ensure cloudprovider.InstanceNotFound is reported when the VM is not found on Azure **What this PR does / why we need it**: Azure ExponentialBackoff will still try to get VM information even when the VM has already been removed on Azure: https://github.com/kubernetes/kubernetes/blob/1365ce341924fb705d25704d4802f8aec5582b38/pkg/cloudprovider/providers/azure/azure_backoff.go#L52-L60 It should report `cloudprovider.InstanceNotFound` early and avoid calling Azure APIs on such case. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes kubernetes#61465 **Special notes for your reviewer**: Should be cherry-picked to v1.9 **Release note**: ```release-note Ensure cloudprovider.InstanceNotFound is reported when the VM is not found on Azure ```
2 parents 408588a + bace006 commit 79e1297

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/cloudprovider/providers/azure/azure_backoff.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
"k8s.io/apimachinery/pkg/types"
3030
"k8s.io/apimachinery/pkg/util/wait"
31+
"k8s.io/kubernetes/pkg/cloudprovider"
3132
)
3233

3334
// requestBackoff if backoff is disabled in cloud provider it
@@ -51,6 +52,9 @@ func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName) (compute.Virtua
5152
var retryErr error
5253
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
5354
machine, retryErr = az.getVirtualMachine(name)
55+
if retryErr == cloudprovider.InstanceNotFound {
56+
return true, cloudprovider.InstanceNotFound
57+
}
5458
if retryErr != nil {
5559
glog.Errorf("backoff: failure, will retry,err=%v", retryErr)
5660
return false, nil

pkg/cloudprovider/providers/azure/azure_standard.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error)
366366
var err error
367367

368368
machine, err = as.getVirtualMachine(types.NodeName(name))
369+
if err == cloudprovider.InstanceNotFound {
370+
return "", cloudprovider.InstanceNotFound
371+
}
369372
if err != nil {
370373
if as.CloudProviderBackoff {
371374
glog.V(2).Infof("InstanceID(%s) backing off", name)

0 commit comments

Comments
 (0)