Unverified Commit 61bdd852 authored by Erik Wilson's avatar Erik Wilson Committed by GitHub

Merge pull request #655 from erikwilson/agent-systemd-notify

Update agent to notify systemd
parents bb44211f e1162c7c
...@@ -8,12 +8,12 @@ import ( ...@@ -8,12 +8,12 @@ import (
"strings" "strings"
"time" "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/agent"
"github.com/rancher/k3s/pkg/cli/cmds" "github.com/rancher/k3s/pkg/cli/cmds"
"github.com/rancher/k3s/pkg/datadir" "github.com/rancher/k3s/pkg/datadir"
"github.com/rancher/k3s/pkg/netutil" "github.com/rancher/k3s/pkg/netutil"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
...@@ -74,6 +74,7 @@ func Run(ctx *cli.Context) error { ...@@ -74,6 +74,7 @@ func Run(ctx *cli.Context) error {
cfg.Labels = append(cfg.Labels, "node-role.kubernetes.io/worker=true") cfg.Labels = append(cfg.Labels, "node-role.kubernetes.io/worker=true")
contextCtx := signals.SetupSignalHandler(context.Background()) contextCtx := signals.SetupSignalHandler(context.Background())
systemd.SdNotify(true, "READY=1\n")
return agent.Run(contextCtx, cfg) return agent.Run(contextCtx, cfg)
} }
...@@ -194,7 +194,7 @@ func run(app *cli.Context, cfg *cmds.Server) error { ...@@ -194,7 +194,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
logrus.Info("k3s is up and running") logrus.Info("k3s is up and running")
if notifySocket != "" { if notifySocket != "" {
os.Setenv("NOTIFY_SOCKET", notifySocket) os.Setenv("NOTIFY_SOCKET", notifySocket)
systemd.SdNotify(true, "READY=1") systemd.SdNotify(true, "READY=1\n")
} }
if cfg.DisableAgent { if cfg.DisableAgent {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment