mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	update cadvisor dependency to v0.35.0
This commit is contained in:
		
							
								
								
									
										1
									
								
								vendor/github.com/google/cadvisor/container/common/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/google/cadvisor/container/common/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -17,6 +17,7 @@ go_library( | ||||
|         "//vendor/github.com/google/cadvisor/info/v1:go_default_library", | ||||
|         "//vendor/github.com/google/cadvisor/utils:go_default_library", | ||||
|         "//vendor/github.com/karrick/godirwalk:go_default_library", | ||||
|         "//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library", | ||||
|         "//vendor/github.com/pkg/errors:go_default_library", | ||||
|         "//vendor/k8s.io/klog:go_default_library", | ||||
|         "//vendor/k8s.io/utils/inotify:go_default_library", | ||||
|   | ||||
							
								
								
									
										57
									
								
								vendor/github.com/google/cadvisor/container/common/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										57
									
								
								vendor/github.com/google/cadvisor/container/common/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -19,6 +19,7 @@ import ( | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"path" | ||||
| 	"path/filepath" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| @@ -27,6 +28,7 @@ import ( | ||||
| 	info "github.com/google/cadvisor/info/v1" | ||||
| 	"github.com/google/cadvisor/utils" | ||||
| 	"github.com/karrick/godirwalk" | ||||
| 	"github.com/opencontainers/runc/libcontainer/cgroups" | ||||
| 	"github.com/pkg/errors" | ||||
|  | ||||
| 	"k8s.io/klog" | ||||
| @@ -47,6 +49,25 @@ func DebugInfo(watches map[string][]string) map[string][]string { | ||||
| 	return out | ||||
| } | ||||
|  | ||||
| // findFileInAncestorDir returns the path to the parent directory that contains the specified file. | ||||
| // "" is returned if the lookup reaches the limit. | ||||
| func findFileInAncestorDir(current, file, limit string) (string, error) { | ||||
| 	for { | ||||
| 		fpath := path.Join(current, file) | ||||
| 		_, err := os.Stat(fpath) | ||||
| 		if err == nil { | ||||
| 			return current, nil | ||||
| 		} | ||||
| 		if !os.IsNotExist(err) { | ||||
| 			return "", err | ||||
| 		} | ||||
| 		if current == limit { | ||||
| 			return "", nil | ||||
| 		} | ||||
| 		current = filepath.Dir(current) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoFactory, hasNetwork, hasFilesystem bool) (info.ContainerSpec, error) { | ||||
| 	var spec info.ContainerSpec | ||||
|  | ||||
| @@ -100,7 +121,12 @@ func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoF | ||||
| 	if ok { | ||||
| 		if utils.FileExists(cpusetRoot) { | ||||
| 			spec.HasCpu = true | ||||
| 			mask := readString(cpusetRoot, "cpuset.cpus") | ||||
| 			mask := "" | ||||
| 			if cgroups.IsCgroup2UnifiedMode() { | ||||
| 				mask = readString(cpusetRoot, "cpuset.cpus.effective") | ||||
| 			} else { | ||||
| 				mask = readString(cpusetRoot, "cpuset.cpus") | ||||
| 			} | ||||
| 			spec.Cpu.Mask = utils.FixCpuMask(mask, mi.NumCores) | ||||
| 		} | ||||
| 	} | ||||
| @@ -108,11 +134,24 @@ func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoF | ||||
| 	// Memory | ||||
| 	memoryRoot, ok := cgroupPaths["memory"] | ||||
| 	if ok { | ||||
| 		if utils.FileExists(memoryRoot) { | ||||
| 			spec.HasMemory = true | ||||
| 			spec.Memory.Limit = readUInt64(memoryRoot, "memory.limit_in_bytes") | ||||
| 			spec.Memory.SwapLimit = readUInt64(memoryRoot, "memory.memsw.limit_in_bytes") | ||||
| 			spec.Memory.Reservation = readUInt64(memoryRoot, "memory.soft_limit_in_bytes") | ||||
| 		if !cgroups.IsCgroup2UnifiedMode() { | ||||
| 			if utils.FileExists(memoryRoot) { | ||||
| 				spec.HasMemory = true | ||||
| 				spec.Memory.Limit = readUInt64(memoryRoot, "memory.limit_in_bytes") | ||||
| 				spec.Memory.SwapLimit = readUInt64(memoryRoot, "memory.memsw.limit_in_bytes") | ||||
| 				spec.Memory.Reservation = readUInt64(memoryRoot, "memory.soft_limit_in_bytes") | ||||
| 			} | ||||
| 		} else { | ||||
| 			memoryRoot, err := findFileInAncestorDir(memoryRoot, "memory.max", "/sys/fs/cgroup") | ||||
| 			if err != nil { | ||||
| 				return spec, err | ||||
| 			} | ||||
| 			if memoryRoot != "" { | ||||
| 				spec.HasMemory = true | ||||
| 				spec.Memory.Reservation = readUInt64(memoryRoot, "memory.high") | ||||
| 				spec.Memory.Limit = readUInt64(memoryRoot, "memory.max") | ||||
| 				spec.Memory.SwapLimit = readUInt64(memoryRoot, "memory.swap.max") | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -128,7 +167,11 @@ func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoF | ||||
| 	spec.HasNetwork = hasNetwork | ||||
| 	spec.HasFilesystem = hasFilesystem | ||||
|  | ||||
| 	if blkioRoot, ok := cgroupPaths["blkio"]; ok && utils.FileExists(blkioRoot) { | ||||
| 	ioControllerName := "blkio" | ||||
| 	if cgroups.IsCgroup2UnifiedMode() { | ||||
| 		ioControllerName = "io" | ||||
| 	} | ||||
| 	if blkioRoot, ok := cgroupPaths[ioControllerName]; ok && utils.FileExists(blkioRoot) { | ||||
| 		spec.HasDiskIo = true | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/google/cadvisor/container/container.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/google/cadvisor/container/container.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -32,7 +32,6 @@ type ContainerType int | ||||
| const ( | ||||
| 	ContainerTypeRaw ContainerType = iota | ||||
| 	ContainerTypeDocker | ||||
| 	ContainerTypeRkt | ||||
| 	ContainerTypeSystemd | ||||
| 	ContainerTypeCrio | ||||
| 	ContainerTypeContainerd | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -47,6 +47,7 @@ func GetCgroupSubsystems(includedMetrics container.MetricSet) (CgroupSubsystems, | ||||
| 	//currently we only support disable blkio subsystem | ||||
| 	if !includedMetrics.Has(container.DiskIOMetrics) { | ||||
| 		disableCgroups["blkio"] = struct{}{} | ||||
| 		disableCgroups["io"] = struct{}{} | ||||
| 	} | ||||
| 	return getCgroupSubsystemsHelper(allCgroups, disableCgroups) | ||||
| } | ||||
| @@ -109,6 +110,7 @@ var supportedSubsystems map[string]struct{} = map[string]struct{}{ | ||||
| 	"pids":    {}, | ||||
| 	"cpuset":  {}, | ||||
| 	"blkio":   {}, | ||||
| 	"io":      {}, | ||||
| 	"devices": {}, | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										40
									
								
								vendor/github.com/google/cadvisor/fs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								vendor/github.com/google/cadvisor/fs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -41,7 +41,6 @@ import ( | ||||
| const ( | ||||
| 	LabelSystemRoot   = "root" | ||||
| 	LabelDockerImages = "docker-images" | ||||
| 	LabelRktImages    = "rkt-images" | ||||
| 	LabelCrioImages   = "crio-images" | ||||
| ) | ||||
|  | ||||
| @@ -118,7 +117,6 @@ func NewFsInfo(context Context) (FsInfo, error) { | ||||
| 		fsInfo.mounts[mount.Mountpoint] = mount | ||||
| 	} | ||||
|  | ||||
| 	fsInfo.addRktImagesLabel(context, mounts) | ||||
| 	// need to call this before the log line below printing out the partitions, as this function may | ||||
| 	// add a "partition" for devicemapper to fsInfo.partitions | ||||
| 	fsInfo.addDockerImagesLabel(context, mounts) | ||||
| @@ -167,19 +165,22 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma | ||||
|  | ||||
| 	supportedFsType := map[string]bool{ | ||||
| 		// all ext systems are checked through prefix. | ||||
| 		"btrfs": true, | ||||
| 		"tmpfs": true, | ||||
| 		"xfs":   true, | ||||
| 		"zfs":   true, | ||||
| 		"btrfs":   true, | ||||
| 		"overlay": true, | ||||
| 		"tmpfs":   true, | ||||
| 		"xfs":     true, | ||||
| 		"zfs":     true, | ||||
| 	} | ||||
|  | ||||
| 	for _, mount := range mounts { | ||||
| 		if !strings.HasPrefix(mount.Fstype, "ext") && !supportedFsType[mount.Fstype] { | ||||
| 			continue | ||||
| 		} | ||||
| 		// Avoid bind mounts. | ||||
| 		// Avoid bind mounts, exclude tmpfs. | ||||
| 		if _, ok := partitions[mount.Source]; ok { | ||||
| 			continue | ||||
| 			if mount.Fstype != "tmpfs" { | ||||
| 				continue | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		hasPrefix := false | ||||
| @@ -193,6 +194,10 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		// using mountpoint to replace device once fstype it tmpfs | ||||
| 		if mount.Fstype == "tmpfs" { | ||||
| 			mount.Source = mount.Mountpoint | ||||
| 		} | ||||
| 		// btrfs fix: following workaround fixes wrong btrfs Major and Minor Ids reported in /proc/self/mountinfo. | ||||
| 		// instead of using values from /proc/self/mountinfo we use stat to get Ids from btrfs mount point | ||||
| 		if mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") { | ||||
| @@ -205,6 +210,11 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// overlay fix: Making mount source unique for all overlay mounts, using the mount's major and minor ids. | ||||
| 		if mount.Fstype == "overlay" { | ||||
| 			mount.Source = fmt.Sprintf("%s_%d-%d", mount.Source, mount.Major, mount.Minor) | ||||
| 		} | ||||
|  | ||||
| 		partitions[mount.Source] = partition{ | ||||
| 			fsType:     mount.Fstype, | ||||
| 			mountpoint: mount.Mountpoint, | ||||
| @@ -290,20 +300,6 @@ func (self *RealFsInfo) addCrioImagesLabel(context Context, mounts []*mount.Info | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *RealFsInfo) addRktImagesLabel(context Context, mounts []*mount.Info) { | ||||
| 	if context.RktPath != "" { | ||||
| 		rktPath := context.RktPath | ||||
| 		rktImagesPaths := map[string]struct{}{ | ||||
| 			"/": {}, | ||||
| 		} | ||||
| 		for rktPath != "/" && rktPath != "." { | ||||
| 			rktImagesPaths[rktPath] = struct{}{} | ||||
| 			rktPath = filepath.Dir(rktPath) | ||||
| 		} | ||||
| 		self.updateContainerImagesPath(LabelRktImages, mounts, rktImagesPaths) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Generate a list of possible mount points for docker image management from the docker root directory. | ||||
| // Right now, we look for each type of supported graph driver directories, but we can do better by parsing | ||||
| // some of the context from `docker info`. | ||||
|   | ||||
							
								
								
									
										5
									
								
								vendor/github.com/google/cadvisor/fs/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/google/cadvisor/fs/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -20,9 +20,8 @@ import ( | ||||
|  | ||||
| type Context struct { | ||||
| 	// docker root directory. | ||||
| 	Docker  DockerContext | ||||
| 	RktPath string | ||||
| 	Crio    CrioContext | ||||
| 	Docker DockerContext | ||||
| 	Crio   CrioContext | ||||
| } | ||||
|  | ||||
| type DockerContext struct { | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/github.com/google/cadvisor/info/v1/machine.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/google/cadvisor/info/v1/machine.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -38,9 +38,10 @@ type FsInfo struct { | ||||
| type Node struct { | ||||
| 	Id int `json:"node_id"` | ||||
| 	// Per-node memory | ||||
| 	Memory uint64  `json:"memory"` | ||||
| 	Cores  []Core  `json:"cores"` | ||||
| 	Caches []Cache `json:"caches"` | ||||
| 	Memory    uint64          `json:"memory"` | ||||
| 	HugePages []HugePagesInfo `json:"hugepages"` | ||||
| 	Cores     []Core          `json:"cores"` | ||||
| 	Caches    []Cache         `json:"caches"` | ||||
| } | ||||
|  | ||||
| type Core struct { | ||||
|   | ||||
							
								
								
									
										46
									
								
								vendor/github.com/google/cadvisor/machine/info.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										46
									
								
								vendor/github.com/google/cadvisor/machine/info.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -17,10 +17,8 @@ package machine | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"flag" | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"path/filepath" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/docker/docker/pkg/parsers/operatingsystem" | ||||
| @@ -54,45 +52,6 @@ func getInfoFromFiles(filePaths string) string { | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| // GetHugePagesInfo returns information about pre-allocated huge pages | ||||
| func GetHugePagesInfo() ([]info.HugePagesInfo, error) { | ||||
| 	var hugePagesInfo []info.HugePagesInfo | ||||
| 	files, err := ioutil.ReadDir(hugepagesDirectory) | ||||
| 	if err != nil { | ||||
| 		// treat as non-fatal since kernels and machine can be | ||||
| 		// configured to disable hugepage support | ||||
| 		return hugePagesInfo, nil | ||||
| 	} | ||||
| 	for _, st := range files { | ||||
| 		nameArray := strings.Split(st.Name(), "-") | ||||
| 		pageSizeArray := strings.Split(nameArray[1], "kB") | ||||
| 		pageSize, err := strconv.ParseUint(string(pageSizeArray[0]), 10, 64) | ||||
| 		if err != nil { | ||||
| 			return hugePagesInfo, err | ||||
| 		} | ||||
|  | ||||
| 		numFile := hugepagesDirectory + st.Name() + "/nr_hugepages" | ||||
| 		val, err := ioutil.ReadFile(numFile) | ||||
| 		if err != nil { | ||||
| 			return hugePagesInfo, err | ||||
| 		} | ||||
| 		var numPages uint64 | ||||
| 		// we use sscanf as the file as a new-line that trips up ParseUint | ||||
| 		// it returns the number of tokens successfully parsed, so if | ||||
| 		// n != 1, it means we were unable to parse a number from the file | ||||
| 		n, err := fmt.Sscanf(string(val), "%d", &numPages) | ||||
| 		if err != nil || n != 1 { | ||||
| 			return hugePagesInfo, fmt.Errorf("could not parse file %v contents %q", numFile, string(val)) | ||||
| 		} | ||||
|  | ||||
| 		hugePagesInfo = append(hugePagesInfo, info.HugePagesInfo{ | ||||
| 			NumPages: numPages, | ||||
| 			PageSize: pageSize, | ||||
| 		}) | ||||
| 	} | ||||
| 	return hugePagesInfo, nil | ||||
| } | ||||
|  | ||||
| func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.MachineInfo, error) { | ||||
| 	rootFs := "/" | ||||
| 	if !inHostNamespace { | ||||
| @@ -100,6 +59,9 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach | ||||
| 	} | ||||
|  | ||||
| 	cpuinfo, err := ioutil.ReadFile(filepath.Join(rootFs, "/proc/cpuinfo")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	clockSpeed, err := GetClockSpeed(cpuinfo) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| @@ -110,7 +72,7 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	hugePagesInfo, err := GetHugePagesInfo() | ||||
| 	hugePagesInfo, err := GetHugePagesInfo(hugepagesDirectory) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										52
									
								
								vendor/github.com/google/cadvisor/machine/machine.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/google/cadvisor/machine/machine.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -23,6 +23,7 @@ import ( | ||||
| 	"regexp" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | ||||
| 	// s390/s390x changes | ||||
| 	"runtime" | ||||
|  | ||||
| @@ -49,6 +50,7 @@ var ( | ||||
|  | ||||
| const maxFreqFile = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" | ||||
| const cpuBusPath = "/sys/bus/cpu/devices/" | ||||
| const nodePath = "/sys/devices/system/node" | ||||
|  | ||||
| // GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file. | ||||
| func GetClockSpeed(procInfo []byte) (uint64, error) { | ||||
| @@ -191,6 +193,47 @@ func getNodeIdFromCpuBus(cpuBusPath string, threadId int) (int, error) { | ||||
| 	return nodeId, nil | ||||
| } | ||||
|  | ||||
| // GetHugePagesInfo returns information about pre-allocated huge pages | ||||
| // hugepagesDirectory should be top directory of hugepages | ||||
| // Such as: /sys/kernel/mm/hugepages/ | ||||
| func GetHugePagesInfo(hugepagesDirectory string) ([]info.HugePagesInfo, error) { | ||||
| 	var hugePagesInfo []info.HugePagesInfo | ||||
| 	files, err := ioutil.ReadDir(hugepagesDirectory) | ||||
| 	if err != nil { | ||||
| 		// treat as non-fatal since kernels and machine can be | ||||
| 		// configured to disable hugepage support | ||||
| 		return hugePagesInfo, nil | ||||
| 	} | ||||
| 	for _, st := range files { | ||||
| 		nameArray := strings.Split(st.Name(), "-") | ||||
| 		pageSizeArray := strings.Split(nameArray[1], "kB") | ||||
| 		pageSize, err := strconv.ParseUint(string(pageSizeArray[0]), 10, 64) | ||||
| 		if err != nil { | ||||
| 			return hugePagesInfo, err | ||||
| 		} | ||||
|  | ||||
| 		numFile := hugepagesDirectory + st.Name() + "/nr_hugepages" | ||||
| 		val, err := ioutil.ReadFile(numFile) | ||||
| 		if err != nil { | ||||
| 			return hugePagesInfo, err | ||||
| 		} | ||||
| 		var numPages uint64 | ||||
| 		// we use sscanf as the file as a new-line that trips up ParseUint | ||||
| 		// it returns the number of tokens successfully parsed, so if | ||||
| 		// n != 1, it means we were unable to parse a number from the file | ||||
| 		n, err := fmt.Sscanf(string(val), "%d", &numPages) | ||||
| 		if err != nil || n != 1 { | ||||
| 			return hugePagesInfo, fmt.Errorf("could not parse file %v contents %q", numFile, string(val)) | ||||
| 		} | ||||
|  | ||||
| 		hugePagesInfo = append(hugePagesInfo, info.HugePagesInfo{ | ||||
| 			NumPages: numPages, | ||||
| 			PageSize: pageSize, | ||||
| 		}) | ||||
| 	} | ||||
| 	return hugePagesInfo, nil | ||||
| } | ||||
|  | ||||
| func GetTopology(sysFs sysfs.SysFs, cpuinfo string) ([]info.Node, int, error) { | ||||
| 	nodes := []info.Node{} | ||||
|  | ||||
| @@ -352,6 +395,15 @@ func addNode(nodes *[]info.Node, id int) (int, error) { | ||||
| 			} | ||||
| 			node.Memory = uint64(m) | ||||
| 		} | ||||
| 		// Look for per-node hugepages info using node id | ||||
| 		// Such as: /sys/devices/system/node/node%d/hugepages | ||||
| 		hugepagesDirectory := fmt.Sprintf("%s/node%d/hugepages/", nodePath, id) | ||||
| 		hugePagesInfo, err := GetHugePagesInfo(hugepagesDirectory) | ||||
| 		if err != nil { | ||||
| 			return -1, err | ||||
| 		} | ||||
| 		node.HugePages = hugePagesInfo | ||||
|  | ||||
| 		*nodes = append(*nodes, node) | ||||
| 		idx = len(*nodes) - 1 | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										3
									
								
								vendor/github.com/google/cadvisor/manager/container.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/google/cadvisor/manager/container.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -185,6 +185,9 @@ func (c *containerData) getCgroupPath(cgroups string) (string, error) { | ||||
| 	if cgroups == "-" { | ||||
| 		return "/", nil | ||||
| 	} | ||||
| 	if strings.HasPrefix(cgroups, "0::") { | ||||
| 		return cgroups[3:], nil | ||||
| 	} | ||||
| 	matches := cgroupPathRegExp.FindSubmatch([]byte(cgroups)) | ||||
| 	if len(matches) != 2 { | ||||
| 		klog.V(3).Infof("failed to get memory cgroup path from %q", cgroups) | ||||
|   | ||||
							
								
								
									
										17
									
								
								vendor/github.com/google/cadvisor/manager/manager.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/google/cadvisor/manager/manager.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -918,13 +918,15 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	devicesCgroupPath, err := handler.GetCgroupPath("devices") | ||||
| 	if err != nil { | ||||
| 		klog.Warningf("Error getting devices cgroup path: %v", err) | ||||
| 	} else { | ||||
| 		cont.nvidiaCollector, err = m.nvidiaManager.GetCollector(devicesCgroupPath) | ||||
| 	if !cgroups.IsCgroup2UnifiedMode() { | ||||
| 		devicesCgroupPath, err := handler.GetCgroupPath("devices") | ||||
| 		if err != nil { | ||||
| 			klog.V(4).Infof("GPU metrics may be unavailable/incomplete for container %q: %v", cont.info.Name, err) | ||||
| 			klog.Warningf("Error getting devices cgroup path: %v", err) | ||||
| 		} else { | ||||
| 			cont.nvidiaCollector, err = m.nvidiaManager.GetCollector(devicesCgroupPath) | ||||
| 			if err != nil { | ||||
| 				klog.V(4).Infof("GPU metrics may be unavailable/incomplete for container %q: %v", cont.info.Name, err) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -1119,9 +1121,6 @@ func (self *manager) watchForNewContainers(quit chan error) error { | ||||
| 				switch { | ||||
| 				case event.EventType == watcher.ContainerAdd: | ||||
| 					switch event.WatchSource { | ||||
| 					// the Rkt and Raw watchers can race, and if Raw wins, we want Rkt to override and create a new handler for Rkt containers | ||||
| 					case watcher.Rkt: | ||||
| 						err = self.overrideContainer(event.Name, event.WatchSource) | ||||
| 					default: | ||||
| 						err = self.createContainer(event.Name, event.WatchSource) | ||||
| 					} | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/google/cadvisor/utils/cpuload/netlink/reader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/google/cadvisor/utils/cpuload/netlink/reader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -66,10 +66,10 @@ func (self *NetlinkReader) GetCpuLoad(name string, path string) (info.LoadStats, | ||||
| 	} | ||||
|  | ||||
| 	cfd, err := os.Open(path) | ||||
| 	defer cfd.Close() | ||||
| 	if err != nil { | ||||
| 		return info.LoadStats{}, fmt.Errorf("failed to open cgroup path %s: %q", path, err) | ||||
| 	} | ||||
| 	defer cfd.Close() | ||||
|  | ||||
| 	stats, err := getLoadStats(self.familyId, cfd, self.conn) | ||||
| 	if err != nil { | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/google/cadvisor/watcher/watcher.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/google/cadvisor/watcher/watcher.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -28,7 +28,6 @@ type ContainerWatchSource int | ||||
|  | ||||
| const ( | ||||
| 	Raw ContainerWatchSource = iota | ||||
| 	Rkt | ||||
| ) | ||||
|  | ||||
| // ContainerEvent represents a | ||||
|   | ||||
		Reference in New Issue
	
	Block a user