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
a46fe4a3
Unverified
Commit
a46fe4a3
authored
May 03, 2019
by
Darren Shepherd
Committed by
GitHub
May 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #437 from galal-hussein/timeout_hostname_check
Add timeout to hostname check
parents
f10b43de
5d8d9e61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
config.go
pkg/agent/config/config.go
+10
-7
run.go
pkg/agent/run.go
+4
-0
No files found.
pkg/agent/config/config.go
View file @
a46fe4a3
...
@@ -253,8 +253,6 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
...
@@ -253,8 +253,6 @@ 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"
)
...
@@ -351,13 +349,18 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
...
@@ -351,13 +349,18 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
return
controlControl
,
json
.
Unmarshal
(
data
,
controlControl
)
return
controlControl
,
json
.
Unmarshal
(
data
,
controlControl
)
}
}
func
hostnameCheck
(
hostname
string
)
{
func
HostnameCheck
(
cfg
cmds
.
Agent
)
error
{
for
{
hostname
,
_
,
err
:=
getHostnameAndIP
(
cfg
)
_
,
err
:=
sysnet
.
LookupHost
(
hostname
)
if
err
!=
nil
{
return
err
}
for
i
:=
0
;
i
<
5
;
i
++
{
_
,
err
=
sysnet
.
LookupHost
(
hostname
)
if
err
==
nil
{
if
err
==
nil
{
break
return
nil
}
}
logrus
.
Infof
(
"Waiting for hostname %s to be resolvable: %v"
,
hostname
,
err
)
logrus
.
Infof
(
"Waiting for hostname %s to be resolvable: %v"
,
hostname
,
err
)
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
time
.
Second
*
3
)
}
}
return
fmt
.
Errorf
(
"Timed out waiting for hostname %s to be resolvable: %v"
,
hostname
,
err
)
}
}
pkg/agent/run.go
View file @
a46fe4a3
...
@@ -25,6 +25,10 @@ import (
...
@@ -25,6 +25,10 @@ import (
func
run
(
ctx
context
.
Context
,
cfg
cmds
.
Agent
)
error
{
func
run
(
ctx
context
.
Context
,
cfg
cmds
.
Agent
)
error
{
nodeConfig
:=
config
.
Get
(
ctx
,
cfg
)
nodeConfig
:=
config
.
Get
(
ctx
,
cfg
)
if
err
:=
config
.
HostnameCheck
(
cfg
);
err
!=
nil
{
return
err
}
if
!
nodeConfig
.
NoFlannel
{
if
!
nodeConfig
.
NoFlannel
{
if
err
:=
flannel
.
Prepare
(
ctx
,
nodeConfig
);
err
!=
nil
{
if
err
:=
flannel
.
Prepare
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
return
err
...
...
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