From 89a4d4b0717bd4d8e9e1936a8318885111d09cd8 Mon Sep 17 00:00:00 2001 From: Kenta Tada Date: Mon, 13 Apr 2020 22:20:31 +0900 Subject: [PATCH] kubelet: modify the function of getCgroupSubsystemsV2 to use libcontainer API --- pkg/kubelet/cm/helpers_linux.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/kubelet/cm/helpers_linux.go b/pkg/kubelet/cm/helpers_linux.go index aa5c37639dc..49c1d8ec979 100644 --- a/pkg/kubelet/cm/helpers_linux.go +++ b/pkg/kubelet/cm/helpers_linux.go @@ -19,11 +19,9 @@ package cm import ( "bufio" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" - "strings" libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups" @@ -222,13 +220,12 @@ func getCgroupSubsystemsV1() (*CgroupSubsystems, error) { // getCgroupSubsystemsV2 returns information about the enabled cgroup v2 subsystems func getCgroupSubsystemsV2() (*CgroupSubsystems, error) { - content, err := ioutil.ReadFile(filepath.Join(util.CgroupRoot, "cgroup.controllers")) + controllers, err := libcontainercgroups.GetAllSubsystems() if err != nil { return nil, err } mounts := []libcontainercgroups.Mount{} - controllers := strings.Fields(string(content)) mountPoints := make(map[string]string, len(controllers)) for _, controller := range controllers { mountPoints[controller] = util.CgroupRoot