Skip to content

Commit 3d4cc70

Browse files
authored
Merge pull request kubernetes#69454 from zetaab/fix_aws_node_delete
delete node from aws if it is terminated
2 parents 12f726c + 5ff99a2 commit 3d4cc70

File tree

1 file changed

+4
-2
lines changed
  • pkg/cloudprovider/providers/aws

1 file changed

+4
-2
lines changed

pkg/cloudprovider/providers/aws/aws.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,9 @@ func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID str
13861386
}
13871387
if len(instances) == 0 {
13881388
glog.Warningf("the instance %s does not exist anymore", providerID)
1389-
return true, nil
1389+
// returns false, because otherwise node is not deleted from cluster
1390+
// false means that it will continue to check InstanceExistsByProviderID
1391+
return false, nil
13901392
}
13911393
if len(instances) > 1 {
13921394
return false, fmt.Errorf("multiple instances found for instance: %s", instanceID)
@@ -1396,7 +1398,7 @@ func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID str
13961398
if instance.State != nil {
13971399
state := aws.StringValue(instance.State.Name)
13981400
// valid state for detaching volumes
1399-
if state == ec2.InstanceStateNameStopped || state == ec2.InstanceStateNameTerminated {
1401+
if state == ec2.InstanceStateNameStopped {
14001402
return true, nil
14011403
}
14021404
}

0 commit comments

Comments
 (0)