Enable systemd ready notification for k3s server

Disables k8s generic api server systemd ready notification and send
our own ready notification after server available and kubeconfig
available.
pull/49/head
Erik Wilson 2019-02-28 17:02:12 -07:00 committed by Darren Shepherd
parent d6c5f6b995
commit c73e9187bb
4 changed files with 7 additions and 0 deletions

View File

@ -199,6 +199,7 @@ Documentation=https://k3s.io
After=network.target
[Service]
Type=notify
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server

View File

@ -134,6 +134,7 @@ Documentation=https://k3s.io
After=network.target
[Service]
Type=notify
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server

View File

@ -4,6 +4,7 @@ Documentation=https://k3s.io
After=network.target
[Service]
Type=notify
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server

View File

@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
systemd "github.com/coreos/go-systemd/daemon"
"github.com/docker/docker/pkg/reexec"
"github.com/natefinch/lumberjack"
"github.com/rancher/k3s/pkg/agent"
@ -17,6 +18,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"k8s.io/apimachinery/pkg/util/net"
genericapiserver "k8s.io/apiserver/pkg/server"
_ "github.com/mattn/go-sqlite3" // ensure we have sqlite
)
@ -49,6 +51,7 @@ func runWithLogging(app *cli.Context, cfg *cmds.Server) error {
}
func Run(app *cli.Context) error {
genericapiserver.NotifySystemD = false
return run(app, &cmds.ServerConfig)
}
@ -95,6 +98,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
}
logrus.Info("k3s is up and running")
go systemd.SdNotify(false, "READY=1")
if cfg.DisableAgent {
<-ctx.Done()