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

@@ -26,8 +26,10 @@ import (
"github.com/google/cadvisor/container"
info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/utils"
"github.com/karrick/godirwalk"
"github.com/pkg/errors"
"github.com/golang/glog"
"k8s.io/klog"
)
func DebugInfo(watches map[string][]string) map[string][]string {
@@ -85,7 +87,7 @@ func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoF
if quota != "" && quota != "-1" {
val, err := strconv.ParseUint(quota, 10, 64)
if err != nil {
glog.Errorf("GetSpec: Failed to parse CPUQuota from %q: %s", path.Join(cpuRoot, "cpu.cfs_quota_us"), err)
klog.Errorf("GetSpec: Failed to parse CPUQuota from %q: %s", path.Join(cpuRoot, "cpu.cfs_quota_us"), err)
}
spec.Cpu.Quota = val
}
@@ -132,7 +134,7 @@ func readString(dirpath string, file string) string {
if err != nil {
// Ignore non-existent files
if !os.IsNotExist(err) {
glog.Errorf("readString: Failed to read %q: %s", cgroupFile, err)
klog.Errorf("readString: Failed to read %q: %s", cgroupFile, err)
}
return ""
}
@@ -147,7 +149,7 @@ func readUInt64(dirpath string, file string) uint64 {
val, err := strconv.ParseUint(out, 10, 64)
if err != nil {
glog.Errorf("readUInt64: Failed to parse int %q from file %q: %s", out, path.Join(dirpath, file), err)
klog.Errorf("readUInt64: Failed to parse int %q from file %q: %s", out, path.Join(dirpath, file), err)
return 0
}
@@ -156,26 +158,34 @@ func readUInt64(dirpath string, file string) uint64 {
// Lists all directories under "path" and outputs the results as children of "parent".
func ListDirectories(dirpath string, parent string, recursive bool, output map[string]struct{}) error {
entries, err := ioutil.ReadDir(dirpath)
buf := make([]byte, godirwalk.DefaultScratchBufferSize)
return listDirectories(dirpath, parent, recursive, output, buf)
}
func listDirectories(dirpath string, parent string, recursive bool, output map[string]struct{}, buf []byte) error {
dirents, err := godirwalk.ReadDirents(dirpath, buf)
if err != nil {
// Ignore if this hierarchy does not exist.
if os.IsNotExist(err) {
if os.IsNotExist(errors.Cause(err)) {
err = nil
}
return err
}
for _, entry := range entries {
for _, dirent := range dirents {
// We only grab directories.
if entry.IsDir() {
name := path.Join(parent, entry.Name())
output[name] = struct{}{}
if !dirent.IsDir() {
continue
}
dirname := dirent.Name()
// List subcontainers if asked to.
if recursive {
err := ListDirectories(path.Join(dirpath, entry.Name()), name, true, output)
if err != nil {
return err
}
name := path.Join(parent, dirname)
output[name] = struct{}{}
// List subcontainers if asked to.
if recursive {
err := listDirectories(path.Join(dirpath, dirname), name, true, output, buf)
if err != nil {
return err
}
}
}