mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Send systemd notifications for both server and agent (#3430)
* update agent to sent systemd notify after everything starts
This commit is contained in:
parent
a7d1159ba6
commit
88f95ec409
@ -114,6 +114,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifySocket := os.Getenv("NOTIFY_SOCKET")
|
||||||
|
os.Unsetenv("NOTIFY_SOCKET")
|
||||||
|
|
||||||
if err := setupTunnelAndRunAgent(ctx, nodeConfig, cfg, proxy); err != nil {
|
if err := setupTunnelAndRunAgent(ctx, nodeConfig, cfg, proxy); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -141,6 +145,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()
|
<-ctx.Done()
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
@ -232,7 +239,7 @@ func Run(ctx context.Context, cfg cmds.Agent) error {
|
|||||||
cfg.Token = newToken.String()
|
cfg.Token = newToken.String()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
systemd.SdNotify(true, "READY=1\n")
|
|
||||||
return run(ctx, cfg, proxy)
|
return run(ctx, cfg, proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,8 +362,6 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
logrus.Info("Starting " + version.Program + " " + app.App.Version)
|
logrus.Info("Starting " + version.Program + " " + app.App.Version)
|
||||||
notifySocket := os.Getenv("NOTIFY_SOCKET")
|
|
||||||
os.Unsetenv("NOTIFY_SOCKET")
|
|
||||||
|
|
||||||
ctx := signals.SetupSignalHandler(context.Background())
|
ctx := signals.SetupSignalHandler(context.Background())
|
||||||
|
|
||||||
@ -379,9 +377,9 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
|||||||
<-serverConfig.ControlConfig.Runtime.ETCDReady
|
<-serverConfig.ControlConfig.Runtime.ETCDReady
|
||||||
logrus.Info("ETCD server is now running")
|
logrus.Info("ETCD server is now running")
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Info(version.Program + " is up and running")
|
logrus.Info(version.Program + " is up and running")
|
||||||
if notifySocket != "" {
|
if cfg.DisableAgent && os.Getenv("NOTIFY_SOCKET") != "" {
|
||||||
os.Setenv("NOTIFY_SOCKET", notifySocket)
|
|
||||||
systemd.SdNotify(true, "READY=1\n")
|
systemd.SdNotify(true, "READY=1\n")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user