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
32b02d1b
Commit
32b02d1b
authored
Jun 15, 2021
by
Brian Downs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send systemd notifications for both server and agent (#3430)
* update agent to sent systemd notify after everything starts Signed-off-by:
Brian Downs
<
brian.downs@gmail.com
>
parent
c012e6ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
run.go
pkg/agent/run.go
+8
-1
server.go
pkg/cli/server/server.go
+2
-4
No files found.
pkg/agent/run.go
View file @
32b02d1b
...
@@ -115,6 +115,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
...
@@ -115,6 +115,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
}
}
...
@@ -142,6 +146,9 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
...
@@ -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
()
<-
ctx
.
Done
()
return
ctx
.
Err
()
return
ctx
.
Err
()
}
}
...
@@ -233,7 +240,7 @@ func Run(ctx context.Context, cfg cmds.Agent) error {
...
@@ -233,7 +240,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
)
}
}
...
...
pkg/cli/server/server.go
View file @
32b02d1b
...
@@ -358,8 +358,6 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
...
@@ -358,8 +358,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
())
...
@@ -375,9 +373,9 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
...
@@ -375,9 +373,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
"
)
}
}
}()
}()
...
...
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