Add containerd snapshotter flag (#1991)

* Add containerd snapshotter flag

Signed-off-by: Jason-ZW <zhenyang@rancher.com>

* Fix CamelCase nit and option description

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Jason-ZW <zhenyang@rancher.com>

Co-authored-by: Brad Davidson <brad@oatmail.org>
This commit is contained in:
Jason 2020-07-18 07:16:23 +08:00 committed by GitHub
parent 206accbe8d
commit e3f8789114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View File

@ -423,6 +423,7 @@ func get(envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
nodeConfig.AgentConfig.RootDir = filepath.Join(envInfo.DataDir, "kubelet")
}
nodeConfig.AgentConfig.PauseImage = envInfo.PauseImage
nodeConfig.AgentConfig.Snapshotter = envInfo.Snapshotter
nodeConfig.AgentConfig.IPSECPSK = controlConfig.IPSECPSK
nodeConfig.AgentConfig.StrongSwanDir = filepath.Join(envInfo.DataDir, "strongswan")
nodeConfig.CACerts = info.CACerts

View File

@ -33,6 +33,11 @@ const ContainerdConfigTemplate = `
sandbox_image = "{{ .NodeConfig.AgentConfig.PauseImage }}"
{{end}}
{{- if .NodeConfig.AgentConfig.Snapshotter }}
[plugins.cri.containerd]
snapshotter = "{{ .NodeConfig.AgentConfig.Snapshotter }}"
{{end}}
{{- if not .NodeConfig.NoFlannel }}
[plugins.cri.cni]
bin_dir = "{{ .NodeConfig.AgentConfig.CNIBinDir }}"

View File

@ -21,6 +21,7 @@ type Agent struct {
NodeExternalIP string
NodeName string
PauseImage string
Snapshotter string
Docker bool
ContainerRuntimeEndpoint string
NoFlannel bool
@ -90,6 +91,12 @@ var (
Destination: &AgentConfig.PauseImage,
Value: "docker.io/rancher/pause:3.1",
}
SnapshotterFlag = cli.StringFlag{
Name: "snapshotter",
Usage: "(agent/runtime) Override default containerd snapshotter",
Destination: &AgentConfig.Snapshotter,
Value: "overlayfs",
}
FlannelFlag = cli.BoolFlag{
Name: "no-flannel",
Usage: "(deprecated) use --flannel-backend=none",
@ -190,6 +197,7 @@ func NewAgentCommand(action func(ctx *cli.Context) error) *cli.Command {
&DisableSELinuxFlag,
&CRIEndpointFlag,
&PauseImageFlag,
&SnapshotterFlag,
&PrivateRegistryFlag,
&NodeIPFlag,
&NodeExternalIPFlag,

View File

@ -238,6 +238,7 @@ func NewServerCommand(action func(*cli.Context) error) *cli.Command {
&DisableSELinuxFlag,
&CRIEndpointFlag,
&PauseImageFlag,
&SnapshotterFlag,
&PrivateRegistryFlag,
&NodeIPFlag,
&NodeExternalIPFlag,

View File

@ -72,6 +72,7 @@ type Agent struct {
ExtraKubeletArgs []string
ExtraKubeProxyArgs []string
PauseImage string
Snapshotter string
CNIPlugin bool
NodeTaints []string
NodeLabels []string