mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Merge pull request #1182 from erikwilson/docker-pause-image
Allow --pause-image to set docker sandbox image also
This commit is contained in:
commit
d4959d53af
@ -452,11 +452,14 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
|
|||||||
nodeConfig.AgentConfig.CNIBinDir = filepath.Dir(hostLocal)
|
nodeConfig.AgentConfig.CNIBinDir = filepath.Dir(hostLocal)
|
||||||
nodeConfig.AgentConfig.CNIConfDir = filepath.Join(envInfo.DataDir, "etc/cni/net.d")
|
nodeConfig.AgentConfig.CNIConfDir = filepath.Join(envInfo.DataDir, "etc/cni/net.d")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||||
nodeConfig.AgentConfig.RuntimeSocket = "unix://" + nodeConfig.Containerd.Address
|
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.Containerd.Address
|
||||||
} else {
|
} else {
|
||||||
nodeConfig.AgentConfig.RuntimeSocket = "unix://" + nodeConfig.ContainerRuntimeEndpoint
|
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.ContainerRuntimeEndpoint
|
||||||
|
nodeConfig.AgentConfig.CNIPlugin = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if controlConfig.ClusterIPRange != nil {
|
if controlConfig.ClusterIPRange != nil {
|
||||||
nodeConfig.AgentConfig.ClusterCIDR = *controlConfig.ClusterIPRange
|
nodeConfig.AgentConfig.ClusterCIDR = *controlConfig.ClusterIPRange
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,7 @@ func run(ctx context.Context, cfg cmds.Agent, lb *loadbalancer.LoadBalancer) err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if nodeConfig.Docker || nodeConfig.ContainerRuntimeEndpoint != "" {
|
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||||
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.ContainerRuntimeEndpoint
|
|
||||||
nodeConfig.AgentConfig.CNIPlugin = true
|
|
||||||
} else {
|
|
||||||
if err := containerd.Run(ctx, nodeConfig); err != nil {
|
if err := containerd.Run(ctx, nodeConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,6 @@ const ContainerdConfigTemplate = `
|
|||||||
|
|
||||||
{{- if .NodeConfig.AgentConfig.PauseImage }}
|
{{- if .NodeConfig.AgentConfig.PauseImage }}
|
||||||
sandbox_image = "{{ .NodeConfig.AgentConfig.PauseImage }}"
|
sandbox_image = "{{ .NodeConfig.AgentConfig.PauseImage }}"
|
||||||
{{else}}
|
|
||||||
sandbox_image = "docker.io/rancher/pause:3.1"
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{- if not .NodeConfig.NoFlannel }}
|
{{- if not .NodeConfig.NoFlannel }}
|
||||||
|
@ -82,8 +82,9 @@ var (
|
|||||||
}
|
}
|
||||||
PauseImageFlag = cli.StringFlag{
|
PauseImageFlag = cli.StringFlag{
|
||||||
Name: "pause-image",
|
Name: "pause-image",
|
||||||
Usage: "(agent/runtime) Customized pause image for containerd sandbox",
|
Usage: "(agent/runtime) Customized pause image for containerd or docker sandbox",
|
||||||
Destination: &AgentConfig.PauseImage,
|
Destination: &AgentConfig.PauseImage,
|
||||||
|
Value: "docker.io/rancher/pause:3.1",
|
||||||
}
|
}
|
||||||
FlannelFlag = cli.BoolFlag{
|
FlannelFlag = cli.BoolFlag{
|
||||||
Name: "no-flannel",
|
Name: "no-flannel",
|
||||||
|
@ -94,6 +94,8 @@ func startKubelet(cfg *config.Agent) {
|
|||||||
argsMap["container-runtime"] = "remote"
|
argsMap["container-runtime"] = "remote"
|
||||||
argsMap["container-runtime-endpoint"] = cfg.RuntimeSocket
|
argsMap["container-runtime-endpoint"] = cfg.RuntimeSocket
|
||||||
argsMap["serialize-image-pulls"] = "false"
|
argsMap["serialize-image-pulls"] = "false"
|
||||||
|
} else if cfg.PauseImage != "" {
|
||||||
|
argsMap["pod-infra-container-image"] = cfg.PauseImage
|
||||||
}
|
}
|
||||||
if cfg.ListenAddress != "" {
|
if cfg.ListenAddress != "" {
|
||||||
argsMap["address"] = cfg.ListenAddress
|
argsMap["address"] = cfg.ListenAddress
|
||||||
|
Loading…
Reference in New Issue
Block a user