mirror of https://github.com/k3s-io/k3s
update cadvisor godeps to v0.30.1 to revert cadvisor#1916
parent
e6f64d0a79
commit
21fd3c5cfd
|
@ -1508,218 +1508,218 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/accelerators",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/api",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/cache/memory",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/client/v2",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/collector",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/common",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/containerd",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/crio",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/docker",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/libcontainer",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/raw",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/rkt",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/systemd",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/devicemapper",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/events",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/fs",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/healthz",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/http",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/http/mux",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v1",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v2",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/machine",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/raw",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/rkt",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/metrics",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/pages",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/pages/static",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/storage",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/summary",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cloudinfo",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload/netlink",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/docker",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/oomparser",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysfs",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysinfo",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/validate",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/version",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/zfs",
|
||||
"Comment": "v0.30.0",
|
||||
"Rev": "f6359ffcbdec3c228bf312e6939ea6edf556ce52"
|
||||
"Comment": "v0.30.1",
|
||||
"Rev": "49c4fae21f151168b09758b7da1968fed8cd56a0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go",
|
||||
|
|
|
@ -5,18 +5,18 @@ go_library(
|
|||
srcs = [
|
||||
"container_hints.go",
|
||||
"fsHandler.go",
|
||||
"fsnotify_watcher.go",
|
||||
"helpers.go",
|
||||
"inotify_watcher.go",
|
||||
],
|
||||
importpath = "github.com/google/cadvisor/container/common",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/fs:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
||||
"//vendor/golang.org/x/exp/inotify:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func DebugInfo(watches map[string][]string) map[string][]string {
|
|||
lines = append(lines, fmt.Sprintf("\t%s", cg))
|
||||
}
|
||||
}
|
||||
out["Fsnotify watches"] = lines
|
||||
out["Inotify watches"] = lines
|
||||
|
||||
return out
|
||||
}
|
||||
|
|
|
@ -17,15 +17,15 @@ package common
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"golang.org/x/exp/inotify"
|
||||
)
|
||||
|
||||
// Watcher for container-related fsnotify events in the cgroup hierarchy.
|
||||
// Watcher for container-related inotify events in the cgroup hierarchy.
|
||||
//
|
||||
// Implementation is thread-safe.
|
||||
type FsnotifyWatcher struct {
|
||||
// Underlying fsnotify watcher.
|
||||
watcher *fsnotify.Watcher
|
||||
type InotifyWatcher struct {
|
||||
// Underlying inotify watcher.
|
||||
watcher *inotify.Watcher
|
||||
|
||||
// Map of containers being watched to cgroup paths watched for that container.
|
||||
containersWatched map[string]map[string]bool
|
||||
|
@ -34,28 +34,28 @@ type FsnotifyWatcher struct {
|
|||
lock sync.Mutex
|
||||
}
|
||||
|
||||
func NewFsnotifyWatcher() (*FsnotifyWatcher, error) {
|
||||
w, err := fsnotify.NewWatcher()
|
||||
func NewInotifyWatcher() (*InotifyWatcher, error) {
|
||||
w, err := inotify.NewWatcher()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &FsnotifyWatcher{
|
||||
return &InotifyWatcher{
|
||||
watcher: w,
|
||||
containersWatched: make(map[string]map[string]bool),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Add a watch to the specified directory. Returns if the container was already being watched.
|
||||
func (iw *FsnotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
|
||||
func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
|
||||
iw.lock.Lock()
|
||||
defer iw.lock.Unlock()
|
||||
|
||||
cgroupsWatched, alreadyWatched := iw.containersWatched[containerName]
|
||||
|
||||
// Register an fsnotify notification.
|
||||
// Register an inotify notification.
|
||||
if !cgroupsWatched[dir] {
|
||||
err := iw.watcher.Add(dir)
|
||||
err := iw.watcher.AddWatch(dir, inotify.IN_CREATE|inotify.IN_DELETE|inotify.IN_MOVE)
|
||||
if err != nil {
|
||||
return alreadyWatched, err
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func (iw *FsnotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
|
|||
}
|
||||
|
||||
// Remove watch from the specified directory. Returns if this was the last watch on the specified container.
|
||||
func (iw *FsnotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
|
||||
func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
|
||||
iw.lock.Lock()
|
||||
defer iw.lock.Unlock()
|
||||
|
||||
|
@ -84,9 +84,9 @@ func (iw *FsnotifyWatcher) RemoveWatch(containerName, dir string) (bool, error)
|
|||
return false, nil
|
||||
}
|
||||
|
||||
// Remove the fsnotify watch if it exists.
|
||||
// Remove the inotify watch if it exists.
|
||||
if cgroupsWatched[dir] {
|
||||
err := iw.watcher.Remove(dir)
|
||||
err := iw.watcher.RemoveWatch(dir)
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
|
@ -103,22 +103,22 @@ func (iw *FsnotifyWatcher) RemoveWatch(containerName, dir string) (bool, error)
|
|||
}
|
||||
|
||||
// Errors are returned on this channel.
|
||||
func (iw *FsnotifyWatcher) Error() chan error {
|
||||
return iw.watcher.Errors
|
||||
func (iw *InotifyWatcher) Error() chan error {
|
||||
return iw.watcher.Error
|
||||
}
|
||||
|
||||
// Events are returned on this channel.
|
||||
func (iw *FsnotifyWatcher) Event() chan fsnotify.Event {
|
||||
return iw.watcher.Events
|
||||
func (iw *InotifyWatcher) Event() chan *inotify.Event {
|
||||
return iw.watcher.Event
|
||||
}
|
||||
|
||||
// Closes the fsnotify watcher.
|
||||
func (iw *FsnotifyWatcher) Close() error {
|
||||
// Closes the inotify watcher.
|
||||
func (iw *InotifyWatcher) Close() error {
|
||||
return iw.watcher.Close()
|
||||
}
|
||||
|
||||
// Returns a map of containers to the cgroup paths being watched.
|
||||
func (iw *FsnotifyWatcher) GetWatches() map[string][]string {
|
||||
func (iw *InotifyWatcher) GetWatches() map[string][]string {
|
||||
out := make(map[string][]string, len(iw.containersWatched))
|
||||
for k, v := range iw.containersWatched {
|
||||
out[k] = mapToSlice(v)
|
|
@ -40,8 +40,8 @@ type rawFactory struct {
|
|||
// Information about mounted filesystems.
|
||||
fsInfo fs.FsInfo
|
||||
|
||||
// Watcher for fsnotify events.
|
||||
watcher *common.FsnotifyWatcher
|
||||
// Watcher for inotify events.
|
||||
watcher *common.InotifyWatcher
|
||||
|
||||
// List of metrics to be ignored.
|
||||
ignoreMetrics map[container.MetricKind]struct{}
|
||||
|
@ -78,7 +78,7 @@ func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, igno
|
|||
return fmt.Errorf("failed to find supported cgroup mounts for the raw factory")
|
||||
}
|
||||
|
||||
watcher, err := common.NewFsnotifyWatcher()
|
||||
watcher, err := common.NewInotifyWatcher()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func isRootCgroup(name string) bool {
|
|||
return name == "/"
|
||||
}
|
||||
|
||||
func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, watcher *common.FsnotifyWatcher, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) {
|
||||
func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, watcher *common.InotifyWatcher, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) {
|
||||
cgroupPaths := common.MakeCgroupPaths(cgroupSubsystems.MountPoints, name)
|
||||
|
||||
cHints, err := common.GetContainerHintsFromFile(*common.ArgContainerHints)
|
||||
|
|
|
@ -6,11 +6,11 @@ go_library(
|
|||
importpath = "github.com/google/cadvisor/manager/watcher/raw",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
|
||||
"//vendor/golang.org/x/exp/inotify:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
"github.com/google/cadvisor/container/libcontainer"
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/exp/inotify"
|
||||
)
|
||||
|
||||
type rawContainerWatcher struct {
|
||||
|
@ -37,8 +37,8 @@ type rawContainerWatcher struct {
|
|||
|
||||
cgroupSubsystems *libcontainer.CgroupSubsystems
|
||||
|
||||
// Fsnotify event watcher.
|
||||
watcher *common.FsnotifyWatcher
|
||||
// Inotify event watcher.
|
||||
watcher *common.InotifyWatcher
|
||||
|
||||
// Signal for watcher thread to stop.
|
||||
stopWatcher chan error
|
||||
|
@ -53,7 +53,7 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
|
|||
return nil, fmt.Errorf("failed to find supported cgroup mounts for the raw factory")
|
||||
}
|
||||
|
||||
watcher, err := common.NewFsnotifyWatcher()
|
||||
watcher, err := common.NewInotifyWatcher()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func (self *rawContainerWatcher) watchDirectory(events chan watcher.ContainerEve
|
|||
if cleanup {
|
||||
_, err := self.watcher.RemoveWatch(containerName, dir)
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to remove fsnotify watch for %q: %v", dir, err)
|
||||
glog.Warningf("Failed to remove inotify watch for %q: %v", dir, err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@ -163,16 +163,18 @@ func (self *rawContainerWatcher) watchDirectory(events chan watcher.ContainerEve
|
|||
return alreadyWatching, nil
|
||||
}
|
||||
|
||||
func (self *rawContainerWatcher) processEvent(event fsnotify.Event, events chan watcher.ContainerEvent) error {
|
||||
// Convert the fsnotify event type to a container create or delete.
|
||||
func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan watcher.ContainerEvent) error {
|
||||
// Convert the inotify event type to a container create or delete.
|
||||
var eventType watcher.ContainerEventType
|
||||
switch {
|
||||
case event.Op == fsnotify.Create:
|
||||
case (event.Mask & inotify.IN_CREATE) > 0:
|
||||
eventType = watcher.ContainerAdd
|
||||
case event.Op == fsnotify.Remove:
|
||||
case (event.Mask & inotify.IN_DELETE) > 0:
|
||||
eventType = watcher.ContainerDelete
|
||||
case event.Op == fsnotify.Rename:
|
||||
case (event.Mask & inotify.IN_MOVED_FROM) > 0:
|
||||
eventType = watcher.ContainerDelete
|
||||
case (event.Mask & inotify.IN_MOVED_TO) > 0:
|
||||
eventType = watcher.ContainerAdd
|
||||
default:
|
||||
// Ignore other events.
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue