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
fae41a8b
Commit
fae41a8b
authored
Feb 21, 2024
by
Derek Nola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename AgentReady to ContainerRuntimeReady for better clarity
Signed-off-by:
Derek Nola
<
derek.nola@suse.com
>
parent
91cc2fee
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
run.go
pkg/agent/run.go
+5
-5
agent.go
pkg/cli/cmds/agent.go
+1
-1
server.go
pkg/cli/server/server.go
+3
-3
types.go
pkg/daemons/config/types.go
+3
-3
etcd.go
pkg/etcd/etcd.go
+4
-4
etcd_test.go
pkg/etcd/etcd_test.go
+3
-3
No files found.
pkg/agent/run.go
View file @
fae41a8b
...
...
@@ -143,12 +143,12 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return
err
}
}
// the
agent
runtime is ready to host workloads when containerd is up and the airgap
// the
container
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
// in the images directory.
if
cfg
.
Agent
Ready
!=
nil
{
close
(
cfg
.
Agent
Ready
)
if
cfg
.
ContainerRuntime
Ready
!=
nil
{
close
(
cfg
.
ContainerRuntime
Ready
)
}
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
...
...
@@ -258,8 +258,8 @@ func RunStandalone(ctx context.Context, cfg cmds.Agent) error {
return
err
}
if
cfg
.
Agent
Ready
!=
nil
{
close
(
cfg
.
Agent
Ready
)
if
cfg
.
ContainerRuntime
Ready
!=
nil
{
close
(
cfg
.
ContainerRuntime
Ready
)
}
if
err
:=
tunnelSetup
(
ctx
,
nodeConfig
,
cfg
,
proxy
);
err
!=
nil
{
...
...
pkg/cli/cmds/agent.go
View file @
fae41a8b
...
...
@@ -51,7 +51,7 @@ type Agent struct {
Taints
cli
.
StringSlice
ImageCredProvBinDir
string
ImageCredProvConfig
string
AgentReady
chan
<-
struct
{}
ContainerRuntimeReady
chan
<-
struct
{}
AgentShared
}
...
...
pkg/cli/server/server.go
View file @
fae41a8b
...
...
@@ -110,11 +110,11 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
}
}
agent
Ready
:=
make
(
chan
struct
{})
containerRuntime
Ready
:=
make
(
chan
struct
{})
serverConfig
:=
server
.
Config
{}
serverConfig
.
DisableAgent
=
cfg
.
DisableAgent
serverConfig
.
ControlConfig
.
Runtime
=
config
.
NewRuntime
(
agent
Ready
)
serverConfig
.
ControlConfig
.
Runtime
=
config
.
NewRuntime
(
containerRuntime
Ready
)
serverConfig
.
ControlConfig
.
Token
=
cfg
.
Token
serverConfig
.
ControlConfig
.
AgentToken
=
cfg
.
AgentToken
serverConfig
.
ControlConfig
.
JoinURL
=
cfg
.
ServerURL
...
...
@@ -513,7 +513,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
}
agentConfig
:=
cmds
.
AgentConfig
agentConfig
.
AgentReady
=
agent
Ready
agentConfig
.
ContainerRuntimeReady
=
containerRuntime
Ready
agentConfig
.
Debug
=
app
.
GlobalBool
(
"debug"
)
agentConfig
.
DataDir
=
filepath
.
Dir
(
serverConfig
.
ControlConfig
.
DataDir
)
agentConfig
.
ServerURL
=
url
...
...
pkg/daemons/config/types.go
View file @
fae41a8b
...
...
@@ -295,7 +295,7 @@ type ControlRuntime struct {
HTTPBootstrap
bool
APIServerReady
<-
chan
struct
{}
AgentReady
<-
chan
struct
{}
ContainerRuntimeReady
<-
chan
struct
{}
ETCDReady
<-
chan
struct
{}
StartupHooksWg
*
sync
.
WaitGroup
ClusterControllerStarts
map
[
string
]
leader
.
Callback
...
...
@@ -361,9 +361,9 @@ type ControlRuntime struct {
EtcdConfig
endpoint
.
ETCDConfig
}
func
NewRuntime
(
agent
Ready
<-
chan
struct
{})
*
ControlRuntime
{
func
NewRuntime
(
containerRuntime
Ready
<-
chan
struct
{})
*
ControlRuntime
{
return
&
ControlRuntime
{
AgentReady
:
agent
Ready
,
ContainerRuntimeReady
:
containerRuntime
Ready
,
ClusterControllerStarts
:
map
[
string
]
leader
.
Callback
{},
LeaderElectedClusterControllerStarts
:
map
[
string
]
leader
.
Callback
{},
}
...
...
pkg/etcd/etcd.go
View file @
fae41a8b
...
...
@@ -308,7 +308,7 @@ func (e *ETCD) IsInitialized() (bool, error) {
func
(
e
*
ETCD
)
Reset
(
ctx
context
.
Context
,
rebootstrap
func
()
error
)
error
{
// Wait for etcd to come up as a new single-node cluster, then exit
go
func
()
{
<-
e
.
config
.
Runtime
.
Agent
Ready
<-
e
.
config
.
Runtime
.
ContainerRuntime
Ready
t
:=
time
.
NewTicker
(
5
*
time
.
Second
)
defer
t
.
Stop
()
for
range
t
.
C
{
...
...
@@ -450,8 +450,8 @@ func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) e
for
{
select
{
case
<-
time
.
After
(
30
*
time
.
Second
)
:
logrus
.
Infof
(
"Waiting for
agent
to become ready before joining etcd cluster"
)
case
<-
e
.
config
.
Runtime
.
Agent
Ready
:
logrus
.
Infof
(
"Waiting for
container runtime
to become ready before joining etcd cluster"
)
case
<-
e
.
config
.
Runtime
.
ContainerRuntime
Ready
:
if
err
:=
wait
.
PollImmediateUntilWithContext
(
ctx
,
time
.
Second
,
func
(
ctx
context
.
Context
)
(
bool
,
error
)
{
if
err
:=
e
.
join
(
ctx
,
clientAccessInfo
);
err
!=
nil
{
// Retry the join if waiting for another member to be promoted, or waiting for peers to connect after promotion
...
...
@@ -1040,7 +1040,7 @@ func (e *ETCD) RemovePeer(ctx context.Context, name, address string, allowSelfRe
// being promoted to full voting member. The checks only run on the cluster member that is
// the etcd leader.
func
(
e
*
ETCD
)
manageLearners
(
ctx
context
.
Context
)
{
<-
e
.
config
.
Runtime
.
Agent
Ready
<-
e
.
config
.
Runtime
.
ContainerRuntime
Ready
t
:=
time
.
NewTicker
(
manageTickerTime
)
defer
t
.
Stop
()
...
...
pkg/etcd/etcd_test.go
View file @
fae41a8b
...
...
@@ -27,8 +27,8 @@ func mustGetAddress() string {
}
func
generateTestConfig
()
*
config
.
Control
{
agent
Ready
:=
make
(
chan
struct
{})
close
(
agent
Ready
)
containerRuntime
Ready
:=
make
(
chan
struct
{})
close
(
containerRuntime
Ready
)
criticalControlArgs
:=
config
.
CriticalControlArgs
{
ClusterDomain
:
"cluster.local"
,
ClusterDNS
:
net
.
ParseIP
(
"10.43.0.10"
),
...
...
@@ -37,7 +37,7 @@ func generateTestConfig() *config.Control {
ServiceIPRange
:
testutil
.
ServiceIPNet
(),
}
return
&
config
.
Control
{
Runtime
:
config
.
NewRuntime
(
agent
Ready
),
Runtime
:
config
.
NewRuntime
(
containerRuntime
Ready
),
HTTPSPort
:
6443
,
SupervisorPort
:
6443
,
AdvertisePort
:
6443
,
...
...
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