Skip to content

Commit

Permalink
Change default cgroup driver to systemd (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayoz committed Sep 11, 2024
1 parent 98f396e commit 898cce0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/k8s/pkg/k8sd/setup/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func defaultContainerdConfig(
"runtimes": map[string]any{
"runc": map[string]any{
"runtime_type": "io.containerd.runc.v2",
"options": map[string]any{
"SystemdCgroup": true,
},
},
},
},
Expand Down
1 change: 1 addition & 0 deletions src/k8s/pkg/k8sd/setup/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func kubelet(snap snap.Snap, hostname string, nodeIP net.IP, clusterDNS string,
"--client-ca-file": filepath.Join(snap.KubernetesPKIDir(), "client-ca.crt"),
"--container-runtime-endpoint": filepath.Join(snap.ContainerdSocketDir(), "containerd.sock"),
"--containerd": filepath.Join(snap.ContainerdSocketDir(), "containerd.sock"),
"--cgroup-driver": "systemd",
"--eviction-hard": "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'",
"--fail-swap-on": "false",
"--kubeconfig": filepath.Join(snap.KubernetesConfigDir(), "kubelet.conf"),
Expand Down
6 changes: 6 additions & 0 deletions src/k8s/pkg/k8sd/setup/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down Expand Up @@ -116,6 +117,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down Expand Up @@ -173,6 +175,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down Expand Up @@ -221,6 +224,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down Expand Up @@ -278,6 +282,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down Expand Up @@ -334,6 +339,7 @@ func TestKubelet(t *testing.T) {
{key: "--client-ca-file", expectedVal: filepath.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--container-runtime-endpoint", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: filepath.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--cgroup-driver", expectedVal: "systemd"},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
Expand Down

0 comments on commit 898cce0

Please sign in to comment.