mirror of https://github.com/k3s-io/k3s
Merge pull request #65334 from dashpole/update_cadvisor_head
Automatic merge from submit-queue (batch tested with PRs 65290, 65326, 65289, 65334, 64860). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Update cadvisor godeps (master) to v0.30.2 **What this PR does / why we need it**: Update cadvisor godeps to v0.30.2. This is needed to fix a number of bugs. Normally, we wait to do this until the quarterly cAdvisor release, but we want to get some soak time on these bug fixes so that we know it is safe to cherry-pick them to previous releases: https://github.com/kubernetes/kubernetes/pull/65331 https://github.com/kubernetes/kubernetes/pull/65328 https://github.com/kubernetes/kubernetes/pull/65327 **Release note**: ```release-note Fix concurrent map access panic Don't watch .mount cgroups to reduce number of inotify watches Fix NVML initialization race condition Fix brtfs disk metrics when using a subdirectory of a subvolume ``` /kind bug /sig node /priority important-soon /assign @dchen1107 cc @yujuhong @mindprincepull/8/head
commit
98225e7d20
|
@ -1508,249 +1508,257 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/accelerators",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/api",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/cache/memory",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/client/v2",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/collector",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/common",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/containerd",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/crio",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/docker",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/libcontainer",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/raw",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/rkt",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/systemd",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/devicemapper",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/events",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/fs",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/healthz",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/http",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/http/mux",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v1",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v2",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/machine",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/raw",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/rkt",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/metrics",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/pages",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/pages/static",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/storage",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/summary",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cloudinfo",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload/netlink",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/docker",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/oomparser",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysfs",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysinfo",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/validate",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/version",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/zfs",
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
"Comment": "v0.30.2",
|
||||
"Rev": "de723a090f4dd5390dc7c2acee37ba9c62f0cc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/asn1",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/client",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/client/configpb",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/jsonclient",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/tls",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/x509",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go/x509/pkix",
|
||||
"Comment": "v1.0.10",
|
||||
"Rev": "1bec4527572c443752ad4f2830bef88be0533236"
|
||||
},
|
||||
{
|
||||
|
@ -1992,6 +2000,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/inconshreveable/mousetrap",
|
||||
"Comment": "v1.0",
|
||||
"Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
},
|
||||
{
|
||||
|
@ -2861,6 +2870,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/xiang90/probing",
|
||||
"Comment": "0.0.1",
|
||||
"Rev": "07dd2e8dfe18522e9c447ba95f2fe95262f63bb2"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -31,7 +31,10 @@ import (
|
|||
)
|
||||
|
||||
type NvidiaManager struct {
|
||||
sync.RWMutex
|
||||
sync.Mutex
|
||||
|
||||
// true if there are NVIDIA devices present on the node
|
||||
devicesPresent bool
|
||||
|
||||
// true if the NVML library (libnvidia-ml.so.1) was loaded successfully
|
||||
nvmlInitialized bool
|
||||
|
@ -51,20 +54,9 @@ func (nm *NvidiaManager) Setup() {
|
|||
return
|
||||
}
|
||||
|
||||
nm.initializeNVML()
|
||||
if nm.nvmlInitialized {
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
glog.V(2).Info("Starting goroutine to initialize NVML")
|
||||
// TODO: use globalHousekeepingInterval
|
||||
for range time.Tick(time.Minute) {
|
||||
nm.initializeNVML()
|
||||
if nm.nvmlInitialized {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
nm.devicesPresent = true
|
||||
|
||||
initializeNVML(nm)
|
||||
}
|
||||
|
||||
// detectDevices returns true if a device with given pci id is present on the node.
|
||||
|
@ -91,20 +83,18 @@ func detectDevices(vendorId string) bool {
|
|||
}
|
||||
|
||||
// initializeNVML initializes the NVML library and sets up the nvmlDevices map.
|
||||
func (nm *NvidiaManager) initializeNVML() {
|
||||
// This is defined as a variable to help in testing.
|
||||
var initializeNVML = func(nm *NvidiaManager) {
|
||||
if err := gonvml.Initialize(); err != nil {
|
||||
// This is under a logging level because otherwise we may cause
|
||||
// log spam if the drivers/nvml is not installed on the system.
|
||||
glog.V(4).Infof("Could not initialize NVML: %v", err)
|
||||
return
|
||||
}
|
||||
nm.nvmlInitialized = true
|
||||
numDevices, err := gonvml.DeviceCount()
|
||||
if err != nil {
|
||||
glog.Warningf("GPU metrics would not be available. Failed to get the number of nvidia devices: %v", err)
|
||||
nm.Lock()
|
||||
// Even though we won't have GPU metrics, the library was initialized and should be shutdown when exiting.
|
||||
nm.nvmlInitialized = true
|
||||
nm.Unlock()
|
||||
return
|
||||
}
|
||||
glog.V(1).Infof("NVML initialized. Number of nvidia devices: %v", numDevices)
|
||||
|
@ -122,10 +112,6 @@ func (nm *NvidiaManager) initializeNVML() {
|
|||
}
|
||||
nm.nvidiaDevices[int(minorNumber)] = device
|
||||
}
|
||||
nm.Lock()
|
||||
// Doing this at the end to avoid race in accessing nvidiaDevices in GetCollector.
|
||||
nm.nvmlInitialized = true
|
||||
nm.Unlock()
|
||||
}
|
||||
|
||||
// Destroy shuts down NVML.
|
||||
|
@ -139,12 +125,21 @@ func (nm *NvidiaManager) Destroy() {
|
|||
// present in the devices.list file in the given devicesCgroupPath.
|
||||
func (nm *NvidiaManager) GetCollector(devicesCgroupPath string) (AcceleratorCollector, error) {
|
||||
nc := &NvidiaCollector{}
|
||||
nm.RLock()
|
||||
if !nm.nvmlInitialized || len(nm.nvidiaDevices) == 0 {
|
||||
nm.RUnlock()
|
||||
|
||||
if !nm.devicesPresent {
|
||||
return nc, nil
|
||||
}
|
||||
nm.RUnlock()
|
||||
// Makes sure that we don't call initializeNVML() concurrently and
|
||||
// that we only call initializeNVML() when it's not initialized.
|
||||
nm.Lock()
|
||||
if !nm.nvmlInitialized {
|
||||
initializeNVML(nm)
|
||||
}
|
||||
if !nm.nvmlInitialized || len(nm.nvidiaDevices) == 0 {
|
||||
nm.Unlock()
|
||||
return nc, nil
|
||||
}
|
||||
nm.Unlock()
|
||||
nvidiaMinorNumbers, err := parseDevicesCgroup(devicesCgroupPath)
|
||||
if err != nil {
|
||||
return nc, err
|
||||
|
|
|
@ -65,9 +65,6 @@ type crioContainerHandler struct {
|
|||
|
||||
ignoreMetrics container.MetricSet
|
||||
|
||||
// container restart count
|
||||
restartCount int
|
||||
|
||||
reference info.ContainerReference
|
||||
|
||||
libcontainerHandler *containerlibcontainer.Handler
|
||||
|
@ -166,7 +163,10 @@ func newCrioContainerHandler(
|
|||
// ignore err and get zero as default, this happens with sandboxes, not sure why...
|
||||
// kube isn't sending restart count in labels for sandboxes.
|
||||
restartCount, _ := strconv.Atoi(cInfo.Annotations["io.kubernetes.container.restartCount"])
|
||||
handler.restartCount = restartCount
|
||||
// Only adds restartcount label if it's greater than 0
|
||||
if restartCount > 0 {
|
||||
handler.labels["restartcount"] = strconv.Itoa(restartCount)
|
||||
}
|
||||
|
||||
handler.ipAddress = cInfo.IP
|
||||
|
||||
|
@ -210,10 +210,6 @@ func (self *crioContainerHandler) GetSpec() (info.ContainerSpec, error) {
|
|||
spec, err := common.GetSpec(self.cgroupPaths, self.machineInfoFactory, self.needNet(), hasFilesystem)
|
||||
|
||||
spec.Labels = self.labels
|
||||
// Only adds restartcount label if it's greater than 0
|
||||
if self.restartCount > 0 {
|
||||
spec.Labels["restartcount"] = strconv.Itoa(self.restartCount)
|
||||
}
|
||||
spec.Envs = self.envs
|
||||
spec.Image = self.image
|
||||
|
||||
|
|
|
@ -91,9 +91,6 @@ type dockerContainerHandler struct {
|
|||
// zfsParent is the parent for docker zfs
|
||||
zfsParent string
|
||||
|
||||
// container restart count
|
||||
restartCount int
|
||||
|
||||
// Reference to the container
|
||||
reference info.ContainerReference
|
||||
|
||||
|
@ -226,7 +223,10 @@ func newDockerContainerHandler(
|
|||
}
|
||||
handler.image = ctnr.Config.Image
|
||||
handler.networkMode = ctnr.HostConfig.NetworkMode
|
||||
handler.restartCount = ctnr.RestartCount
|
||||
// Only adds restartcount label if it's greater than 0
|
||||
if ctnr.RestartCount > 0 {
|
||||
handler.labels["restartcount"] = strconv.Itoa(ctnr.RestartCount)
|
||||
}
|
||||
|
||||
// Obtain the IP address for the contianer.
|
||||
// If the NetworkMode starts with 'container:' then we need to use the IP address of the container specified.
|
||||
|
@ -356,10 +356,6 @@ func (self *dockerContainerHandler) GetSpec() (info.ContainerSpec, error) {
|
|||
spec, err := common.GetSpec(self.cgroupPaths, self.machineInfoFactory, self.needNet(), hasFilesystem)
|
||||
|
||||
spec.Labels = self.labels
|
||||
// Only adds restartcount label if it's greater than 0
|
||||
if self.restartCount > 0 {
|
||||
spec.Labels["restartcount"] = strconv.Itoa(self.restartCount)
|
||||
}
|
||||
spec.Envs = self.envs
|
||||
spec.Image = self.image
|
||||
spec.CreationTime = self.creationTime
|
||||
|
|
|
@ -533,6 +533,21 @@ func (self *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) {
|
|||
}
|
||||
|
||||
mount, found := self.mounts[dir]
|
||||
// try the parent dir if not found until we reach the root dir
|
||||
// this is an issue on btrfs systems where the directory is not
|
||||
// the subvolume
|
||||
for !found {
|
||||
pathdir, _ := filepath.Split(dir)
|
||||
// break when we reach root
|
||||
if pathdir == "/" {
|
||||
break
|
||||
}
|
||||
// trim "/" from the new parent path otherwise the next possible
|
||||
// filepath.Split in the loop will not split the string any further
|
||||
dir = strings.TrimSuffix(pathdir, "/")
|
||||
mount, found = self.mounts[dir]
|
||||
}
|
||||
|
||||
if found && mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") {
|
||||
major, minor, err := getBtrfsMajorMinorIds(mount)
|
||||
if err != nil {
|
||||
|
|
|
@ -110,6 +110,11 @@ func (self *rawContainerWatcher) Stop() error {
|
|||
// Watches the specified directory and all subdirectories. Returns whether the path was
|
||||
// already being watched and an error (if any).
|
||||
func (self *rawContainerWatcher) watchDirectory(events chan watcher.ContainerEvent, dir string, containerName string) (bool, error) {
|
||||
// Don't watch .mount cgroups because they never have containers as sub-cgroups. A single container
|
||||
// can have many .mount cgroups associated with it which can quickly exhaust the inotify watches on a node.
|
||||
if strings.HasSuffix(containerName, ".mount") {
|
||||
return false, nil
|
||||
}
|
||||
alreadyWatching, err := self.watcher.AddWatch(containerName, dir)
|
||||
if err != nil {
|
||||
return alreadyWatching, err
|
||||
|
|
Loading…
Reference in New Issue