mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Merge pull request #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:
1365ce3419/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 #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
```
This commit is contained in:
commit
79e1297f9b
@ -28,6 +28,7 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||
)
|
||||
|
||||
// requestBackoff if backoff is disabled in cloud provider it
|
||||
@ -51,6 +52,9 @@ func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName) (compute.Virtua
|
||||
var retryErr error
|
||||
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
|
||||
machine, retryErr = az.getVirtualMachine(name)
|
||||
if retryErr == cloudprovider.InstanceNotFound {
|
||||
return true, cloudprovider.InstanceNotFound
|
||||
}
|
||||
if retryErr != nil {
|
||||
glog.Errorf("backoff: failure, will retry,err=%v", retryErr)
|
||||
return false, nil
|
||||
|
@ -366,6 +366,9 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error)
|
||||
var err error
|
||||
|
||||
machine, err = as.getVirtualMachine(types.NodeName(name))
|
||||
if err == cloudprovider.InstanceNotFound {
|
||||
return "", cloudprovider.InstanceNotFound
|
||||
}
|
||||
if err != nil {
|
||||
if as.CloudProviderBackoff {
|
||||
glog.V(2).Infof("InstanceID(%s) backing off", name)
|
||||
|
Loading…
Reference in New Issue
Block a user