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
80baec69
Commit
80baec69
authored
Feb 21, 2024
by
Derek Nola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore original order of agent startup functions
Signed-off-by:
Derek Nola
<
derek.nola@suse.com
>
parent
f19db855
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
28 deletions
+19
-28
run.go
pkg/agent/run.go
+19
-6
agent.go
pkg/daemons/agent/agent.go
+0
-22
No files found.
pkg/agent/run.go
View file @
80baec69
...
...
@@ -13,6 +13,7 @@ import (
systemd
"github.com/coreos/go-systemd/daemon"
"github.com/k3s-io/k3s/pkg/agent/config"
"github.com/k3s-io/k3s/pkg/agent/containerd"
"github.com/k3s-io/k3s/pkg/agent/flannel"
"github.com/k3s-io/k3s/pkg/agent/netpol"
"github.com/k3s-io/k3s/pkg/agent/proxy"
...
...
@@ -130,13 +131,18 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
}
}
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
os
.
Unsetenv
(
"NOTIFY_SOCKET"
)
if
err
:=
setupTunnelAndRunAgent
(
ctx
,
nodeConfig
,
cfg
,
proxy
);
err
!=
nil
{
return
err
if
nodeConfig
.
Docker
{
if
err
:=
executor
.
Docker
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
}
}
else
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
err
:=
containerd
.
SetupContainerdConfig
(
nodeConfig
);
err
!=
nil
{
return
err
}
if
err
:=
executor
.
Containerd
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
}
}
// the agent runtime is ready to host workloads when containerd is up and the airgap
// images have finished loading, as that portion of startup may block for an arbitrary
// amount of time depending on how long it takes to import whatever the user has placed
...
...
@@ -145,6 +151,13 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
close
(
cfg
.
AgentReady
)
}
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
os
.
Unsetenv
(
"NOTIFY_SOCKET"
)
if
err
:=
setupTunnelAndRunAgent
(
ctx
,
nodeConfig
,
cfg
,
proxy
);
err
!=
nil
{
return
err
}
if
err
:=
util
.
WaitForAPIServerReady
(
ctx
,
nodeConfig
.
AgentConfig
.
KubeConfigKubelet
,
util
.
DefaultAPIServerReadyTimeout
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to wait for apiserver ready"
)
}
...
...
pkg/daemons/agent/agent.go
View file @
80baec69
...
...
@@ -7,7 +7,6 @@ import (
"time"
"github.com/k3s-io/k3s/pkg/agent/config"
"github.com/k3s-io/k3s/pkg/agent/containerd"
"github.com/k3s-io/k3s/pkg/agent/proxy"
daemonconfig
"github.com/k3s-io/k3s/pkg/daemons/config"
"github.com/k3s-io/k3s/pkg/daemons/executor"
...
...
@@ -24,16 +23,6 @@ func Agent(ctx context.Context, nodeConfig *daemonconfig.Node, proxy proxy.Proxy
logs
.
InitLogs
()
defer
logs
.
FlushLogs
()
if
nodeConfig
.
Docker
{
if
err
:=
startDocker
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
}
}
else
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
err
:=
startContainerd
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
}
}
if
err
:=
startKubelet
(
ctx
,
&
nodeConfig
.
AgentConfig
);
err
!=
nil
{
return
err
}
...
...
@@ -65,17 +54,6 @@ func startKubelet(ctx context.Context, cfg *daemonconfig.Agent) error {
return
executor
.
Kubelet
(
ctx
,
args
)
}
func
startContainerd
(
ctx
context
.
Context
,
cfg
*
daemonconfig
.
Node
)
error
{
if
err
:=
containerd
.
SetupContainerdConfig
(
cfg
);
err
!=
nil
{
return
err
}
return
executor
.
Containerd
(
ctx
,
cfg
)
}
func
startDocker
(
ctx
context
.
Context
,
cfg
*
daemonconfig
.
Node
)
error
{
return
executor
.
Docker
(
ctx
,
cfg
)
}
// ImageCredProvAvailable checks to see if the kubelet image credential provider bin dir and config
// files exist and are of the correct types. This is exported so that it may be used by downstream projects.
func
ImageCredProvAvailable
(
cfg
*
daemonconfig
.
Agent
)
bool
{
...
...
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