Merge pull request #69454 from zetaab/fix_aws_node_delete

delete node from aws if it is terminated
This commit is contained in:
k8s-ci-robot 2018-10-19 00:10:22 -07:00 committed by GitHub
commit 3d4cc707a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}