mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #92257 from andyzhangx/deallocating
fix: Azure deallocating node should be regarded as shut down
This commit is contained in:
commit
e201c6b8df
@ -32,9 +32,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
vmPowerStatePrefix = "PowerState/"
|
||||
vmPowerStateStopped = "stopped"
|
||||
vmPowerStateDeallocated = "deallocated"
|
||||
vmPowerStatePrefix = "PowerState/"
|
||||
vmPowerStateStopped = "stopped"
|
||||
vmPowerStateDeallocated = "deallocated"
|
||||
vmPowerStateDeallocating = "deallocating"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -230,7 +231,8 @@ func (az *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID st
|
||||
}
|
||||
klog.V(5).Infof("InstanceShutdownByProviderID gets power status %q for node %q", powerStatus, nodeName)
|
||||
|
||||
return strings.ToLower(powerStatus) == vmPowerStateStopped || strings.ToLower(powerStatus) == vmPowerStateDeallocated, nil
|
||||
status := strings.ToLower(powerStatus)
|
||||
return status == vmPowerStateStopped || status == vmPowerStateDeallocated || status == vmPowerStateDeallocating, nil
|
||||
}
|
||||
|
||||
// InstanceMetadataByProviderID returns metadata of the specified instance.
|
||||
|
@ -284,7 +284,7 @@ func TestInstanceShutdownByProviderID(t *testing.T) {
|
||||
vmList: map[string]string{"vm3": "PowerState/Deallocating"},
|
||||
nodeName: "vm3",
|
||||
providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm3",
|
||||
expected: false,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "InstanceShutdownByProviderID should return false if the vm is in PowerState/Starting status",
|
||||
|
Loading…
Reference in New Issue
Block a user