Hetzner: search for not_found code explicitly before returning ErrInstanceNotFound #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a hetzner cloud instance is deleted externally (not by the autoscaler, for example via GUI/API) the autoscaler fails to correctly remove the instance. This is due to the fact that it does not return ErrInstanceNotFound but a generic one.
Example log:
As you can see the hetzner responsed with code=not_found but the implementation returns a generic error as indicated by the log message "cannot destroy server" (reaper.go#107)
Instead of relying on the generic error response here which seems to have changed it will now check for the string not_found in the hetzner api response and if found return ErrInstanceNotFound allowing the instance to be deleted from the autoscaler.