Commit 32b02d1b authored by Brian Downs's avatar Brian Downs

Send systemd notifications for both server and agent (#3430)

* update agent to sent systemd notify after everything starts Signed-off-by: 's avatarBrian Downs <brian.downs@gmail.com>
parent c012e6ec
......@@ -115,6 +115,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return err
}
}
notifySocket := os.Getenv("NOTIFY_SOCKET")
os.Unsetenv("NOTIFY_SOCKET")
if err := setupTunnelAndRunAgent(ctx, nodeConfig, cfg, proxy); err != nil {
return err
}
......@@ -142,6 +146,9 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
}
}
os.Setenv("NOTIFY_SOCKET", notifySocket)
systemd.SdNotify(true, "READY=1\n")
<-ctx.Done()
return ctx.Err()
}
......@@ -233,7 +240,7 @@ func Run(ctx context.Context, cfg cmds.Agent) error {
cfg.Token = newToken.String()
break
}
systemd.SdNotify(true, "READY=1\n")
return run(ctx, cfg, proxy)
}
......
......@@ -358,8 +358,6 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
}
logrus.Info("Starting " + version.Program + " " + app.App.Version)
notifySocket := os.Getenv("NOTIFY_SOCKET")
os.Unsetenv("NOTIFY_SOCKET")
ctx := signals.SetupSignalHandler(context.Background())
......@@ -375,9 +373,9 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
<-serverConfig.ControlConfig.Runtime.ETCDReady
logrus.Info("ETCD server is now running")
}
logrus.Info(version.Program + " is up and running")
if notifySocket != "" {
os.Setenv("NOTIFY_SOCKET", notifySocket)
if cfg.DisableAgent && os.Getenv("NOTIFY_SOCKET") != "" {
systemd.SdNotify(true, "READY=1\n")
}
}()
......
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