Make systemd notify optional in generic api server

To properly notify systemd that the k3s server is ready we need to
prevent the current k8s notification and add one to the k3s cli.
k3s-v1.13.3
Erik Wilson 2019-02-26 22:26:43 -07:00 committed by Darren Shepherd
parent e61796120f
commit 96a2a74e26
1 changed files with 11 additions and 5 deletions

View File

@ -44,6 +44,10 @@ import (
restclient "k8s.io/client-go/rest"
)
var (
NotifySystemD = true
)
// Info about an API group.
type APIGroupInfo struct {
PrioritizedVersions []schema.GroupVersion
@ -292,9 +296,11 @@ func (s preparedGenericAPIServer) NonBlockingRun(stopCh <-chan struct{}) error {
s.RunPostStartHooks(stopCh)
if NotifySystemD {
if _, err := systemd.SdNotify(true, "READY=1\n"); err != nil {
klog.Errorf("Unable to send systemd daemon successful start message: %v\n", err)
}
}
return nil
}