Skip to content

Commit

Permalink
Handle cluster cleanup more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Nov 12, 2020
1 parent c946f16 commit c8de1d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pkg/resources/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,13 @@ func DeleteVolume(cloud fi.Cloud, r *resources.Resource) error {
}
_, err := c.EC2().DeleteVolume(request)
if err != nil {
if IsDependencyViolation(err) {
return err
}
if awsup.AWSErrorCode(err) == "InvalidVolume.NotFound" {
// Concurrently deleted
klog.V(2).Infof("Got InvalidVolume.NotFound error deleting Volume %q; will treat as already-deleted", id)
return nil
}
if IsDependencyViolation(err) {
return err
}
return fmt.Errorf("error deleting Volume %q: %v", id, err)
}
return nil
Expand Down Expand Up @@ -1732,7 +1732,7 @@ func DeleteElasticIP(cloud fi.Cloud, t *resources.Resource) error {
_, err := c.EC2().ReleaseAddress(request)
if err != nil {
if awsup.AWSErrorCode(err) == "InvalidAllocationID.NotFound" {
klog.V(2).Infof("Got InvalidAllocationID.NotFound error describing ElasticIP %q; will treat as already-deleted", id)
klog.V(2).Infof("Got InvalidAllocationID.NotFound error deleting ElasticIP %q; will treat as already-deleted", id)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/aws/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func IsDependencyViolation(err error) bool {
switch code {
case "":
return false
case "DependencyViolation", "VolumeInUse", "InvalidIPAddress.InUse":
case "AuthFailure", "DependencyViolation", "InvalidIPAddress.InUse", "VolumeInUse", "ResourceInUse":
return true
default:
klog.Infof("unexpected aws error code: %q", code)
Expand Down

0 comments on commit c8de1d3

Please sign in to comment.