-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Watch Action instead of polling Server Status #4151
Watch Action instead of polling Server Status #4151
Conversation
We have recevied an issue from one of our customers that their autoscaler pod regularly crashes due to a nil pointer dereference panic. Analyzing the code we found out that the autoscaler polls the server status to find out if a server is running. The Hetzner Cloud Go client is implemented in such a way that it does not return an error if a resource could not be found. Instead it returns nil for the error and the resource. Ususally this is not an issue. However, in case the server creation fails the server gets deleted from Hetzner Cloud. This in turn leads to nil being returned and the abovementioned panic. The Hetzner Cloud API implements a concept called Actions. Whenever a long running process is triggered we return an object which can be used to get information about the progress of the task. The Action object reliably allows to detect if a server has been created and provides access to any error that may have occured. This commit replaces polling the server status with using the action object.
Welcome @fhofherr! |
Thanks @fhofherr . I've already built my custom CA image on top of this PR. It works perfectly and I no longer see crashing. |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fhofherr, LKaemmerling, mwielgus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
We have recevied an issue from one of our customers that their
autoscaler pod regularly crashes due to a nil pointer dereference panic.
Analyzing the code we found out that the autoscaler polls the server
status to find out if a server is running.
The Hetzner Cloud Go client is implemented in such a way that it does
not return an error if a resource could not be found. Instead it returns
nil for the error and the resource. Ususally this is not an issue.
However, in case the server creation fails the server gets deleted from
Hetzner Cloud. This in turn leads to nil being returned and the
abovementioned panic.
The Hetzner Cloud API implements a concept called Actions. Whenever a
long running process is triggered we return an object which can
be used to get information about the progress of the task. The Action
object reliably allows to detect if a server has been created and
provides access to any error that may have occured.
This commit replaces polling the server status with using the action
object.