API server explicitly notify systemd of successful startup
Use the systemd $NOTIFY_SOCKET convention for kube-apiserver startup. This allows it to be part of dependency trees and for consumers to wait until it is listening on its ports. The $NOTIFY_SOCKET protocol is described here: http://www.freedesktop.org/software/systemd/man/sd_notify.html Currently this is limited to the kube-apiserver process. Other kube processes are internal kubernetes moving points. The API server is the entry point relied on by callers. 100% stolen from Stef Walter from: https://github.com/GoogleCloudPlatform/kubernetes/pull/8316
This commit is contained in:
5
Godeps/Godeps.json
generated
5
Godeps/Godeps.json
generated
@@ -94,6 +94,11 @@
|
||||
"ImportPath": "github.com/coreos/go-semver/semver",
|
||||
"Rev": "6fe83ccda8fb9b7549c9ab4ba47f47858bc950aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/go-systemd/daemon",
|
||||
"Comment": "v2-27-g97e243d",
|
||||
"Rev": "97e243d21a8e232e9d8af38ba2366dfcfceebeba"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/go-systemd/dbus",
|
||||
"Comment": "v2-27-g97e243d",
|
||||
|
31
Godeps/_workspace/src/github.com/coreos/go-systemd/daemon/sdnotify.go
generated
vendored
Normal file
31
Godeps/_workspace/src/github.com/coreos/go-systemd/daemon/sdnotify.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Code forked from Docker project
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
var SdNotifyNoSocket = errors.New("No socket")
|
||||
|
||||
// SdNotify sends a message to the init daemon. It is common to ignore the error.
|
||||
func SdNotify(state string) error {
|
||||
socketAddr := &net.UnixAddr{
|
||||
Name: os.Getenv("NOTIFY_SOCKET"),
|
||||
Net: "unixgram",
|
||||
}
|
||||
|
||||
if socketAddr.Name == "" {
|
||||
return SdNotifyNoSocket
|
||||
}
|
||||
|
||||
conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
_, err = conn.Write([]byte(state))
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user