-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
✨ add health check for webhook server #1588
✨ add health check for webhook server #1588
Conversation
Signed-off-by: Stefan Büringer buringerst@vmware.com
e8eca3c
to
8b8d524
Compare
I implemented it this way as it's the easiest implementation and there didn't seem to be major concerns in #1124 (which has a similar implementation) My biggest concern is that the |
@@ -280,6 +288,19 @@ func (s *Server) Start(ctx context.Context) error { | |||
return nil | |||
} | |||
|
|||
// StartedChecker returns an healthz.Checker which is healthy after the | |||
// server has been started. | |||
func (s *Server) StartedChecker() healthz.Checker { |
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.
I can also move this func into the healthz package. The consequence would be that either the healthz package has a dependency to the webhook package or I would have to add an interface with a Started() bool
func.
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.
Could we maybe also tcp ping the server?
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.
Yup definitely. Should we then still keep the started flag?
Or is the idea to combine that, so we only start pinging after started is true?
I'm not sure if it's worth it keeping the started field around.
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.
It can make sense to only start tcp-pinging the port only after the started field is set to true
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.
Yup, will do.
I'll squash before merge. |
return fmt.Errorf("webhook server has not been started yet") | ||
} | ||
|
||
conn, err := net.DialTimeout("tcp", net.JoinHostPort(s.Host, strconv.Itoa(s.Port)), 10*time.Second) |
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.
10 seconds is just a wild guess. Not sure after which threshold we want to declare the webhook server not ready (and how long we want to block the client in case it has a higher timeout)
@cndoit18: changing LGTM is restricted to collaborators In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @joelanford |
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cndoit18, sbueringer, vincepri 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 |
Signed-off-by: Stefan Büringer buringerst@vmware.com
Fixes #723
Supersedes #1124