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
7e1699cd
Commit
7e1699cd
authored
May 01, 2019
by
galal-hussein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if hostname is resolvable before running agent
parent
0726ce75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
config.go
pkg/agent/config/config.go
+13
-0
No files found.
pkg/agent/config/config.go
View file @
7e1699cd
...
@@ -253,6 +253,8 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
...
@@ -253,6 +253,8 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
return
nil
,
err
return
nil
,
err
}
}
hostnameCheck
(
nodeName
)
nodeCertFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"token-node.crt"
)
nodeCertFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"token-node.crt"
)
nodeKeyFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"token-node.key"
)
nodeKeyFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"token-node.key"
)
nodePasswordFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"node-password.txt"
)
nodePasswordFile
:=
filepath
.
Join
(
envInfo
.
DataDir
,
"node-password.txt"
)
...
@@ -348,3 +350,14 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
...
@@ -348,3 +350,14 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
controlControl
:=
&
config
.
Control
{}
controlControl
:=
&
config
.
Control
{}
return
controlControl
,
json
.
Unmarshal
(
data
,
controlControl
)
return
controlControl
,
json
.
Unmarshal
(
data
,
controlControl
)
}
}
func
hostnameCheck
(
hostname
string
)
{
for
{
_
,
err
:=
sysnet
.
LookupHost
(
hostname
)
if
err
==
nil
{
break
}
logrus
.
Infof
(
"Waiting for hostname %s to be resolvable: %v"
,
hostname
,
err
)
time
.
Sleep
(
2
*
time
.
Second
)
}
}
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