Merge pull request #10319 from hwoarang/tolerate-missing-detached-ec2

Tolerate missing detached EC2 instances
This commit is contained in:
Kubernetes Prow Robot 2020-11-26 10:40:19 -08:00 committed by GitHub
commit ead7143a79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -485,7 +485,11 @@ func deleteInstance(c AWSCloud, i *cloudinstances.CloudInstance) error {
}
if _, err := c.EC2().TerminateInstances(request); err != nil {
return fmt.Errorf("error deleting instance %q: %v", id, err)
if AWSErrorCode(err) == "InvalidInstanceID.NotFound" {
klog.V(2).Infof("Got InvalidInstanceID.NotFound error deleting instance %q; will treat as already-deleted", id)
} else {
return fmt.Errorf("error deleting instance %q: %v", id, err)
}
}
klog.V(8).Infof("deleted aws ec2 instance %q", id)