supervisor: ensure graceful exit
The kubelet will send the SIGTERM signal when it wants a process to exit. After a grace period, it will send the SIGKILL signal to force the process to terminate. The concierge has always handled both SIGINT and SIGTERM as indicators for it to gracefully exit (i.e. stop watches, controllers, etc). This change updates the supervisor to do the same (previously it only handled SIGINT). This is required to allow the leader election lock release logic to run. Otherwise it can take a few minutes for new pods to acquire the lease since they believe it is already held. Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
parent
4eb500cc41
commit
5489f68e2f
@ -14,6 +14,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
@ -78,7 +79,7 @@ func start(ctx context.Context, l net.Listener, handler http.Handler) {
|
||||
|
||||
func waitForSignal() os.Signal {
|
||||
signalCh := make(chan os.Signal, 1)
|
||||
signal.Notify(signalCh, os.Interrupt)
|
||||
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM)
|
||||
return <-signalCh
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user