Make pause image configurable (#345)

pull/440/head
haokang.ke 2019-05-04 01:36:12 +08:00 committed by Darren Shepherd
parent ea94b1af77
commit 52f845ec84
5 changed files with 20 additions and 5 deletions

View File

@ -304,6 +304,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
nodeConfig.AgentConfig.ListenAddress = "0.0.0.0"
nodeConfig.AgentConfig.KubeConfig = kubeConfig
nodeConfig.AgentConfig.RootDir = filepath.Join(envInfo.DataDir, "kubelet")
nodeConfig.AgentConfig.PauseImage = envInfo.PauseImage
nodeConfig.CACerts = info.CACerts
nodeConfig.Containerd.Config = filepath.Join(envInfo.DataDir, "etc/containerd/config.toml")
nodeConfig.Containerd.Root = filepath.Join(envInfo.DataDir, "containerd")

View File

@ -19,17 +19,22 @@ path = "{{ .NodeConfig.Containerd.Opt }}"
[plugins.cri]
stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}"
stream_server_port = "10010"
{{ if .IsRunningInUserNS }}
{{- if .IsRunningInUserNS }}
disable_cgroup = true
disable_apparmor = true
restrict_oom_score_adj = true
{{ end }}
{{ end -}}
{{ if not .NodeConfig.NoFlannel }}
{{- if .NodeConfig.AgentConfig.PauseImage }}
sandbox_image = "{{ .NodeConfig.AgentConfig.PauseImage }}"
{{ end -}}
{{- if not .NodeConfig.NoFlannel }}
[plugins.cri.cni]
bin_dir = "{{ .NodeConfig.AgentConfig.CNIBinDir }}"
conf_dir = "{{ .NodeConfig.AgentConfig.CNIConfDir }}"
{{ end }}
{{ end -}}
`
func ParseTemplateFromConfig(templateBuffer string, config interface{}) (string, error) {

View File

@ -16,6 +16,7 @@ type Agent struct {
NodeIP string
NodeName string
ClusterSecret string
PauseImage string
Docker bool
ContainerRuntimeEndpoint string
NoFlannel bool
@ -65,9 +66,14 @@ var (
Usage: "(agent) Disable embedded containerd and use alternative CRI implementation",
Destination: &AgentConfig.ContainerRuntimeEndpoint,
}
PauseImageFlag = cli.StringFlag{
Name: "pause-image",
Usage: "(agent) Customized pause image for containerd sandbox",
Destination: &AgentConfig.PauseImage,
}
ResolvConfFlag = cli.StringFlag{
Name: "resolv-conf",
Usage: "Kubelet resolv.conf file",
Usage: "(agent) Kubelet resolv.conf file",
EnvVar: "K3S_RESOLV_CONF",
Destination: &AgentConfig.ResolvConf,
}
@ -131,6 +137,7 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
NodeNameFlag,
NodeIPFlag,
CRIEndpointFlag,
PauseImageFlag,
ResolvConfFlag,
ExtraKubeletArgs,
ExtraKubeProxyArgs,

View File

@ -143,6 +143,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
FlannelFlag,
FlannelIfaceFlag,
CRIEndpointFlag,
PauseImageFlag,
ResolvConfFlag,
ExtraKubeletArgs,
ExtraKubeProxyArgs,

View File

@ -53,6 +53,7 @@ type Agent struct {
CNIConfDir string
ExtraKubeletArgs []string
ExtraKubeProxyArgs []string
PauseImage string
CNIPlugin bool
}