-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
operators: ignore node deletion errors on absence #3113
Conversation
✅ Deploy Preview for constellation-docs canceled.
|
func isInstanceNotFoundError(err error) bool { | ||
if err == nil { | ||
return false | ||
} | ||
return strings.Contains(err.Error(), "Instance Id not found") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func isInstanceNotFoundError(err error) bool { | |
if err == nil { | |
return false | |
} | |
return strings.Contains(err.Error(), "Instance Id not found") | |
} | |
func isInstanceNotFoundError(err error) bool { | |
var respErr *awshttp.ResponseError // using "awshttp" for package github.com/aws/aws-sdk-go-v2/aws/transport/http | |
return errors.As(err, &respErr) && respErr.HTTPStatusCode() == http.StatusNotFound | |
} | |
From https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md#error-handling
Did not tests this, but if it works it would be preferable over string comparisons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be preferable indeed, but AWS does not return 404s in that case, but 400s. I meant to also link to the logs but forgot - fixed that now (see above). I would not want to infer nonexistence from a 400, because that might hide other failure conditions, so I'm back at string comparison :/
<ErrorResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
<Error>
<Type>Sender</Type>
<Code>ValidationError</Code>
<Message>Instance Id not found - No managed instance found for instance ID: i-061c63c5eb45f0416</Message>
</Error>
<RequestId>702f44ea-6d55-480b-8dfa-3da9e62f1634</RequestId>
</ErrorResponse>
Coverage report
|
Context
If a node deletion operation fails transiently after the instance was deleted at the CSP, we need to ensure that the retry succeeds, even if the instance we attempt to delete is already gone at the CSP.
Example operator logs: https://gist.github.com/burgerdev/c80de86ae44552a383364ef031243a41
Proposed change(s)
SkipInstancesOnValidationError
, which is designed for this use case.Additional info
Checklist