From e1162c7cfa6ba7b541aee34e1b3cc061215723a5 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Thu, 18 Jul 2019 06:40:39 -0700 Subject: [PATCH] Update agent to notify systemd --- pkg/cli/agent/agent.go | 5 +++-- pkg/cli/server/server.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cli/agent/agent.go b/pkg/cli/agent/agent.go index b8896509be..7afe5ec996 100644 --- a/pkg/cli/agent/agent.go +++ b/pkg/cli/agent/agent.go @@ -8,12 +8,12 @@ import ( "strings" "time" - "github.com/rancher/wrangler/pkg/signals" - + systemd "github.com/coreos/go-systemd/daemon" "github.com/rancher/k3s/pkg/agent" "github.com/rancher/k3s/pkg/cli/cmds" "github.com/rancher/k3s/pkg/datadir" "github.com/rancher/k3s/pkg/netutil" + "github.com/rancher/wrangler/pkg/signals" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -74,6 +74,7 @@ func Run(ctx *cli.Context) error { cfg.Labels = append(cfg.Labels, "node-role.kubernetes.io/worker=true") contextCtx := signals.SetupSignalHandler(context.Background()) + systemd.SdNotify(true, "READY=1\n") return agent.Run(contextCtx, cfg) } diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index af24088a40..ac8c05f9d9 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -194,7 +194,7 @@ func run(app *cli.Context, cfg *cmds.Server) error { logrus.Info("k3s is up and running") if notifySocket != "" { os.Setenv("NOTIFY_SOCKET", notifySocket) - systemd.SdNotify(true, "READY=1") + systemd.SdNotify(true, "READY=1\n") } if cfg.DisableAgent {