mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Restore original order of agent startup functions
Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
parent
1c1746114c
commit
91cc2feed2
@ -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")
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user