Return nil as error when instance is not found so that node_controller could delete the node

This commit is contained in:
lubronzhan 2020-06-29 23:33:39 +08:00
parent 3a9b6bd50a
commit 1ebea3ad9d

View File

@ -756,11 +756,14 @@ func (vs *VSphere) InstanceExistsByProviderID(ctx context.Context, providerID st
return false, err
}
_, err = vs.InstanceID(ctx, convertToK8sType(nodeName))
if err == nil {
return true, nil
if err != nil {
if err == cloudprovider.InstanceNotFound {
return false, nil
}
return false, err
}
return false, err
return true, nil
}
// InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes