mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #90112 from KentaTada/use-libcontainer-getcgroup-function
kubelet: modify the function of getCgroupSubsystemsV2 to use libconta…
This commit is contained in:
commit
6d27e234ba
@ -19,11 +19,9 @@ package cm
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups"
|
libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
|
|
||||||
@ -222,13 +220,12 @@ func getCgroupSubsystemsV1() (*CgroupSubsystems, error) {
|
|||||||
|
|
||||||
// getCgroupSubsystemsV2 returns information about the enabled cgroup v2 subsystems
|
// getCgroupSubsystemsV2 returns information about the enabled cgroup v2 subsystems
|
||||||
func getCgroupSubsystemsV2() (*CgroupSubsystems, error) {
|
func getCgroupSubsystemsV2() (*CgroupSubsystems, error) {
|
||||||
content, err := ioutil.ReadFile(filepath.Join(util.CgroupRoot, "cgroup.controllers"))
|
controllers, err := libcontainercgroups.GetAllSubsystems()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
mounts := []libcontainercgroups.Mount{}
|
mounts := []libcontainercgroups.Mount{}
|
||||||
controllers := strings.Fields(string(content))
|
|
||||||
mountPoints := make(map[string]string, len(controllers))
|
mountPoints := make(map[string]string, len(controllers))
|
||||||
for _, controller := range controllers {
|
for _, controller := range controllers {
|
||||||
mountPoints[controller] = util.CgroupRoot
|
mountPoints[controller] = util.CgroupRoot
|
||||||
|
Loading…
Reference in New Issue
Block a user