Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3db1f69e
Commit
3db1f69e
authored
Jun 01, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8764 from eparis/sd_notify
API server explicitly notify systemd of successful startup
parents
760caea1
9d304774
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
Godeps.json
Godeps/Godeps.json
+5
-0
sdnotify.go
...space/src/github.com/coreos/go-systemd/daemon/sdnotify.go
+31
-0
server.go
cmd/kube-apiserver/app/server.go
+11
-0
kube-apiserver.service
contrib/init/systemd/kube-apiserver.service
+1
-0
No files found.
Godeps/Godeps.json
View file @
3db1f69e
...
@@ -99,6 +99,11 @@
...
@@ -99,6 +99,11 @@
"Rev"
:
"6fe83ccda8fb9b7549c9ab4ba47f47858bc950aa"
"Rev"
:
"6fe83ccda8fb9b7549c9ab4ba47f47858bc950aa"
},
},
{
{
"ImportPath"
:
"github.com/coreos/go-systemd/daemon"
,
"Comment"
:
"v2-27-g97e243d"
,
"Rev"
:
"97e243d21a8e232e9d8af38ba2366dfcfceebeba"
},
{
"ImportPath"
:
"github.com/coreos/go-systemd/dbus"
,
"ImportPath"
:
"github.com/coreos/go-systemd/dbus"
,
"Comment"
:
"v2-27-g97e243d"
,
"Comment"
:
"v2-27-g97e243d"
,
"Rev"
:
"97e243d21a8e232e9d8af38ba2366dfcfceebeba"
"Rev"
:
"97e243d21a8e232e9d8af38ba2366dfcfceebeba"
...
...
Godeps/_workspace/src/github.com/coreos/go-systemd/daemon/sdnotify.go
0 → 100644
View file @
3db1f69e
// 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
}
cmd/kube-apiserver/app/server.go
View file @
3db1f69e
...
@@ -40,6 +40,7 @@ import (
...
@@ -40,6 +40,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
forked
"github.com/GoogleCloudPlatform/kubernetes/third_party/forked/coreos/go-etcd/etcd"
forked
"github.com/GoogleCloudPlatform/kubernetes/third_party/forked/coreos/go-etcd/etcd"
systemd
"github.com/coreos/go-systemd/daemon"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -448,6 +449,10 @@ func (s *APIServer) Run(_ []string) error {
...
@@ -448,6 +449,10 @@ func (s *APIServer) Run(_ []string) error {
glog
.
Infof
(
"Using self-signed cert (%s, %s)"
,
s
.
TLSCertFile
,
s
.
TLSPrivateKeyFile
)
glog
.
Infof
(
"Using self-signed cert (%s, %s)"
,
s
.
TLSCertFile
,
s
.
TLSPrivateKeyFile
)
}
}
}
}
// err == systemd.SdNotifyNoSocket when not running on a systemd system
if
err
:=
systemd
.
SdNotify
(
"READY=1
\n
"
);
err
!=
nil
&&
err
!=
systemd
.
SdNotifyNoSocket
{
glog
.
Errorf
(
"Unable to send systemd daemon sucessful start message: %v
\n
"
,
err
)
}
if
err
:=
secureServer
.
ListenAndServeTLS
(
s
.
TLSCertFile
,
s
.
TLSPrivateKeyFile
);
err
!=
nil
{
if
err
:=
secureServer
.
ListenAndServeTLS
(
s
.
TLSCertFile
,
s
.
TLSPrivateKeyFile
);
err
!=
nil
{
glog
.
Errorf
(
"Unable to listen for secure (%v); will try again."
,
err
)
glog
.
Errorf
(
"Unable to listen for secure (%v); will try again."
,
err
)
}
}
...
@@ -462,6 +467,12 @@ func (s *APIServer) Run(_ []string) error {
...
@@ -462,6 +467,12 @@ func (s *APIServer) Run(_ []string) error {
WriteTimeout
:
ReadWriteTimeout
,
WriteTimeout
:
ReadWriteTimeout
,
MaxHeaderBytes
:
1
<<
20
,
MaxHeaderBytes
:
1
<<
20
,
}
}
if
secureLocation
==
""
{
// err == systemd.SdNotifyNoSocket when not running on a systemd system
if
err
:=
systemd
.
SdNotify
(
"READY=1
\n
"
);
err
!=
nil
&&
err
!=
systemd
.
SdNotifyNoSocket
{
glog
.
Errorf
(
"Unable to send systemd daemon sucessful start message: %v
\n
"
,
err
)
}
}
glog
.
Infof
(
"Serving insecurely on %s"
,
insecureLocation
)
glog
.
Infof
(
"Serving insecurely on %s"
,
insecureLocation
)
glog
.
Fatal
(
http
.
ListenAndServe
())
glog
.
Fatal
(
http
.
ListenAndServe
())
return
nil
return
nil
...
...
contrib/init/systemd/kube-apiserver.service
View file @
3db1f69e
...
@@ -18,6 +18,7 @@ ExecStart=/usr/bin/kube-apiserver \
...
@@ -18,6 +18,7 @@ ExecStart=/usr/bin/kube-apiserver \
$KUBE_ADMISSION_CONTROL \
$KUBE_ADMISSION_CONTROL \
$KUBE_API_ARGS
$KUBE_API_ARGS
Restart=on-failure
Restart=on-failure
Type=notify
LimitNOFILE=65536
LimitNOFILE=65536
[Install]
[Install]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment