mirror of https://github.com/kubernetes/kops.git
Merge pull request #15111 from hakman/containerd_config_path
Switch contained config file path to `/etc/containerd/config.toml`
This commit is contained in:
commit
90967ce4ae
|
|
@ -55,7 +55,9 @@ error is encountered while updating an InstanceGroup.
|
||||||
|
|
||||||
# Other changes of note
|
# Other changes of note
|
||||||
|
|
||||||
* Add unreachable route for pod IP on deletion option in Cilium.
|
* containerd config is now written to `/etc/containerd/config.toml`.
|
||||||
|
|
||||||
|
* Cilium can be configured to add unreachable route for pod IP on deletion.
|
||||||
|
|
||||||
# Breaking changes
|
# Breaking changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ import (
|
||||||
"k8s.io/kops/util/pkg/distributions"
|
"k8s.io/kops/util/pkg/distributions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const containerdConfigFilePath = "/etc/containerd/config.toml"
|
||||||
|
|
||||||
// ContainerdBuilder install containerd (just the packages at the moment)
|
// ContainerdBuilder install containerd (just the packages at the moment)
|
||||||
type ContainerdBuilder struct {
|
type ContainerdBuilder struct {
|
||||||
*NodeupModelContext
|
*NodeupModelContext
|
||||||
|
|
@ -203,7 +205,7 @@ func (b *ContainerdBuilder) buildSystemdService(sv semver.Version) *nodetasks.Se
|
||||||
manifest.Set("Service", "EnvironmentFile", "/etc/sysconfig/containerd")
|
manifest.Set("Service", "EnvironmentFile", "/etc/sysconfig/containerd")
|
||||||
manifest.Set("Service", "EnvironmentFile", "/etc/environment")
|
manifest.Set("Service", "EnvironmentFile", "/etc/environment")
|
||||||
manifest.Set("Service", "ExecStartPre", "-/sbin/modprobe overlay")
|
manifest.Set("Service", "ExecStartPre", "-/sbin/modprobe overlay")
|
||||||
manifest.Set("Service", "ExecStart", "/usr/bin/containerd -c "+b.containerdConfigFilePath()+" \"$CONTAINERD_OPTS\"")
|
manifest.Set("Service", "ExecStart", "/usr/bin/containerd -c "+containerdConfigFilePath+" \"$CONTAINERD_OPTS\"")
|
||||||
|
|
||||||
// notify the daemon's readiness to systemd
|
// notify the daemon's readiness to systemd
|
||||||
if (b.NodeupConfig.ContainerRuntime == "containerd" && sv.GTE(semver.MustParse("1.3.4"))) || sv.GTE(semver.MustParse("19.3.13")) {
|
if (b.NodeupConfig.ContainerRuntime == "containerd" && sv.GTE(semver.MustParse("1.3.4"))) || sv.GTE(semver.MustParse("19.3.13")) {
|
||||||
|
|
@ -248,18 +250,6 @@ func (b *ContainerdBuilder) buildSystemdService(sv semver.Version) *nodetasks.Se
|
||||||
return service
|
return service
|
||||||
}
|
}
|
||||||
|
|
||||||
// containerdConfigFilePath returns the path we use for the containerd config file
|
|
||||||
// We normally use a different path for clarity, but on some OSes we can't override the path.
|
|
||||||
// TODO: Should we just use config.toml everywhere?
|
|
||||||
func (b *ContainerdBuilder) containerdConfigFilePath() string {
|
|
||||||
switch b.Distribution {
|
|
||||||
case distributions.DistributionContainerOS:
|
|
||||||
return "/etc/containerd/config.toml"
|
|
||||||
default:
|
|
||||||
return "/etc/containerd/config-kops.toml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildSystemdServiceOverrideContainerOS is responsible for overriding the containerd service for ContainerOS
|
// buildSystemdServiceOverrideContainerOS is responsible for overriding the containerd service for ContainerOS
|
||||||
func (b *ContainerdBuilder) buildSystemdServiceOverrideContainerOS(c *fi.NodeupModelBuilderContext) {
|
func (b *ContainerdBuilder) buildSystemdServiceOverrideContainerOS(c *fi.NodeupModelBuilderContext) {
|
||||||
lines := []string{
|
lines := []string{
|
||||||
|
|
@ -273,7 +263,7 @@ func (b *ContainerdBuilder) buildSystemdServiceOverrideContainerOS(c *fi.NodeupM
|
||||||
Path: "/etc/systemd/system/containerd.service.d/10-kops.conf",
|
Path: "/etc/systemd/system/containerd.service.d/10-kops.conf",
|
||||||
Contents: fi.NewStringResource(contents),
|
Contents: fi.NewStringResource(contents),
|
||||||
Type: nodetasks.FileType_File,
|
Type: nodetasks.FileType_File,
|
||||||
AfterFiles: []string{b.containerdConfigFilePath()},
|
AfterFiles: []string{containerdConfigFilePath},
|
||||||
OnChangeExecute: [][]string{
|
OnChangeExecute: [][]string{
|
||||||
{"systemctl", "daemon-reload"},
|
{"systemctl", "daemon-reload"},
|
||||||
{"systemctl", "restart", "containerd.service"},
|
{"systemctl", "restart", "containerd.service"},
|
||||||
|
|
@ -292,7 +282,7 @@ func (b *ContainerdBuilder) buildSystemdServiceOverrideFlatcar(c *fi.NodeupModel
|
||||||
"[Service]",
|
"[Service]",
|
||||||
"EnvironmentFile=/etc/environment",
|
"EnvironmentFile=/etc/environment",
|
||||||
"ExecStart=",
|
"ExecStart=",
|
||||||
"ExecStart=/usr/bin/containerd --config " + b.containerdConfigFilePath(),
|
"ExecStart=/usr/bin/containerd --config " + containerdConfigFilePath,
|
||||||
}
|
}
|
||||||
contents := strings.Join(lines, "\n")
|
contents := strings.Join(lines, "\n")
|
||||||
|
|
||||||
|
|
@ -300,7 +290,7 @@ func (b *ContainerdBuilder) buildSystemdServiceOverrideFlatcar(c *fi.NodeupModel
|
||||||
Path: "/etc/systemd/system/containerd.service.d/10-kops.conf",
|
Path: "/etc/systemd/system/containerd.service.d/10-kops.conf",
|
||||||
Contents: fi.NewStringResource(contents),
|
Contents: fi.NewStringResource(contents),
|
||||||
Type: nodetasks.FileType_File,
|
Type: nodetasks.FileType_File,
|
||||||
AfterFiles: []string{b.containerdConfigFilePath()},
|
AfterFiles: []string{containerdConfigFilePath},
|
||||||
OnChangeExecute: [][]string{
|
OnChangeExecute: [][]string{
|
||||||
{"systemctl", "daemon-reload"},
|
{"systemctl", "daemon-reload"},
|
||||||
{"systemctl", "restart", "containerd.service"},
|
{"systemctl", "restart", "containerd.service"},
|
||||||
|
|
@ -353,7 +343,7 @@ func (b *ContainerdBuilder) buildConfigFile(c *fi.NodeupModelBuilderContext) err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.AddTask(&nodetasks.File{
|
c.AddTask(&nodetasks.File{
|
||||||
Path: b.containerdConfigFilePath(),
|
Path: containerdConfigFilePath,
|
||||||
Contents: fi.NewStringResource(config),
|
Contents: fi.NewStringResource(config),
|
||||||
Type: nodetasks.FileType_File,
|
Type: nodetasks.FileType_File,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,16 @@ contents: |
|
||||||
|
|
||||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||||
SystemdCgroup = true
|
SystemdCgroup = true
|
||||||
path: /etc/containerd/config-kops.toml
|
path: /etc/containerd/config.toml
|
||||||
type: file
|
type: file
|
||||||
---
|
---
|
||||||
afterFiles:
|
afterFiles:
|
||||||
- /etc/containerd/config-kops.toml
|
- /etc/containerd/config.toml
|
||||||
contents: |-
|
contents: |-
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/etc/environment
|
EnvironmentFile=/etc/environment
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=/usr/bin/containerd --config /etc/containerd/config-kops.toml
|
ExecStart=/usr/bin/containerd --config /etc/containerd/config.toml
|
||||||
onChangeExecute:
|
onChangeExecute:
|
||||||
- - systemctl
|
- - systemctl
|
||||||
- daemon-reload
|
- daemon-reload
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
contents: |
|
contents: |
|
||||||
disabled_plugins = ["cri"]
|
disabled_plugins = ["cri"]
|
||||||
path: /etc/containerd/config-kops.toml
|
path: /etc/containerd/config.toml
|
||||||
type: file
|
type: file
|
||||||
---
|
---
|
||||||
contents: CONTAINERD_OPTS=--log-level=info
|
contents: CONTAINERD_OPTS=--log-level=info
|
||||||
|
|
@ -214,7 +214,7 @@ definition: |
|
||||||
EnvironmentFile=/etc/sysconfig/containerd
|
EnvironmentFile=/etc/sysconfig/containerd
|
||||||
EnvironmentFile=/etc/environment
|
EnvironmentFile=/etc/environment
|
||||||
ExecStartPre=-/sbin/modprobe overlay
|
ExecStartPre=-/sbin/modprobe overlay
|
||||||
ExecStart=/usr/bin/containerd -c /etc/containerd/config-kops.toml "$CONTAINERD_OPTS"
|
ExecStart=/usr/bin/containerd -c /etc/containerd/config.toml "$CONTAINERD_OPTS"
|
||||||
Delegate=yes
|
Delegate=yes
|
||||||
KillMode=process
|
KillMode=process
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
contents: |
|
contents: |
|
||||||
disabled_plugins = ["cri"]
|
disabled_plugins = ["cri"]
|
||||||
path: /etc/containerd/config-kops.toml
|
path: /etc/containerd/config.toml
|
||||||
type: file
|
type: file
|
||||||
---
|
---
|
||||||
contents: CONTAINERD_OPTS=--log-level=info
|
contents: CONTAINERD_OPTS=--log-level=info
|
||||||
|
|
@ -214,7 +214,7 @@ definition: |
|
||||||
EnvironmentFile=/etc/sysconfig/containerd
|
EnvironmentFile=/etc/sysconfig/containerd
|
||||||
EnvironmentFile=/etc/environment
|
EnvironmentFile=/etc/environment
|
||||||
ExecStartPre=-/sbin/modprobe overlay
|
ExecStartPre=-/sbin/modprobe overlay
|
||||||
ExecStart=/usr/bin/containerd -c /etc/containerd/config-kops.toml "$CONTAINERD_OPTS"
|
ExecStart=/usr/bin/containerd -c /etc/containerd/config.toml "$CONTAINERD_OPTS"
|
||||||
Type=notify
|
Type=notify
|
||||||
Delegate=yes
|
Delegate=yes
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ contents: |
|
||||||
|
|
||||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||||
SystemdCgroup = true
|
SystemdCgroup = true
|
||||||
path: /etc/containerd/config-kops.toml
|
path: /etc/containerd/config.toml
|
||||||
type: file
|
type: file
|
||||||
---
|
---
|
||||||
contents: |2
|
contents: |2
|
||||||
|
|
@ -347,7 +347,7 @@ definition: |
|
||||||
EnvironmentFile=/etc/sysconfig/containerd
|
EnvironmentFile=/etc/sysconfig/containerd
|
||||||
EnvironmentFile=/etc/environment
|
EnvironmentFile=/etc/environment
|
||||||
ExecStartPre=-/sbin/modprobe overlay
|
ExecStartPre=-/sbin/modprobe overlay
|
||||||
ExecStart=/usr/bin/containerd -c /etc/containerd/config-kops.toml "$CONTAINERD_OPTS"
|
ExecStart=/usr/bin/containerd -c /etc/containerd/config.toml "$CONTAINERD_OPTS"
|
||||||
Type=notify
|
Type=notify
|
||||||
Delegate=yes
|
Delegate=yes
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue