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
77846d63
Commit
77846d63
authored
Dec 08, 2023
by
Brad Davidson
Committed by
Brad Davidson
Jan 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate errors up from config.Get
Fixes crash when killing agent while waiting for config from server Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
16d29398
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
config.go
pkg/agent/config/config.go
+3
-3
run.go
pkg/agent/run.go
+9
-2
No files found.
pkg/agent/config/config.go
View file @
77846d63
...
...
@@ -48,8 +48,8 @@ const (
// so this is somewhat computationally expensive on the server side, and is retried with jitter
// to avoid having clients hammer on the server at fixed periods.
// A call to this will bock until agent configuration is successfully returned by the
// server.
func
Get
(
ctx
context
.
Context
,
agent
cmds
.
Agent
,
proxy
proxy
.
Proxy
)
*
config
.
Node
{
// server
, or the context is cancelled
.
func
Get
(
ctx
context
.
Context
,
agent
cmds
.
Agent
,
proxy
proxy
.
Proxy
)
(
*
config
.
Node
,
error
)
{
var
agentConfig
*
config
.
Node
var
err
error
...
...
@@ -65,7 +65,7 @@ func Get(ctx context.Context, agent cmds.Agent, proxy proxy.Proxy) *config.Node
cancel
()
}
},
5
*
time
.
Second
,
1.0
,
true
)
return
agentConfig
return
agentConfig
,
err
}
// KubeProxyDisabled returns a bool indicating whether or not kube-proxy has been disabled in the
...
...
pkg/agent/run.go
View file @
77846d63
...
...
@@ -52,7 +52,10 @@ import (
)
func
run
(
ctx
context
.
Context
,
cfg
cmds
.
Agent
,
proxy
proxy
.
Proxy
)
error
{
nodeConfig
:=
config
.
Get
(
ctx
,
cfg
,
proxy
)
nodeConfig
,
err
:=
config
.
Get
(
ctx
,
cfg
,
proxy
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to retrieve agent configuration"
)
}
dualCluster
,
err
:=
utilsnet
.
IsDualStackCIDRs
(
nodeConfig
.
AgentConfig
.
ClusterCIDRs
)
if
err
!=
nil
{
...
...
@@ -234,7 +237,11 @@ func RunStandalone(ctx context.Context, cfg cmds.Agent) error {
return
err
}
nodeConfig
:=
config
.
Get
(
ctx
,
cfg
,
proxy
)
nodeConfig
,
err
:=
config
.
Get
(
ctx
,
cfg
,
proxy
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to retrieve agent configuration"
)
}
if
err
:=
executor
.
Bootstrap
(
ctx
,
nodeConfig
,
cfg
);
err
!=
nil
{
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