Remove signal handler registration from pkg/kubelet

The goal of this change is to remove the registration of signal
handling from pkg/kubelet. We now pass in a stop channel.

If you register a signal handler in `main()` to aid in a controlled
and deliberate exit then the handler registered in `pkg/kubelet` often
wins and the process exits immediately. This means all other signal
handler registrations are currently racy if `DockerServer.Start()` is
directly or indirectly invoked.

This change also removes another signal handler registration from
`NewAPIServerCommand()`; a stop channel is now passed to this
function.
This commit is contained in:
Andrew McDermott
2018-05-15 13:29:05 +01:00
parent 972a74e238
commit 9cbd54018f
17 changed files with 72 additions and 42 deletions

View File

@@ -26,6 +26,7 @@ import (
"os"
"time"
"k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/util/logs"
"k8s.io/kubernetes/cmd/kubelet/app"
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
@@ -35,7 +36,7 @@ import (
func main() {
rand.Seed(time.Now().UTC().UnixNano())
command := app.NewKubeletCommand()
command := app.NewKubeletCommand(server.SetupSignalHandler())
logs.InitLogs()
defer logs.FlushLogs()