From 5ff99a2a58e9e71c73751ad0bd08fd483099d236 Mon Sep 17 00:00:00 2001 From: Jesse Haka Date: Fri, 5 Oct 2018 09:54:57 +0300 Subject: [PATCH] delete node from aws if it is terminated fix comment --- pkg/cloudprovider/providers/aws/aws.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index b3877f052bc..41d80a61180 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -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 } }