Commit fae41a8b authored by Derek Nola's avatar Derek Nola

Rename AgentReady to ContainerRuntimeReady for better clarity

parent 91cc2fee
...@@ -143,12 +143,12 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error { ...@@ -143,12 +143,12 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return err 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 // 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 // amount of time depending on how long it takes to import whatever the user has placed
// in the images directory. // in the images directory.
if cfg.AgentReady != nil { if cfg.ContainerRuntimeReady != nil {
close(cfg.AgentReady) close(cfg.ContainerRuntimeReady)
} }
notifySocket := os.Getenv("NOTIFY_SOCKET") notifySocket := os.Getenv("NOTIFY_SOCKET")
...@@ -258,8 +258,8 @@ func RunStandalone(ctx context.Context, cfg cmds.Agent) error { ...@@ -258,8 +258,8 @@ func RunStandalone(ctx context.Context, cfg cmds.Agent) error {
return err return err
} }
if cfg.AgentReady != nil { if cfg.ContainerRuntimeReady != nil {
close(cfg.AgentReady) close(cfg.ContainerRuntimeReady)
} }
if err := tunnelSetup(ctx, nodeConfig, cfg, proxy); err != nil { if err := tunnelSetup(ctx, nodeConfig, cfg, proxy); err != nil {
......
...@@ -51,7 +51,7 @@ type Agent struct { ...@@ -51,7 +51,7 @@ type Agent struct {
Taints cli.StringSlice Taints cli.StringSlice
ImageCredProvBinDir string ImageCredProvBinDir string
ImageCredProvConfig string ImageCredProvConfig string
AgentReady chan<- struct{} ContainerRuntimeReady chan<- struct{}
AgentShared AgentShared
} }
......
...@@ -110,11 +110,11 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont ...@@ -110,11 +110,11 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
} }
} }
agentReady := make(chan struct{}) containerRuntimeReady := make(chan struct{})
serverConfig := server.Config{} serverConfig := server.Config{}
serverConfig.DisableAgent = cfg.DisableAgent serverConfig.DisableAgent = cfg.DisableAgent
serverConfig.ControlConfig.Runtime = config.NewRuntime(agentReady) serverConfig.ControlConfig.Runtime = config.NewRuntime(containerRuntimeReady)
serverConfig.ControlConfig.Token = cfg.Token serverConfig.ControlConfig.Token = cfg.Token
serverConfig.ControlConfig.AgentToken = cfg.AgentToken serverConfig.ControlConfig.AgentToken = cfg.AgentToken
serverConfig.ControlConfig.JoinURL = cfg.ServerURL serverConfig.ControlConfig.JoinURL = cfg.ServerURL
...@@ -513,7 +513,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont ...@@ -513,7 +513,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
} }
agentConfig := cmds.AgentConfig agentConfig := cmds.AgentConfig
agentConfig.AgentReady = agentReady agentConfig.ContainerRuntimeReady = containerRuntimeReady
agentConfig.Debug = app.GlobalBool("debug") agentConfig.Debug = app.GlobalBool("debug")
agentConfig.DataDir = filepath.Dir(serverConfig.ControlConfig.DataDir) agentConfig.DataDir = filepath.Dir(serverConfig.ControlConfig.DataDir)
agentConfig.ServerURL = url agentConfig.ServerURL = url
......
...@@ -295,7 +295,7 @@ type ControlRuntime struct { ...@@ -295,7 +295,7 @@ type ControlRuntime struct {
HTTPBootstrap bool HTTPBootstrap bool
APIServerReady <-chan struct{} APIServerReady <-chan struct{}
AgentReady <-chan struct{} ContainerRuntimeReady <-chan struct{}
ETCDReady <-chan struct{} ETCDReady <-chan struct{}
StartupHooksWg *sync.WaitGroup StartupHooksWg *sync.WaitGroup
ClusterControllerStarts map[string]leader.Callback ClusterControllerStarts map[string]leader.Callback
...@@ -361,9 +361,9 @@ type ControlRuntime struct { ...@@ -361,9 +361,9 @@ type ControlRuntime struct {
EtcdConfig endpoint.ETCDConfig EtcdConfig endpoint.ETCDConfig
} }
func NewRuntime(agentReady <-chan struct{}) *ControlRuntime { func NewRuntime(containerRuntimeReady <-chan struct{}) *ControlRuntime {
return &ControlRuntime{ return &ControlRuntime{
AgentReady: agentReady, ContainerRuntimeReady: containerRuntimeReady,
ClusterControllerStarts: map[string]leader.Callback{}, ClusterControllerStarts: map[string]leader.Callback{},
LeaderElectedClusterControllerStarts: map[string]leader.Callback{}, LeaderElectedClusterControllerStarts: map[string]leader.Callback{},
} }
......
...@@ -308,7 +308,7 @@ func (e *ETCD) IsInitialized() (bool, error) { ...@@ -308,7 +308,7 @@ func (e *ETCD) IsInitialized() (bool, error) {
func (e *ETCD) Reset(ctx context.Context, rebootstrap func() error) 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 // Wait for etcd to come up as a new single-node cluster, then exit
go func() { go func() {
<-e.config.Runtime.AgentReady <-e.config.Runtime.ContainerRuntimeReady
t := time.NewTicker(5 * time.Second) t := time.NewTicker(5 * time.Second)
defer t.Stop() defer t.Stop()
for range t.C { for range t.C {
...@@ -450,8 +450,8 @@ func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) e ...@@ -450,8 +450,8 @@ func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) e
for { for {
select { select {
case <-time.After(30 * time.Second): case <-time.After(30 * time.Second):
logrus.Infof("Waiting for agent to become ready before joining etcd cluster") logrus.Infof("Waiting for container runtime to become ready before joining etcd cluster")
case <-e.config.Runtime.AgentReady: case <-e.config.Runtime.ContainerRuntimeReady:
if err := wait.PollImmediateUntilWithContext(ctx, time.Second, func(ctx context.Context) (bool, error) { if err := wait.PollImmediateUntilWithContext(ctx, time.Second, func(ctx context.Context) (bool, error) {
if err := e.join(ctx, clientAccessInfo); err != nil { 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 // 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 ...@@ -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 // being promoted to full voting member. The checks only run on the cluster member that is
// the etcd leader. // the etcd leader.
func (e *ETCD) manageLearners(ctx context.Context) { func (e *ETCD) manageLearners(ctx context.Context) {
<-e.config.Runtime.AgentReady <-e.config.Runtime.ContainerRuntimeReady
t := time.NewTicker(manageTickerTime) t := time.NewTicker(manageTickerTime)
defer t.Stop() defer t.Stop()
......
...@@ -27,8 +27,8 @@ func mustGetAddress() string { ...@@ -27,8 +27,8 @@ func mustGetAddress() string {
} }
func generateTestConfig() *config.Control { func generateTestConfig() *config.Control {
agentReady := make(chan struct{}) containerRuntimeReady := make(chan struct{})
close(agentReady) close(containerRuntimeReady)
criticalControlArgs := config.CriticalControlArgs{ criticalControlArgs := config.CriticalControlArgs{
ClusterDomain: "cluster.local", ClusterDomain: "cluster.local",
ClusterDNS: net.ParseIP("10.43.0.10"), ClusterDNS: net.ParseIP("10.43.0.10"),
...@@ -37,7 +37,7 @@ func generateTestConfig() *config.Control { ...@@ -37,7 +37,7 @@ func generateTestConfig() *config.Control {
ServiceIPRange: testutil.ServiceIPNet(), ServiceIPRange: testutil.ServiceIPNet(),
} }
return &config.Control{ return &config.Control{
Runtime: config.NewRuntime(agentReady), Runtime: config.NewRuntime(containerRuntimeReady),
HTTPSPort: 6443, HTTPSPort: 6443,
SupervisorPort: 6443, SupervisorPort: 6443,
AdvertisePort: 6443, AdvertisePort: 6443,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment