-
Notifications
You must be signed in to change notification settings - Fork 204
Graceful termination for server #794
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
base: master
Are you sure you want to change the base?
Graceful termination for server #794
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ipochi 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: Imran Pochi <imranpochi@microsoft.com>
c14cffa to
dedeefa
Compare
Signed-off-by: Imran Pochi <imranpochi@microsoft.com>
| EnableLeaseController: false, | ||
| LeaseNamespace: "kube-system", | ||
| LeaseLabel: "k8s-app=konnectivity-server", | ||
| GracefulShutdownTimeout: 15 * 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.
I like the feature but I think we need to be backward compatible. We should default to 0 which means shutdown immediately and is the current behavior.
|
|
||
| <-stopCh | ||
| klog.V(1).Infoln("Shutting down server.") | ||
| klog.V(1).Infoln("Received shutdown signal, initiating graceful shutdown.") |
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.
We should wrap most of this new code in a if graceful timeout != 0 block.
| // Wait for all servers to shutdown or timeout | ||
| shutdownComplete := make(chan struct{}) | ||
| go func() { | ||
| wg.Wait() |
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.
Do we know what happens if the other goroutined have completed before this Wait is called? My guess is that is will never trigger. I think it makes more sense to do the non-optional adds. Kick off this goroutines, then kick off the workers.
Currently, the server doesn't do graceful termination upon receiving kill signals. This PR proposes the fix to add a configurable graceful termination to the server.