From d3d1827c054e50e68e1a7113f5f3e880ad6cbf83 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 21 Sep 2023 11:05:04 +0200 Subject: [PATCH] Use local isCgroup2UnifiedMode consistently This change switches to using isCgroup2UnifiedMode locally to ensure that any mocked function is also used when checking the swap controller availability. Signed-off-by: Evan Lezar --- pkg/kubelet/kuberuntime/kuberuntime_container_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container_linux.go b/pkg/kubelet/kuberuntime/kuberuntime_container_linux.go index c76389c0d9f..7cb8d79b3e9 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container_linux.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container_linux.go @@ -320,7 +320,7 @@ func swapControllerAvailable() bool { swapControllerAvailabilityOnce.Do(func() { const warn = "Failed to detect the availability of the swap controller, assuming not available" p := "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes" - if libcontainercgroups.IsCgroup2UnifiedMode() { + if isCgroup2UnifiedMode() { // memory.swap.max does not exist in the cgroup root, so we check /sys/fs/cgroup//memory.swap.max _, unified, err := cgroups.ParseCgroupFileUnified("/proc/self/cgroup") if err != nil {