mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
kubelet: modify the function of getCgroupSubsystemsV2 to use libcontainer API
This commit is contained in:
parent
b0010c2d9e
commit
89a4d4b071
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user