Update vendor dependencies

Change-Id: I3b1ca9f2687388c831d9d46a4e1de413ffae06ac
This commit is contained in:
Davanum Srinivas
2018-11-09 14:22:00 -05:00
parent 954996e231
commit 3fe776f24b
127 changed files with 2564 additions and 732 deletions

View File

@@ -11,7 +11,6 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/docker/go-units:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/cadvisor/accelerators:go_default_library",
"//vendor/github.com/google/cadvisor/cache/memory:go_default_library",
"//vendor/github.com/google/cadvisor/collector:go_default_library",
@@ -38,6 +37,7 @@ go_library(
"//vendor/github.com/google/cadvisor/version:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/utils/clock:go_default_library",
],
)

View File

@@ -39,7 +39,7 @@ import (
"github.com/google/cadvisor/utils/cpuload"
units "github.com/docker/go-units"
"github.com/golang/glog"
"k8s.io/klog"
"k8s.io/utils/clock"
)
@@ -47,7 +47,9 @@ import (
var enableLoadReader = flag.Bool("enable_load_reader", false, "Whether to enable cpu load reader")
var HousekeepingInterval = flag.Duration("housekeeping_interval", 1*time.Second, "Interval between container housekeepings")
var cgroupPathRegExp = regexp.MustCompile(`devices[^:]*:(.*?)[,;$]`)
// cgroup type chosen to fetch the cgroup path of a process.
// Memory has been chosen, as it is one of the default cgroups that is enabled for most containers.
var cgroupPathRegExp = regexp.MustCompile(`memory[^:]*:(.*?)[,;$]`)
type containerInfo struct {
info.ContainerReference
@@ -185,8 +187,8 @@ func (c *containerData) getCgroupPath(cgroups string) (string, error) {
}
matches := cgroupPathRegExp.FindSubmatch([]byte(cgroups))
if len(matches) != 2 {
glog.V(3).Infof("failed to get devices cgroup path from %q", cgroups)
// return root in case of failures - devices hierarchy might not be enabled.
klog.V(3).Infof("failed to get memory cgroup path from %q", cgroups)
// return root in case of failures - memory hierarchy might not be enabled.
return "/", nil
}
return string(matches[1]), nil
@@ -206,7 +208,7 @@ func (c *containerData) ReadFile(filepath string, inHostNamespace bool) ([]byte,
}
for _, pid := range pids {
filePath := path.Join(rootfs, "/proc", pid, "/root", filepath)
glog.V(3).Infof("Trying path %q", filePath)
klog.V(3).Infof("Trying path %q", filePath)
data, err := ioutil.ReadFile(filePath)
if err == nil {
return data, err
@@ -266,6 +268,10 @@ func (c *containerData) getContainerPids(inHostNamespace bool) ([]string, error)
func (c *containerData) GetProcessList(cadvisorContainer string, inHostNamespace bool) ([]v2.ProcessInfo, error) {
// report all processes for root.
isRoot := c.info.Name == "/"
rootfs := "/"
if !inHostNamespace {
rootfs = "/rootfs"
}
format := "user,pid,ppid,stime,pcpu,pmem,rss,vsz,stat,time,comm,cgroup"
out, err := c.getPsOutput(inHostNamespace, format)
if err != nil {
@@ -324,6 +330,15 @@ func (c *containerData) GetProcessList(cadvisorContainer string, inHostNamespace
cgroupPath = cgroup
}
var fdCount int
dirPath := path.Join(rootfs, "/proc", strconv.Itoa(pid), "fd")
fds, err := ioutil.ReadDir(dirPath)
if err != nil {
klog.V(4).Infof("error while listing directory %q to measure fd count: %v", dirPath, err)
continue
}
fdCount = len(fds)
if isRoot || c.info.Name == cgroup {
processes = append(processes, v2.ProcessInfo{
User: fields[0],
@@ -338,6 +353,7 @@ func (c *containerData) GetProcessList(cadvisorContainer string, inHostNamespace
RunningTime: fields[9],
Cmd: fields[10],
CgroupPath: cgroupPath,
FdCount: fdCount,
})
}
}
@@ -377,7 +393,7 @@ func newContainerData(containerName string, memoryCache *memory.InMemoryCache, h
// Create cpu load reader.
loadReader, err := cpuload.New()
if err != nil {
glog.Warningf("Could not initialize cpu load reader for %q: %s", ref.Name, err)
klog.Warningf("Could not initialize cpu load reader for %q: %s", ref.Name, err)
} else {
cont.loadReader = loadReader
}
@@ -390,7 +406,7 @@ func newContainerData(containerName string, memoryCache *memory.InMemoryCache, h
cont.summaryReader, err = summary.New(cont.info.Spec)
if err != nil {
cont.summaryReader = nil
glog.Warningf("Failed to create summary reader for %q: %v", ref.Name, err)
klog.Warningf("Failed to create summary reader for %q: %v", ref.Name, err)
}
return cont, nil
@@ -403,7 +419,7 @@ func (self *containerData) nextHousekeepingInterval() time.Duration {
stats, err := self.memoryCache.RecentStats(self.info.Name, empty, empty, 2)
if err != nil {
if self.allowErrorLogging() {
glog.Warningf("Failed to get RecentStats(%q) while determining the next housekeeping: %v", self.info.Name, err)
klog.Warningf("Failed to get RecentStats(%q) while determining the next housekeeping: %v", self.info.Name, err)
}
} else if len(stats) == 2 {
// TODO(vishnuk): Use no processes as a signal.
@@ -433,7 +449,7 @@ func (c *containerData) housekeeping() {
if c.loadReader != nil {
err := c.loadReader.Start()
if err != nil {
glog.Warningf("Could not start cpu load stat collector for %q: %s", c.info.Name, err)
klog.Warningf("Could not start cpu load stat collector for %q: %s", c.info.Name, err)
}
defer c.loadReader.Stop()
}
@@ -445,7 +461,7 @@ func (c *containerData) housekeeping() {
}
// Housekeep every second.
glog.V(3).Infof("Start housekeeping for container %q\n", c.info.Name)
klog.V(3).Infof("Start housekeeping for container %q\n", c.info.Name)
houseKeepingTimer := c.clock.NewTimer(0 * time.Second)
defer houseKeepingTimer.Stop()
for {
@@ -466,7 +482,7 @@ func (c *containerData) housekeeping() {
stats, err := c.memoryCache.RecentStats(c.info.Name, empty, empty, numSamples)
if err != nil {
if c.allowErrorLogging() {
glog.Warningf("[%s] Failed to get recent stats for logging usage: %v", c.info.Name, err)
klog.Warningf("[%s] Failed to get recent stats for logging usage: %v", c.info.Name, err)
}
} else if len(stats) < numSamples {
// Ignore, not enough stats yet.
@@ -483,7 +499,7 @@ func (c *containerData) housekeeping() {
usageInCores := float64(usageCpuNs) / float64(stats[numSamples-1].Timestamp.Sub(stats[0].Timestamp).Nanoseconds())
usageInHuman := units.HumanSize(float64(usageMemory))
// Don't set verbosity since this is already protected by the logUsage flag.
glog.Infof("[%s] %.3f cores (average: %.3f cores), %s of memory", c.info.Name, instantUsageInCores, usageInCores, usageInHuman)
klog.Infof("[%s] %.3f cores (average: %.3f cores), %s of memory", c.info.Name, instantUsageInCores, usageInCores, usageInHuman)
}
}
houseKeepingTimer.Reset(c.nextHousekeepingInterval())
@@ -504,13 +520,13 @@ func (c *containerData) housekeepingTick(timer <-chan time.Time, longHousekeepin
err := c.updateStats()
if err != nil {
if c.allowErrorLogging() {
glog.Warningf("Failed to update stats for container \"%s\": %s", c.info.Name, err)
klog.Warningf("Failed to update stats for container \"%s\": %s", c.info.Name, err)
}
}
// Log if housekeeping took too long.
duration := c.clock.Since(start)
if duration >= longHousekeeping {
glog.V(3).Infof("[%s] Housekeeping took %s", c.info.Name, duration)
klog.V(3).Infof("[%s] Housekeeping took %s", c.info.Name, duration)
}
c.notifyOnDemand()
c.statsLastUpdatedTime = c.clock.Now()
@@ -584,7 +600,7 @@ func (c *containerData) updateStats() error {
err := c.summaryReader.AddSample(*stats)
if err != nil {
// Ignore summary errors for now.
glog.V(2).Infof("Failed to add summary stats for %q: %v", c.info.Name, err)
klog.V(2).Infof("Failed to add summary stats for %q: %v", c.info.Name, err)
}
}
var customStatsErr error

View File

@@ -49,9 +49,9 @@ import (
"github.com/google/cadvisor/utils/sysfs"
"github.com/google/cadvisor/version"
"github.com/golang/glog"
"github.com/opencontainers/runc/libcontainer/cgroups"
"golang.org/x/net/context"
"k8s.io/klog"
"k8s.io/utils/clock"
)
@@ -152,7 +152,7 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
if err != nil {
return nil, err
}
glog.V(2).Infof("cAdvisor running in container: %q", selfContainer)
klog.V(2).Infof("cAdvisor running in container: %q", selfContainer)
var (
dockerStatus info.DockerStatus
@@ -163,7 +163,7 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
dockerStatus = retryDockerStatus()
if tmpRktPath, err := rkt.RktPath(); err != nil {
glog.V(5).Infof("Rkt not connected: %v", err)
klog.V(5).Infof("Rkt not connected: %v", err)
} else {
rktPath = tmpRktPath
}
@@ -174,7 +174,7 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
}
crioInfo, err := crioClient.Info()
if err != nil {
glog.V(5).Infof("CRI-O not connected: %v", err)
klog.V(5).Infof("CRI-O not connected: %v", err)
}
context := fs.Context{
@@ -226,13 +226,13 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
return nil, err
}
newManager.machineInfo = *machineInfo
glog.V(1).Infof("Machine: %+v", newManager.machineInfo)
klog.V(1).Infof("Machine: %+v", newManager.machineInfo)
versionInfo, err := getVersionInfo()
if err != nil {
return nil, err
}
glog.V(1).Infof("Version: %+v", *versionInfo)
klog.V(1).Infof("Version: %+v", *versionInfo)
newManager.eventHandler = events.NewEventManager(parseEventsStoragePolicy())
return newManager, nil
@@ -250,9 +250,9 @@ func retryDockerStatus() info.DockerStatus {
switch err {
case context.DeadlineExceeded:
glog.Warningf("Timeout trying to communicate with docker during initialization, will retry")
klog.Warningf("Timeout trying to communicate with docker during initialization, will retry")
default:
glog.V(5).Infof("Docker not connected: %v", err)
klog.V(5).Infof("Docker not connected: %v", err)
return info.DockerStatus{}
}
@@ -298,12 +298,12 @@ type manager struct {
func (self *manager) Start() error {
err := docker.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the Docker container factory failed: %v.", err)
klog.V(5).Infof("Registration of the Docker container factory failed: %v.", err)
}
err = rkt.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the rkt container factory failed: %v", err)
klog.V(5).Infof("Registration of the rkt container factory failed: %v", err)
} else {
watcher, err := rktwatcher.NewRktContainerWatcher()
if err != nil {
@@ -314,27 +314,27 @@ func (self *manager) Start() error {
err = containerd.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the containerd container factory failed: %v", err)
klog.V(5).Infof("Registration of the containerd container factory failed: %v", err)
}
err = crio.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the crio container factory failed: %v", err)
klog.V(5).Infof("Registration of the crio container factory failed: %v", err)
}
err = mesos.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the mesos container factory failed: %v", err)
klog.V(5).Infof("Registration of the mesos container factory failed: %v", err)
}
err = systemd.Register(self, self.fsInfo, self.includedMetrics)
if err != nil {
glog.V(5).Infof("Registration of the systemd container factory failed: %v", err)
klog.V(5).Infof("Registration of the systemd container factory failed: %v", err)
}
err = raw.Register(self, self.fsInfo, self.includedMetrics, self.rawContainerCgroupPathPrefixWhiteList)
if err != nil {
glog.Errorf("Registration of the raw container factory failed: %v", err)
klog.Errorf("Registration of the raw container factory failed: %v", err)
}
rawWatcher, err := rawwatcher.NewRawContainerWatcher()
@@ -346,7 +346,7 @@ func (self *manager) Start() error {
// Watch for OOMs.
err = self.watchForNewOoms()
if err != nil {
glog.Warningf("Could not configure a source for OOM detection, disabling OOM events: %v", err)
klog.Warningf("Could not configure a source for OOM detection, disabling OOM events: %v", err)
}
// If there are no factories, don't start any housekeeping and serve the information we do have.
@@ -362,12 +362,12 @@ func (self *manager) Start() error {
if err != nil {
return err
}
glog.V(2).Infof("Starting recovery of all containers")
klog.V(2).Infof("Starting recovery of all containers")
err = self.detectSubcontainers("/")
if err != nil {
return err
}
glog.V(2).Infof("Recovery completed")
klog.V(2).Infof("Recovery completed")
// Watch for new container.
quitWatcher := make(chan error)
@@ -418,18 +418,18 @@ func (self *manager) globalHousekeeping(quit chan error) {
// Check for new containers.
err := self.detectSubcontainers("/")
if err != nil {
glog.Errorf("Failed to detect containers: %s", err)
klog.Errorf("Failed to detect containers: %s", err)
}
// Log if housekeeping took too long.
duration := time.Since(start)
if duration >= longHousekeeping {
glog.V(3).Infof("Global Housekeeping(%d) took %s", t.Unix(), duration)
klog.V(3).Infof("Global Housekeeping(%d) took %s", t.Unix(), duration)
}
case <-quit:
// Quit if asked to do so.
quit <- nil
glog.Infof("Exiting global housekeeping thread")
klog.Infof("Exiting global housekeeping thread")
return
}
}
@@ -630,7 +630,7 @@ func (self *manager) AllDockerContainers(query *info.ContainerInfoRequest) (map[
if err != nil {
// Ignore the error because of race condition and return best-effort result.
if err == memory.ErrDataNotFound {
glog.Warningf("Error getting data for container %s because of race condition", name)
klog.Warningf("Error getting data for container %s because of race condition", name)
continue
}
return nil, err
@@ -890,7 +890,7 @@ func (m *manager) registerCollectors(collectorConfigs map[string]string, cont *c
if err != nil {
return fmt.Errorf("failed to read config file %q for config %q, container %q: %v", k, v, cont.info.Name, err)
}
glog.V(4).Infof("Got config from %q: %q", v, configFile)
klog.V(4).Infof("Got config from %q: %q", v, configFile)
if strings.HasPrefix(k, "prometheus") || strings.HasPrefix(k, "Prometheus") {
newCollector, err := collector.NewPrometheusCollector(k, configFile, *applicationMetricsCountLimit, cont.handler, m.collectorHttpClient)
@@ -968,7 +968,7 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
}
if !accept {
// ignoring this container.
glog.V(4).Infof("ignoring container %q", containerName)
klog.V(4).Infof("ignoring container %q", containerName)
return nil
}
collectorManager, err := collector.NewCollectorManager()
@@ -983,11 +983,11 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
}
devicesCgroupPath, err := handler.GetCgroupPath("devices")
if err != nil {
glog.Warningf("Error getting devices cgroup path: %v", err)
klog.Warningf("Error getting devices cgroup path: %v", err)
} else {
cont.nvidiaCollector, err = m.nvidiaManager.GetCollector(devicesCgroupPath)
if err != nil {
glog.V(4).Infof("GPU metrics may be unavailable/incomplete for container %q: %v", cont.info.Name, err)
klog.V(4).Infof("GPU metrics may be unavailable/incomplete for container %q: %v", cont.info.Name, err)
}
}
@@ -996,7 +996,7 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
collectorConfigs := collector.GetCollectorConfigs(labels)
err = m.registerCollectors(collectorConfigs, cont)
if err != nil {
glog.Warningf("Failed to register collectors for %q: %v", containerName, err)
klog.Warningf("Failed to register collectors for %q: %v", containerName, err)
}
// Add the container name and all its aliases. The aliases must be within the namespace of the factory.
@@ -1008,7 +1008,7 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
}] = cont
}
glog.V(3).Infof("Added container: %q (aliases: %v, namespace: %q)", containerName, cont.info.Aliases, cont.info.Namespace)
klog.V(3).Infof("Added container: %q (aliases: %v, namespace: %q)", containerName, cont.info.Aliases, cont.info.Namespace)
contSpec, err := cont.handler.GetSpec()
if err != nil {
@@ -1065,7 +1065,7 @@ func (m *manager) destroyContainerLocked(containerName string) error {
Name: alias,
})
}
glog.V(3).Infof("Destroyed container: %q (aliases: %v, namespace: %q)", containerName, cont.info.Aliases, cont.info.Namespace)
klog.V(3).Infof("Destroyed container: %q (aliases: %v, namespace: %q)", containerName, cont.info.Aliases, cont.info.Namespace)
contRef, err := cont.handler.ContainerReference()
if err != nil {
@@ -1144,7 +1144,7 @@ func (m *manager) detectSubcontainers(containerName string) error {
for _, cont := range added {
err = m.createContainer(cont.Name, watcher.Raw)
if err != nil {
glog.Errorf("Failed to create existing container: %s: %s", cont.Name, err)
klog.Errorf("Failed to create existing container: %s: %s", cont.Name, err)
}
}
@@ -1152,7 +1152,7 @@ func (m *manager) detectSubcontainers(containerName string) error {
for _, cont := range removed {
err = m.destroyContainer(cont.Name)
if err != nil {
glog.Errorf("Failed to destroy existing container: %s: %s", cont.Name, err)
klog.Errorf("Failed to destroy existing container: %s: %s", cont.Name, err)
}
}
@@ -1192,7 +1192,7 @@ func (self *manager) watchForNewContainers(quit chan error) error {
err = self.destroyContainer(event.Name)
}
if err != nil {
glog.Warningf("Failed to process watch event %+v: %v", event, err)
klog.Warningf("Failed to process watch event %+v: %v", event, err)
}
case <-quit:
var errs partialFailure
@@ -1209,7 +1209,7 @@ func (self *manager) watchForNewContainers(quit chan error) error {
quit <- errs
} else {
quit <- nil
glog.Infof("Exiting thread watching subcontainers")
klog.Infof("Exiting thread watching subcontainers")
return
}
}
@@ -1219,7 +1219,7 @@ func (self *manager) watchForNewContainers(quit chan error) error {
}
func (self *manager) watchForNewOoms() error {
glog.V(2).Infof("Started watching for new ooms in manager")
klog.V(2).Infof("Started watching for new ooms in manager")
outStream := make(chan *oomparser.OomInstance, 10)
oomLog, err := oomparser.New()
if err != nil {
@@ -1237,9 +1237,9 @@ func (self *manager) watchForNewOoms() error {
}
err := self.eventHandler.AddEvent(newEvent)
if err != nil {
glog.Errorf("failed to add OOM event for %q: %v", oomInstance.ContainerName, err)
klog.Errorf("failed to add OOM event for %q: %v", oomInstance.ContainerName, err)
}
glog.V(3).Infof("Created an OOM event in container %q at %v", oomInstance.ContainerName, oomInstance.TimeOfDeath)
klog.V(3).Infof("Created an OOM event in container %q at %v", oomInstance.ContainerName, oomInstance.TimeOfDeath)
newEvent = &info.Event{
ContainerName: oomInstance.VictimContainerName,
@@ -1254,7 +1254,7 @@ func (self *manager) watchForNewOoms() error {
}
err = self.eventHandler.AddEvent(newEvent)
if err != nil {
glog.Errorf("failed to add OOM kill event for %q: %v", oomInstance.ContainerName, err)
klog.Errorf("failed to add OOM kill event for %q: %v", oomInstance.ContainerName, err)
}
}
}()
@@ -1285,12 +1285,12 @@ func parseEventsStoragePolicy() events.StoragePolicy {
for _, part := range parts {
items := strings.Split(part, "=")
if len(items) != 2 {
glog.Warningf("Unknown event storage policy %q when parsing max age", part)
klog.Warningf("Unknown event storage policy %q when parsing max age", part)
continue
}
dur, err := time.ParseDuration(items[1])
if err != nil {
glog.Warningf("Unable to parse event max age duration %q: %v", items[1], err)
klog.Warningf("Unable to parse event max age duration %q: %v", items[1], err)
continue
}
if items[0] == "default" {
@@ -1305,12 +1305,12 @@ func parseEventsStoragePolicy() events.StoragePolicy {
for _, part := range parts {
items := strings.Split(part, "=")
if len(items) != 2 {
glog.Warningf("Unknown event storage policy %q when parsing max event limit", part)
klog.Warningf("Unknown event storage policy %q when parsing max event limit", part)
continue
}
val, err := strconv.Atoi(items[1])
if err != nil {
glog.Warningf("Unable to parse integer from %q: %v", items[1], err)
klog.Warningf("Unable to parse integer from %q: %v", items[1], err)
continue
}
if items[0] == "default" {

View File

@@ -7,11 +7,11 @@ go_library(
importpath = "github.com/google/cadvisor/manager/watcher/raw",
visibility = ["//visibility:public"],
deps = [
"//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",
"//vendor/github.com/sigma/go-inotify:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@@ -26,9 +26,9 @@ import (
"github.com/google/cadvisor/container/common"
"github.com/google/cadvisor/container/libcontainer"
"github.com/google/cadvisor/manager/watcher"
inotify "github.com/sigma/go-inotify"
"github.com/golang/glog"
"golang.org/x/exp/inotify"
"k8s.io/klog"
)
type rawContainerWatcher struct {
@@ -84,10 +84,10 @@ func (self *rawContainerWatcher) Start(events chan watcher.ContainerEvent) error
case event := <-self.watcher.Event():
err := self.processEvent(event, events)
if err != nil {
glog.Warningf("Error while processing event (%+v): %v", event, err)
klog.Warningf("Error while processing event (%+v): %v", event, err)
}
case err := <-self.watcher.Error():
glog.Warningf("Error while watching %q:", "/", err)
klog.Warningf("Error while watching %q: %v", "/", err)
case <-self.stopWatcher:
err := self.watcher.Close()
if err == nil {
@@ -126,7 +126,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 inotify watch for %q: %v", dir, err)
klog.Warningf("Failed to remove inotify watch for %q: %v", dir, err)
}
}
}()
@@ -143,7 +143,7 @@ func (self *rawContainerWatcher) watchDirectory(events chan watcher.ContainerEve
subcontainerName := path.Join(containerName, entry.Name())
alreadyWatchingSubDir, err := self.watchDirectory(events, entryPath, subcontainerName)
if err != nil {
glog.Errorf("Failed to watch directory %q: %v", entryPath, err)
klog.Errorf("Failed to watch directory %q: %v", entryPath, err)
if os.IsNotExist(err) {
// The directory may have been removed before watching. Try to watch the other
// subdirectories. (https://github.com/kubernetes/kubernetes/issues/28997)

View File

@@ -8,10 +8,10 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/coreos/rkt/api/v1alpha:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/cadvisor/container/rkt:go_default_library",
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@@ -23,8 +23,8 @@ import (
"github.com/google/cadvisor/manager/watcher"
rktapi "github.com/coreos/rkt/api/v1alpha"
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/klog"
)
type rktContainerWatcher struct {
@@ -53,7 +53,7 @@ func (self *rktContainerWatcher) Stop() error {
}
func (self *rktContainerWatcher) detectRktContainers(events chan watcher.ContainerEvent) {
glog.V(1).Infof("Starting detectRktContainers thread")
klog.V(1).Infof("Starting detectRktContainers thread")
ticker := time.Tick(10 * time.Second)
curpods := make(map[string]*rktapi.Pod)
@@ -62,13 +62,13 @@ func (self *rktContainerWatcher) detectRktContainers(events chan watcher.Contain
case <-ticker:
pods, err := listRunningPods()
if err != nil {
glog.Errorf("detectRktContainers: listRunningPods failed: %v", err)
klog.Errorf("detectRktContainers: listRunningPods failed: %v", err)
continue
}
curpods = self.syncRunningPods(pods, events, curpods)
case <-self.stopWatcher:
glog.Infof("Exiting rktContainer Thread")
klog.Infof("Exiting rktContainer Thread")
return
}
}
@@ -92,7 +92,7 @@ func (self *rktContainerWatcher) syncRunningPods(pods []*rktapi.Pod, events chan
for id, pod := range curpods {
if _, ok := newpods[id]; !ok {
for _, cgroup := range podToCgroup(pod) {
glog.V(2).Infof("cgroup to delete = %v", cgroup)
klog.V(2).Infof("cgroup to delete = %v", cgroup)
self.sendDestroyEvent(cgroup, events)
}
}