mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #69454 from zetaab/fix_aws_node_delete
delete node from aws if it is terminated
This commit is contained in:
commit
3d4cc707a2
@ -1386,7 +1386,9 @@ func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID str
|
||||
}
|
||||
if len(instances) == 0 {
|
||||
glog.Warningf("the instance %s does not exist anymore", providerID)
|
||||
return true, nil
|
||||
// returns false, because otherwise node is not deleted from cluster
|
||||
// false means that it will continue to check InstanceExistsByProviderID
|
||||
return false, nil
|
||||
}
|
||||
if len(instances) > 1 {
|
||||
return false, fmt.Errorf("multiple instances found for instance: %s", instanceID)
|
||||
@ -1396,7 +1398,7 @@ func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID str
|
||||
if instance.State != nil {
|
||||
state := aws.StringValue(instance.State.Name)
|
||||
// valid state for detaching volumes
|
||||
if state == ec2.InstanceStateNameStopped || state == ec2.InstanceStateNameTerminated {
|
||||
if state == ec2.InstanceStateNameStopped {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user