mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Update vendor dependencies
Change-Id: I3b1ca9f2687388c831d9d46a4e1de413ffae06ac
This commit is contained in:
parent
954996e231
commit
3fe776f24b
213
Godeps/Godeps.json
generated
213
Godeps/Godeps.json
generated
@ -1789,10 +1789,6 @@
|
||||
"Comment": "v0.5",
|
||||
"Rev": "342cbe0a04158f6dcb03ca0079991a51a4248c02"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/glog",
|
||||
"Rev": "44145f04b68cf362d9c4df2182967c2275eaefed"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/groupcache/lru",
|
||||
"Rev": "02826c3e79038b59d737d3b1c0a1d937f71a4433"
|
||||
@ -1847,188 +1843,188 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/accelerators",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/cache/memory",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/client/v2",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/collector",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/common",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/containerd",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/crio",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/docker",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/libcontainer",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/mesos",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/raw",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/rkt",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/container/systemd",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/devicemapper",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/events",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/fs",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v1",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/info/v2",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/machine",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/raw",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/manager/watcher/rkt",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/metrics",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/storage",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/summary",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cloudinfo",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/cpuload/netlink",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/docker",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/oomparser",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysfs",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/utils/sysinfo",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/version",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/cadvisor/zfs",
|
||||
"Comment": "v0.31.0",
|
||||
"Rev": "fc17731afdcf184832482e324913c8f1a91b54ee"
|
||||
"Comment": "v0.31.0-34-g4c77cd7d7f7114",
|
||||
"Rev": "4c77cd7d7f7114bc8643c5a7d0fd1cbbb661d9c0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/certificate-transparency-go",
|
||||
@ -2361,6 +2357,11 @@
|
||||
"ImportPath": "github.com/kardianos/osext",
|
||||
"Rev": "8fef92e41e22a70e700a96b29f066cda30ea24ef"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/karrick/godirwalk",
|
||||
"Comment": "v1.7.5",
|
||||
"Rev": "2de2192f9e35ce981c152a873ed943b93b79ced4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kisielk/sqlstruct",
|
||||
"Rev": "648daed35d49dac24a4bff253b190a80da3ab6a5"
|
||||
@ -2380,7 +2381,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kubernetes/repo-infra/kazel",
|
||||
"Rev": "d9bb9fdc907665c61c228baa64fed9b91c7dc1b0"
|
||||
"Rev": "f2459dc75fc429b813d92c0622b408fd7f0d4cac"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/lib/pq",
|
||||
@ -3002,6 +3003,10 @@
|
||||
"ImportPath": "github.com/shurcooL/sanitized_anchor_name",
|
||||
"Rev": "10ef21a441db47d8b13ebcc5fd2310f636973c77"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/sigma/go-inotify",
|
||||
"Rev": "c87b6cf5033d2c6486046f045eeebdc3d910fd38"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/sirupsen/logrus",
|
||||
"Comment": "v1.0.3-11-g89742aefa4b206",
|
||||
@ -3897,100 +3902,104 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/args",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/deepcopy-gen/generators",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/defaulter-gen/generators",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/import-boss/generators",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/set-gen/generators",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/examples/set-gen/sets",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/generator",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/namer",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/parser",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo/types",
|
||||
"Rev": "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2"
|
||||
"Rev": "51747d6e00da1fc578d5a333a93bb2abcbce7a95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/heapster/metrics/api/v1/types",
|
||||
"Comment": "v1.2.0-beta.1",
|
||||
"Rev": "c2ac40f1adf8c42a79badddb2a2acd673cae3bcb"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/klog",
|
||||
"Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/cmd/openapi-gen",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/cmd/openapi-gen/args",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/aggregator",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/generators/rules",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/testing",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/validation",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/sets",
|
||||
"Rev": "72693cb1fadd73ae2742f6fe29af77d1aecdd8cd"
|
||||
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/utils/clock",
|
||||
|
466
Godeps/LICENSES
generated
466
Godeps/LICENSES
generated
@ -50388,205 +50388,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/golang/glog licensed under: =
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
= vendor/github.com/golang/glog/LICENSE 19cbd64715b51267a47bf3750cc6a8a5
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/golang/groupcache/lru licensed under: =
|
||||
|
||||
@ -72487,6 +72288,39 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/karrick/godirwalk licensed under: =
|
||||
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2017, Karrick McDermott
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
= vendor/github.com/karrick/godirwalk/LICENSE 7bea66fc0a31c6329f9392034bee75d2
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/kisielk/sqlstruct licensed under: =
|
||||
|
||||
@ -87880,6 +87714,41 @@ THE SOFTWARE.
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/sigma/go-inotify licensed under: =
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
= vendor/github.com/sigma/go-inotify/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/sirupsen/logrus licensed under: =
|
||||
|
||||
@ -108888,6 +108757,205 @@ Apache License
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/k8s.io/klog licensed under: =
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
= vendor/k8s.io/klog/LICENSE 19cbd64715b51267a47bf3750cc6a8a5
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/k8s.io/kube-openapi/cmd/openapi-gen licensed under: =
|
||||
|
||||
|
4
vendor/BUILD
vendored
4
vendor/BUILD
vendored
@ -235,7 +235,6 @@ filegroup(
|
||||
"//vendor/github.com/gogo/protobuf/sortkeys:all-srcs",
|
||||
"//vendor/github.com/gogo/protobuf/types:all-srcs",
|
||||
"//vendor/github.com/gogo/protobuf/vanity:all-srcs",
|
||||
"//vendor/github.com/golang/glog:all-srcs",
|
||||
"//vendor/github.com/golang/groupcache/lru:all-srcs",
|
||||
"//vendor/github.com/golang/mock/gomock:all-srcs",
|
||||
"//vendor/github.com/golang/protobuf/jsonpb:all-srcs",
|
||||
@ -287,6 +286,7 @@ filegroup(
|
||||
"//vendor/github.com/json-iterator/go:all-srcs",
|
||||
"//vendor/github.com/jteeuwen/go-bindata:all-srcs",
|
||||
"//vendor/github.com/kardianos/osext:all-srcs",
|
||||
"//vendor/github.com/karrick/godirwalk:all-srcs",
|
||||
"//vendor/github.com/kisielk/sqlstruct:all-srcs",
|
||||
"//vendor/github.com/kr/fs:all-srcs",
|
||||
"//vendor/github.com/kr/pretty:all-srcs",
|
||||
@ -348,6 +348,7 @@ filegroup(
|
||||
"//vendor/github.com/satori/go.uuid:all-srcs",
|
||||
"//vendor/github.com/seccomp/libseccomp-golang:all-srcs",
|
||||
"//vendor/github.com/shurcooL/sanitized_anchor_name:all-srcs",
|
||||
"//vendor/github.com/sigma/go-inotify:all-srcs",
|
||||
"//vendor/github.com/sirupsen/logrus:all-srcs",
|
||||
"//vendor/github.com/soheilhy/cmux:all-srcs",
|
||||
"//vendor/github.com/spf13/afero:all-srcs",
|
||||
@ -455,6 +456,7 @@ filegroup(
|
||||
"//vendor/k8s.io/gengo/parser:all-srcs",
|
||||
"//vendor/k8s.io/gengo/types:all-srcs",
|
||||
"//vendor/k8s.io/heapster/metrics/api/v1/types:all-srcs",
|
||||
"//vendor/k8s.io/klog:all-srcs",
|
||||
"//vendor/k8s.io/kube-openapi/cmd/openapi-gen:all-srcs",
|
||||
"//vendor/k8s.io/kube-openapi/pkg/aggregator:all-srcs",
|
||||
"//vendor/k8s.io/kube-openapi/pkg/builder:all-srcs",
|
||||
|
2
vendor/github.com/google/cadvisor/accelerators/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/accelerators/BUILD
generated
vendored
@ -10,9 +10,9 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/accelerators",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/mindprince/gonvml:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
20
vendor/github.com/google/cadvisor/accelerators/nvidia.go
generated
vendored
20
vendor/github.com/google/cadvisor/accelerators/nvidia.go
generated
vendored
@ -26,8 +26,8 @@ import (
|
||||
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/mindprince/gonvml"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type NvidiaManager struct {
|
||||
@ -50,7 +50,7 @@ const nvidiaVendorId = "0x10de"
|
||||
// Setup initializes NVML if nvidia devices are present on the node.
|
||||
func (nm *NvidiaManager) Setup() {
|
||||
if !detectDevices(nvidiaVendorId) {
|
||||
glog.V(4).Info("No NVIDIA devices found.")
|
||||
klog.V(4).Info("No NVIDIA devices found.")
|
||||
return
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ func (nm *NvidiaManager) Setup() {
|
||||
func detectDevices(vendorId string) bool {
|
||||
devices, err := ioutil.ReadDir(sysFsPCIDevicesPath)
|
||||
if err != nil {
|
||||
glog.Warningf("Error reading %q: %v", sysFsPCIDevicesPath, err)
|
||||
klog.Warningf("Error reading %q: %v", sysFsPCIDevicesPath, err)
|
||||
return false
|
||||
}
|
||||
|
||||
@ -71,11 +71,11 @@ func detectDevices(vendorId string) bool {
|
||||
vendorPath := filepath.Join(sysFsPCIDevicesPath, device.Name(), "vendor")
|
||||
content, err := ioutil.ReadFile(vendorPath)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Error while reading %q: %v", vendorPath, err)
|
||||
klog.V(4).Infof("Error while reading %q: %v", vendorPath, err)
|
||||
continue
|
||||
}
|
||||
if strings.EqualFold(strings.TrimSpace(string(content)), vendorId) {
|
||||
glog.V(3).Infof("Found device with vendorId %q", vendorId)
|
||||
klog.V(3).Infof("Found device with vendorId %q", vendorId)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -88,26 +88,26 @@ 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)
|
||||
klog.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)
|
||||
klog.Warningf("GPU metrics would not be available. Failed to get the number of nvidia devices: %v", err)
|
||||
return
|
||||
}
|
||||
glog.V(1).Infof("NVML initialized. Number of nvidia devices: %v", numDevices)
|
||||
klog.V(1).Infof("NVML initialized. Number of nvidia devices: %v", numDevices)
|
||||
nm.nvidiaDevices = make(map[int]gonvml.Device, numDevices)
|
||||
for i := 0; i < int(numDevices); i++ {
|
||||
device, err := gonvml.DeviceHandleByIndex(uint(i))
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to get nvidia device handle %d: %v", i, err)
|
||||
klog.Warningf("Failed to get nvidia device handle %d: %v", i, err)
|
||||
continue
|
||||
}
|
||||
minorNumber, err := device.MinorNumber()
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to get nvidia device minor number: %v", err)
|
||||
klog.Warningf("Failed to get nvidia device minor number: %v", err)
|
||||
continue
|
||||
}
|
||||
nm.nvidiaDevices[int(minorNumber)] = device
|
||||
|
2
vendor/github.com/google/cadvisor/cache/memory/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/cache/memory/BUILD
generated
vendored
@ -7,10 +7,10 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/cache/memory",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/storage:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/google/cadvisor/cache/memory/memory.go
generated
vendored
6
vendor/github.com/google/cadvisor/cache/memory/memory.go
generated
vendored
@ -23,13 +23,13 @@ import (
|
||||
"github.com/google/cadvisor/storage"
|
||||
"github.com/google/cadvisor/utils"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// ErrDataNotFound is the error resulting if failed to find a container in memory cache.
|
||||
var ErrDataNotFound = errors.New("unable to find data in memory cache")
|
||||
|
||||
// TODO(vmarmol): See about refactoring this class, we have an unecessary redirection of containerCache and InMemoryCache.
|
||||
// TODO(vmarmol): See about refactoring this class, we have an unnecessary redirection of containerCache and InMemoryCache.
|
||||
// containerCache is used to store per-container information
|
||||
type containerCache struct {
|
||||
ref info.ContainerReference
|
||||
@ -91,7 +91,7 @@ func (self *InMemoryCache) AddStats(cInfo *info.ContainerInfo, stats *info.Conta
|
||||
// may want to start a pool of goroutines to do write
|
||||
// operations.
|
||||
if err := self.backend.AddStats(cInfo, stats); err != nil {
|
||||
glog.Error(err)
|
||||
klog.Error(err)
|
||||
}
|
||||
}
|
||||
return cstore.AddStats(stats)
|
||||
|
2
vendor/github.com/google/cadvisor/container/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/BUILD
generated
vendored
@ -10,9 +10,9 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/google/cadvisor/container/common/BUILD
generated
vendored
6
vendor/github.com/google/cadvisor/container/common/BUILD
generated
vendored
@ -12,12 +12,14 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container/common",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//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",
|
||||
"//vendor/github.com/karrick/godirwalk:go_default_library",
|
||||
"//vendor/github.com/pkg/errors:go_default_library",
|
||||
"//vendor/github.com/sigma/go-inotify:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/google/cadvisor/container/common/fsHandler.go
generated
vendored
6
vendor/github.com/google/cadvisor/container/common/fsHandler.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/google/cadvisor/fs"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type FsHandler interface {
|
||||
@ -118,7 +118,7 @@ func (fh *realFsHandler) trackUsage() {
|
||||
case <-time.After(fh.period):
|
||||
start := time.Now()
|
||||
if err := fh.update(); err != nil {
|
||||
glog.Errorf("failed to collect filesystem stats - %v", err)
|
||||
klog.Errorf("failed to collect filesystem stats - %v", err)
|
||||
fh.period = fh.period * 2
|
||||
if fh.period > maxBackoffFactor*fh.minPeriod {
|
||||
fh.period = maxBackoffFactor * fh.minPeriod
|
||||
@ -132,7 +132,7 @@ func (fh *realFsHandler) trackUsage() {
|
||||
// if the long duration is persistent either because of slow
|
||||
// disk or lots of containers.
|
||||
longOp = longOp + time.Second
|
||||
glog.V(2).Infof("du and find on following dirs took %v: %v; will not log again for this container unless duration exceeds %v", duration, []string{fh.rootfs, fh.extraDir}, longOp)
|
||||
klog.V(2).Infof("du and find on following dirs took %v: %v; will not log again for this container unless duration exceeds %v", duration, []string{fh.rootfs, fh.extraDir}, longOp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
42
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/google/cadvisor/container/common/inotify_watcher.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/common/inotify_watcher.go
generated
vendored
@ -17,7 +17,7 @@ package common
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"golang.org/x/exp/inotify"
|
||||
inotify "github.com/sigma/go-inotify"
|
||||
)
|
||||
|
||||
// Watcher for container-related inotify events in the cgroup hierarchy.
|
||||
@ -78,7 +78,7 @@ func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
|
||||
iw.lock.Lock()
|
||||
defer iw.lock.Unlock()
|
||||
|
||||
// If we don't have a watch registed for this, just return.
|
||||
// If we don't have a watch registered for this, just return.
|
||||
cgroupsWatched, ok := iw.containersWatched[containerName]
|
||||
if !ok {
|
||||
return false, nil
|
||||
|
2
vendor/github.com/google/cadvisor/container/containerd/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/containerd/BUILD
generated
vendored
@ -20,7 +20,6 @@ go_library(
|
||||
"//vendor/github.com/containerd/containerd/errdefs:go_default_library",
|
||||
"//vendor/github.com/containerd/containerd/namespaces:go_default_library",
|
||||
"//vendor/github.com/gogo/protobuf/types: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/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -32,6 +31,7 @@ go_library(
|
||||
"//vendor/github.com/opencontainers/runtime-spec/specs-go:go_default_library",
|
||||
"//vendor/golang.org/x/net/context:go_default_library",
|
||||
"//vendor/google.golang.org/grpc:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/containerd/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/containerd/factory.go
generated
vendored
@ -21,8 +21,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
"k8s.io/klog"
|
||||
|
||||
"github.com/google/cadvisor/container"
|
||||
"github.com/google/cadvisor/container/libcontainer"
|
||||
@ -133,7 +133,7 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
|
||||
return fmt.Errorf("failed to get cgroup subsystems: %v", err)
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering containerd factory")
|
||||
klog.V(1).Infof("Registering containerd factory")
|
||||
f := &containerdFactory{
|
||||
cgroupSubsystems: cgroupSubsystems,
|
||||
client: client,
|
||||
|
2
vendor/github.com/google/cadvisor/container/crio/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/crio/BUILD
generated
vendored
@ -11,7 +11,6 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container/crio",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -20,6 +19,7 @@ go_library(
|
||||
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/crio/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/crio/factory.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// The namespace under which crio aliases are unique.
|
||||
@ -154,7 +154,7 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
|
||||
return fmt.Errorf("failed to get cgroup subsystems: %v", err)
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering CRI-O factory")
|
||||
klog.V(1).Infof("Registering CRI-O factory")
|
||||
f := &crioFactory{
|
||||
client: client,
|
||||
cgroupSubsystems: cgroupSubsystems,
|
||||
|
2
vendor/github.com/google/cadvisor/container/crio/handler.go
generated
vendored
2
vendor/github.com/google/cadvisor/container/crio/handler.go
generated
vendored
@ -176,7 +176,7 @@ func newCrioContainerHandler(
|
||||
}
|
||||
// TODO for env vars we wanted to show from container.Config.Env from whitelist
|
||||
//for _, exposedEnv := range metadataEnvs {
|
||||
//glog.V(4).Infof("TODO env whitelist: %v", exposedEnv)
|
||||
//klog.V(4).Infof("TODO env whitelist: %v", exposedEnv)
|
||||
//}
|
||||
|
||||
return handler, nil
|
||||
|
2
vendor/github.com/google/cadvisor/container/docker/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/docker/BUILD
generated
vendored
@ -17,7 +17,6 @@ go_library(
|
||||
"//vendor/github.com/docker/docker/api/types/container:go_default_library",
|
||||
"//vendor/github.com/docker/docker/client:go_default_library",
|
||||
"//vendor/github.com/docker/go-connections/tlsconfig: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/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -31,6 +30,7 @@ go_library(
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||
"//vendor/golang.org/x/net/context:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
8
vendor/github.com/google/cadvisor/container/docker/factory.go
generated
vendored
8
vendor/github.com/google/cadvisor/container/docker/factory.go
generated
vendored
@ -36,8 +36,8 @@ import (
|
||||
"github.com/google/cadvisor/zfs"
|
||||
|
||||
docker "github.com/docker/docker/client"
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var ArgDockerEndpoint = flag.String("docker", "unix:///var/run/docker.sock", "docker endpoint")
|
||||
@ -337,7 +337,7 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
|
||||
if storageDriver(dockerInfo.Driver) == devicemapperStorageDriver {
|
||||
thinPoolWatcher, err = startThinPoolWatcher(dockerInfo)
|
||||
if err != nil {
|
||||
glog.Errorf("devicemapper filesystem stats will not be reported: %v", err)
|
||||
klog.Errorf("devicemapper filesystem stats will not be reported: %v", err)
|
||||
}
|
||||
|
||||
// Safe to ignore error - driver status should always be populated.
|
||||
@ -349,11 +349,11 @@ func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics
|
||||
if storageDriver(dockerInfo.Driver) == zfsStorageDriver {
|
||||
zfsWatcher, err = startZfsWatcher(dockerInfo)
|
||||
if err != nil {
|
||||
glog.Errorf("zfs filesystem stats will not be reported: %v", err)
|
||||
klog.Errorf("zfs filesystem stats will not be reported: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering Docker factory")
|
||||
klog.V(1).Infof("Registering Docker factory")
|
||||
f := &dockerFactory{
|
||||
cgroupSubsystems: cgroupSubsystems,
|
||||
client: client,
|
||||
|
8
vendor/github.com/google/cadvisor/container/docker/handler.go
generated
vendored
8
vendor/github.com/google/cadvisor/container/docker/handler.go
generated
vendored
@ -34,10 +34,10 @@ import (
|
||||
|
||||
dockercontainer "github.com/docker/docker/api/types/container"
|
||||
docker "github.com/docker/docker/client"
|
||||
"github.com/golang/glog"
|
||||
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
|
||||
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
|
||||
"golang.org/x/net/context"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -228,7 +228,7 @@ func newDockerContainerHandler(
|
||||
handler.labels["restartcount"] = strconv.Itoa(ctnr.RestartCount)
|
||||
}
|
||||
|
||||
// Obtain the IP address for the contianer.
|
||||
// Obtain the IP address for the container.
|
||||
// If the NetworkMode starts with 'container:' then we need to use the IP address of the container specified.
|
||||
// This happens in cases such as kubernetes where the containers doesn't have an IP address itself and we need to use the pod's address
|
||||
ipAddress := ctnr.NetworkSettings.IPAddress
|
||||
@ -309,7 +309,7 @@ func (h *dockerFsHandler) Usage() common.FsUsage {
|
||||
// TODO: ideally we should keep track of how many times we failed to get the usage for this
|
||||
// device vs how many refreshes of the cache there have been, and display an error e.g. if we've
|
||||
// had at least 1 refresh and we still can't find the device.
|
||||
glog.V(5).Infof("unable to get fs usage from thin pool for device %s: %v", h.deviceID, err)
|
||||
klog.V(5).Infof("unable to get fs usage from thin pool for device %s: %v", h.deviceID, err)
|
||||
} else {
|
||||
usage.BaseUsageBytes = thinPoolUsage
|
||||
usage.TotalUsageBytes += thinPoolUsage
|
||||
@ -319,7 +319,7 @@ func (h *dockerFsHandler) Usage() common.FsUsage {
|
||||
if h.zfsWatcher != nil {
|
||||
zfsUsage, err := h.zfsWatcher.GetUsage(h.zfsFilesystem)
|
||||
if err != nil {
|
||||
glog.V(5).Infof("unable to get fs usage from zfs for filesystem %s: %v", h.zfsFilesystem, err)
|
||||
klog.V(5).Infof("unable to get fs usage from zfs for filesystem %s: %v", h.zfsFilesystem, err)
|
||||
} else {
|
||||
usage.BaseUsageBytes = zfsUsage
|
||||
usage.TotalUsageBytes += zfsUsage
|
||||
|
11
vendor/github.com/google/cadvisor/container/factory.go
generated
vendored
11
vendor/github.com/google/cadvisor/container/factory.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type ContainerHandlerFactory interface {
|
||||
@ -53,6 +53,7 @@ const (
|
||||
NetworkUdpUsageMetrics MetricKind = "udp"
|
||||
AcceleratorUsageMetrics MetricKind = "accelerator"
|
||||
AppMetrics MetricKind = "app"
|
||||
ProcessMetrics MetricKind = "process"
|
||||
)
|
||||
|
||||
func (mk MetricKind) String() string {
|
||||
@ -105,18 +106,18 @@ func NewContainerHandler(name string, watchType watcher.ContainerWatchSource, in
|
||||
for _, factory := range factories[watchType] {
|
||||
canHandle, canAccept, err := factory.CanHandleAndAccept(name)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Error trying to work out if we can handle %s: %v", name, err)
|
||||
klog.V(4).Infof("Error trying to work out if we can handle %s: %v", name, err)
|
||||
}
|
||||
if canHandle {
|
||||
if !canAccept {
|
||||
glog.V(3).Infof("Factory %q can handle container %q, but ignoring.", factory, name)
|
||||
klog.V(3).Infof("Factory %q can handle container %q, but ignoring.", factory, name)
|
||||
return nil, false, nil
|
||||
}
|
||||
glog.V(3).Infof("Using factory %q for container %q", factory, name)
|
||||
klog.V(3).Infof("Using factory %q for container %q", factory, name)
|
||||
handle, err := factory.NewContainerHandler(name, inHostNamespace)
|
||||
return handle, canAccept, err
|
||||
} else {
|
||||
glog.V(4).Infof("Factory %q was unable to handle container %q", factory, name)
|
||||
klog.V(4).Infof("Factory %q was unable to handle container %q", factory, name)
|
||||
}
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/google/cadvisor/container/libcontainer/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/libcontainer/BUILD
generated
vendored
@ -11,11 +11,11 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container/libcontainer",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
67
vendor/github.com/google/cadvisor/container/libcontainer/handler.go
generated
vendored
67
vendor/github.com/google/cadvisor/container/libcontainer/handler.go
generated
vendored
@ -29,9 +29,9 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"bytes"
|
||||
"github.com/golang/glog"
|
||||
"github.com/opencontainers/runc/libcontainer"
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -72,11 +72,11 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
||||
if h.includedMetrics.Has(container.ProcessSchedulerMetrics) {
|
||||
pids, err := h.cgroupManager.GetAllPids()
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Could not get PIDs for container %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Could not get PIDs for container %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Cpu.Schedstat, err = schedulerStatsFromProcs(h.rootFs, pids, h.pidMetricsCache)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get Process Scheduler Stats: %v", err)
|
||||
klog.V(4).Infof("Unable to get Process Scheduler Stats: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
||||
if h.includedMetrics.Has(container.NetworkUsageMetrics) {
|
||||
netStats, err := networkStatsFromProc(h.rootFs, h.pid)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get network stats from pid %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Unable to get network stats from pid %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Network.Interfaces = append(stats.Network.Interfaces, netStats...)
|
||||
}
|
||||
@ -96,14 +96,14 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
||||
if h.includedMetrics.Has(container.NetworkTcpUsageMetrics) {
|
||||
t, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp")
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get tcp stats from pid %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Unable to get tcp stats from pid %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Network.Tcp = t
|
||||
}
|
||||
|
||||
t6, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp6")
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get tcp6 stats from pid %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Unable to get tcp6 stats from pid %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Network.Tcp6 = t6
|
||||
}
|
||||
@ -111,18 +111,30 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
||||
if h.includedMetrics.Has(container.NetworkUdpUsageMetrics) {
|
||||
u, err := udpStatsFromProc(h.rootFs, h.pid, "net/udp")
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get udp stats from pid %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Unable to get udp stats from pid %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Network.Udp = u
|
||||
}
|
||||
|
||||
u6, err := udpStatsFromProc(h.rootFs, h.pid, "net/udp6")
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Unable to get udp6 stats from pid %d: %v", h.pid, err)
|
||||
klog.V(4).Infof("Unable to get udp6 stats from pid %d: %v", h.pid, err)
|
||||
} else {
|
||||
stats.Network.Udp6 = u6
|
||||
}
|
||||
}
|
||||
if h.includedMetrics.Has(container.ProcessMetrics) {
|
||||
paths := h.cgroupManager.GetPaths()
|
||||
path, ok := paths["cpu"]
|
||||
if !ok {
|
||||
klog.V(4).Infof("Could not find cgroups CPU for container %d", h.pid)
|
||||
} else {
|
||||
stats.Processes, err = processStatsFromProcs(h.rootFs, path)
|
||||
if err != nil {
|
||||
klog.V(4).Infof("Unable to get Process Stats: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility.
|
||||
if len(stats.Network.Interfaces) > 0 {
|
||||
@ -132,6 +144,41 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
func processStatsFromProcs(rootFs string, cgroupPath string) (info.ProcessStats, error) {
|
||||
var fdCount uint64
|
||||
filePath := path.Join(cgroupPath, "cgroup.procs")
|
||||
out, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return info.ProcessStats{}, fmt.Errorf("couldn't open cpu cgroup procs file %v : %v", filePath, err)
|
||||
}
|
||||
|
||||
pids := strings.Split(string(out), "\n")
|
||||
|
||||
// EOL is also treated as a new line while reading "cgroup.procs" file with ioutil.ReadFile.
|
||||
// The last value is an empty string "". Ex: pids = ["22", "1223", ""]
|
||||
// Trim the last value
|
||||
if len(pids) != 0 && pids[len(pids)-1] == "" {
|
||||
pids = pids[:len(pids)-1]
|
||||
}
|
||||
|
||||
for _, pid := range pids {
|
||||
dirPath := path.Join(rootFs, "/proc", 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 += uint64(len(fds))
|
||||
}
|
||||
|
||||
processStats := info.ProcessStats{
|
||||
ProcessCount: uint64(len(pids)),
|
||||
FdCount: fdCount,
|
||||
}
|
||||
|
||||
return processStats, nil
|
||||
}
|
||||
|
||||
func schedulerStatsFromProcs(rootFs string, pids []int, pidMetricsCache map[int]*info.CpuSchedstat) (info.CpuSchedstat, error) {
|
||||
for _, pid := range pids {
|
||||
f, err := os.Open(path.Join(rootFs, "proc", strconv.Itoa(pid), "schedstat"))
|
||||
@ -451,13 +498,13 @@ func setCpuStats(s *cgroups.Stats, ret *info.ContainerStats, withPerCPU bool) {
|
||||
// We intentionally ignore these extra zeroes.
|
||||
numActual, err := numCpusFunc()
|
||||
if err != nil {
|
||||
glog.Errorf("unable to determine number of actual cpus; defaulting to maximum possible number: errno %v", err)
|
||||
klog.Errorf("unable to determine number of actual cpus; defaulting to maximum possible number: errno %v", err)
|
||||
numActual = numPossible
|
||||
}
|
||||
if numActual > numPossible {
|
||||
// The real number of cores should never be greater than the number of
|
||||
// datapoints reported in cpu usage.
|
||||
glog.Errorf("PercpuUsage had %v cpus, but the actual number is %v; ignoring extra CPUs", numPossible, numActual)
|
||||
klog.Errorf("PercpuUsage had %v cpus, but the actual number is %v; ignoring extra CPUs", numPossible, numActual)
|
||||
}
|
||||
numActual = minUint32(numPossible, numActual)
|
||||
ret.Cpu.Usage.PerCpu = make([]uint64, numActual)
|
||||
|
4
vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
generated
vendored
@ -19,8 +19,8 @@ import (
|
||||
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type CgroupSubsystems struct {
|
||||
@ -61,7 +61,7 @@ func getCgroupSubsystemsHelper(allCgroups []cgroups.Mount) (CgroupSubsystems, er
|
||||
}
|
||||
if _, ok := mountPoints[subsystem]; ok {
|
||||
// duplicate mount for this subsystem; use the first one we saw
|
||||
glog.V(5).Infof("skipping %s, already using mount at %s", mount.Mountpoint, mountPoints[subsystem])
|
||||
klog.V(5).Infof("skipping %s, already using mount at %s", mount.Mountpoint, mountPoints[subsystem])
|
||||
continue
|
||||
}
|
||||
if _, ok := recordedMountpoints[mount.Mountpoint]; !ok {
|
||||
|
2
vendor/github.com/google/cadvisor/container/mesos/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/mesos/BUILD
generated
vendored
@ -14,7 +14,6 @@ go_library(
|
||||
deps = [
|
||||
"//vendor/github.com/Rican7/retry:go_default_library",
|
||||
"//vendor/github.com/Rican7/retry/strategy: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/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -29,6 +28,7 @@ go_library(
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/httpcli:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
23
vendor/github.com/google/cadvisor/container/mesos/client.go
generated
vendored
23
vendor/github.com/google/cadvisor/container/mesos/client.go
generated
vendored
@ -70,6 +70,11 @@ func Client() (mesosAgentClient, error) {
|
||||
),
|
||||
}
|
||||
})
|
||||
|
||||
_, err := mesosClient.getVersion()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get version")
|
||||
}
|
||||
return mesosClient, nil
|
||||
}
|
||||
|
||||
@ -134,6 +139,20 @@ func (self *client) getContainer(id string) (*mContainer, error) {
|
||||
return nil, fmt.Errorf("can't locate container %s", id)
|
||||
}
|
||||
|
||||
func (self *client) getVersion() (string, error) {
|
||||
req := calls.NonStreaming(calls.GetVersion())
|
||||
result, err := self.fetchAndDecode(req)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get mesos version: %v", err)
|
||||
}
|
||||
version := result.GetVersion
|
||||
|
||||
if version == nil {
|
||||
return "", fmt.Errorf("failed to get mesos version")
|
||||
}
|
||||
return version.VersionInfo.Version, nil
|
||||
}
|
||||
|
||||
func (self *client) getContainers() (mContainers, error) {
|
||||
req := calls.NonStreaming(calls.GetContainers())
|
||||
result, err := self.fetchAndDecode(req)
|
||||
@ -141,6 +160,10 @@ func (self *client) getContainers() (mContainers, error) {
|
||||
return nil, fmt.Errorf("failed to get mesos containers: %v", err)
|
||||
}
|
||||
cntrs := result.GetContainers
|
||||
|
||||
if cntrs == nil {
|
||||
return nil, fmt.Errorf("failed to get mesos containers")
|
||||
}
|
||||
return cntrs, nil
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/mesos/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/mesos/factory.go
generated
vendored
@ -22,12 +22,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/container"
|
||||
"github.com/google/cadvisor/container/libcontainer"
|
||||
"github.com/google/cadvisor/fs"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var MesosAgentAddress = flag.String("mesos_agent", "127.0.0.1:5051", "Mesos agent address")
|
||||
@ -135,7 +135,7 @@ func Register(
|
||||
return fmt.Errorf("failed to get cgroup subsystems: %v", err)
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering mesos factory")
|
||||
klog.V(1).Infof("Registering mesos factory")
|
||||
factory := &mesosFactory{
|
||||
machineInfoFactory: machineInfoFactory,
|
||||
cgroupSubsystems: cgroupSubsystems,
|
||||
|
2
vendor/github.com/google/cadvisor/container/raw/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/raw/BUILD
generated
vendored
@ -10,7 +10,6 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container/raw",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -20,6 +19,7 @@ go_library(
|
||||
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/raw/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/raw/factory.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
watch "github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var dockerOnly = flag.Bool("docker_only", false, "Only report docker containers in addition to root stats")
|
||||
@ -94,7 +94,7 @@ func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, incl
|
||||
return err
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering Raw factory")
|
||||
klog.V(1).Infof("Registering Raw factory")
|
||||
factory := &rawFactory{
|
||||
machineInfoFactory: machineInfoFactory,
|
||||
fsInfo: fsInfo,
|
||||
|
6
vendor/github.com/google/cadvisor/container/raw/handler.go
generated
vendored
6
vendor/github.com/google/cadvisor/container/raw/handler.go
generated
vendored
@ -25,9 +25,9 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/machine"
|
||||
|
||||
"github.com/golang/glog"
|
||||
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type rawContainerHandler struct {
|
||||
@ -134,7 +134,7 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) {
|
||||
// Get memory and swap limits of the running machine
|
||||
memLimit, err := machine.GetMachineMemoryCapacity()
|
||||
if err != nil {
|
||||
glog.Warningf("failed to obtain memory limit for machine container")
|
||||
klog.Warningf("failed to obtain memory limit for machine container")
|
||||
spec.HasMemory = false
|
||||
} else {
|
||||
spec.Memory.Limit = uint64(memLimit)
|
||||
@ -144,7 +144,7 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) {
|
||||
|
||||
swapLimit, err := machine.GetMachineSwapCapacity()
|
||||
if err != nil {
|
||||
glog.Warningf("failed to obtain swap limit for machine container")
|
||||
klog.Warningf("failed to obtain swap limit for machine container")
|
||||
} else {
|
||||
spec.Memory.SwapLimit = uint64(swapLimit)
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/container/rkt/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/rkt/BUILD
generated
vendored
@ -14,7 +14,6 @@ go_library(
|
||||
deps = [
|
||||
"//vendor/github.com/blang/semver:go_default_library",
|
||||
"//vendor/github.com/coreos/rkt/api/v1alpha: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/container/common:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container/libcontainer:go_default_library",
|
||||
@ -25,6 +24,7 @@ go_library(
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||
"//vendor/golang.org/x/net/context:go_default_library",
|
||||
"//vendor/google.golang.org/grpc:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/rkt/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/rkt/factory.go
generated
vendored
@ -23,7 +23,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const RktNamespace = "rkt"
|
||||
@ -86,7 +86,7 @@ func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, incl
|
||||
return fmt.Errorf("failed to find supported cgroup mounts for the raw factory")
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Registering Rkt factory")
|
||||
klog.V(1).Infof("Registering Rkt factory")
|
||||
factory := &rktFactory{
|
||||
machineInfoFactory: machineInfoFactory,
|
||||
fsInfo: fsInfo,
|
||||
|
4
vendor/github.com/google/cadvisor/container/rkt/handler.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/rkt/handler.go
generated
vendored
@ -27,9 +27,9 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/golang/glog"
|
||||
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type rktContainerHandler struct {
|
||||
@ -89,7 +89,7 @@ func newRktContainerHandler(name string, rktClient rktapi.PublicAPIClient, rktPa
|
||||
annotations := resp.Pod.Annotations
|
||||
if parsed.Container != "" { // As not empty string, an App container
|
||||
if contAnnotations, ok := findAnnotations(resp.Pod.Apps, parsed.Container); !ok {
|
||||
glog.Warningf("couldn't find app %v in pod", parsed.Container)
|
||||
klog.Warningf("couldn't find app %v in pod", parsed.Container)
|
||||
} else {
|
||||
annotations = append(annotations, contAnnotations...)
|
||||
}
|
||||
|
4
vendor/github.com/google/cadvisor/container/rkt/helpers.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/rkt/helpers.go
generated
vendored
@ -21,8 +21,8 @@ import (
|
||||
"strings"
|
||||
|
||||
rktapi "github.com/coreos/rkt/api/v1alpha"
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type parsedName struct {
|
||||
@ -128,7 +128,7 @@ func getRootFs(root string, parsed *parsedName) string {
|
||||
|
||||
bytes, err := ioutil.ReadFile(tree)
|
||||
if err != nil {
|
||||
glog.Errorf("ReadFile failed, couldn't read %v to get upper dir: %v", tree, err)
|
||||
klog.Errorf("ReadFile failed, couldn't read %v to get upper dir: %v", tree, err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/google/cadvisor/container/systemd/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/systemd/BUILD
generated
vendored
@ -7,11 +7,11 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/container/systemd",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//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/manager/watcher:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/container/systemd/factory.go
generated
vendored
4
vendor/github.com/google/cadvisor/container/systemd/factory.go
generated
vendored
@ -23,7 +23,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager/watcher"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type systemdFactory struct{}
|
||||
@ -51,7 +51,7 @@ func (f *systemdFactory) DebugInfo() map[string][]string {
|
||||
|
||||
// Register registers the systemd container factory.
|
||||
func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics container.MetricSet) error {
|
||||
glog.V(1).Infof("Registering systemd factory")
|
||||
klog.V(1).Infof("Registering systemd factory")
|
||||
factory := &systemdFactory{}
|
||||
container.RegisterContainerHandlerFactory(factory, []watcher.ContainerWatchSource{watcher.Raw})
|
||||
return nil
|
||||
|
2
vendor/github.com/google/cadvisor/devicemapper/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/devicemapper/BUILD
generated
vendored
@ -12,7 +12,7 @@ go_library(
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/google/cadvisor/devicemapper",
|
||||
importpath = "github.com/google/cadvisor/devicemapper",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/github.com/golang/glog:go_default_library"],
|
||||
deps = ["//vendor/k8s.io/klog:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
|
4
vendor/github.com/google/cadvisor/devicemapper/dmsetup_client.go
generated
vendored
4
vendor/github.com/google/cadvisor/devicemapper/dmsetup_client.go
generated
vendored
@ -18,7 +18,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// DmsetupClient is a low-level client for interacting with device mapper via
|
||||
@ -58,6 +58,6 @@ func (c *defaultDmsetupClient) Status(deviceName string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (*defaultDmsetupClient) dmsetup(args ...string) ([]byte, error) {
|
||||
glog.V(5).Infof("running dmsetup %v", strings.Join(args, " "))
|
||||
klog.V(5).Infof("running dmsetup %v", strings.Join(args, " "))
|
||||
return exec.Command("dmsetup", args...).Output()
|
||||
}
|
||||
|
6
vendor/github.com/google/cadvisor/devicemapper/thin_ls_client.go
generated
vendored
6
vendor/github.com/google/cadvisor/devicemapper/thin_ls_client.go
generated
vendored
@ -21,7 +21,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// thinLsClient knows how to run a thin_ls very specific to CoW usage for
|
||||
@ -53,7 +53,7 @@ var _ thinLsClient = &defaultThinLsClient{}
|
||||
|
||||
func (c *defaultThinLsClient) ThinLs(deviceName string) (map[string]uint64, error) {
|
||||
args := []string{"--no-headers", "-m", "-o", "DEV,EXCLUSIVE_BYTES", deviceName}
|
||||
glog.V(4).Infof("running command: thin_ls %v", strings.Join(args, " "))
|
||||
klog.V(4).Infof("running command: thin_ls %v", strings.Join(args, " "))
|
||||
|
||||
output, err := exec.Command(c.thinLsPath, args...).Output()
|
||||
if err != nil {
|
||||
@ -80,7 +80,7 @@ func parseThinLsOutput(output []byte) map[string]uint64 {
|
||||
deviceID := fields[0]
|
||||
usage, err := strconv.ParseUint(fields[1], 10, 64)
|
||||
if err != nil {
|
||||
glog.Warningf("unexpected error parsing thin_ls output: %v", err)
|
||||
klog.Warningf("unexpected error parsing thin_ls output: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
20
vendor/github.com/google/cadvisor/devicemapper/thin_pool_watcher.go
generated
vendored
20
vendor/github.com/google/cadvisor/devicemapper/thin_pool_watcher.go
generated
vendored
@ -19,7 +19,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// ThinPoolWatcher maintains a cache of device name -> usage stats for a
|
||||
@ -58,7 +58,7 @@ func NewThinPoolWatcher(poolName, metadataDevice string) (*ThinPoolWatcher, erro
|
||||
func (w *ThinPoolWatcher) Start() {
|
||||
err := w.Refresh()
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error refreshing thin pool watcher: %v", err)
|
||||
klog.Errorf("encountered error refreshing thin pool watcher: %v", err)
|
||||
}
|
||||
|
||||
for {
|
||||
@ -69,12 +69,12 @@ func (w *ThinPoolWatcher) Start() {
|
||||
start := time.Now()
|
||||
err = w.Refresh()
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error refreshing thin pool watcher: %v", err)
|
||||
klog.Errorf("encountered error refreshing thin pool watcher: %v", err)
|
||||
}
|
||||
|
||||
// print latency for refresh
|
||||
duration := time.Since(start)
|
||||
glog.V(5).Infof("thin_ls(%d) took %s", start.Unix(), duration)
|
||||
klog.V(5).Infof("thin_ls(%d) took %s", start.Unix(), duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ func (w *ThinPoolWatcher) Refresh() error {
|
||||
}
|
||||
|
||||
if currentlyReserved {
|
||||
glog.V(5).Infof("metadata for %v is currently reserved; releasing", w.poolName)
|
||||
klog.V(5).Infof("metadata for %v is currently reserved; releasing", w.poolName)
|
||||
_, err = w.dmsetup.Message(w.poolName, 0, releaseMetadataMessage)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error releasing metadata snapshot for %v: %v", w.poolName, err)
|
||||
@ -123,22 +123,22 @@ func (w *ThinPoolWatcher) Refresh() error {
|
||||
}
|
||||
}
|
||||
|
||||
glog.V(5).Infof("reserving metadata snapshot for thin-pool %v", w.poolName)
|
||||
klog.V(5).Infof("reserving metadata snapshot for thin-pool %v", w.poolName)
|
||||
// NOTE: "0" in the call below is for the 'sector' argument to 'dmsetup
|
||||
// message'. It's not needed for thin pools.
|
||||
if output, err := w.dmsetup.Message(w.poolName, 0, reserveMetadataMessage); err != nil {
|
||||
err = fmt.Errorf("error reserving metadata for thin-pool %v: %v output: %v", w.poolName, err, string(output))
|
||||
return err
|
||||
} else {
|
||||
glog.V(5).Infof("reserved metadata snapshot for thin-pool %v", w.poolName)
|
||||
klog.V(5).Infof("reserved metadata snapshot for thin-pool %v", w.poolName)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
glog.V(5).Infof("releasing metadata snapshot for thin-pool %v", w.poolName)
|
||||
klog.V(5).Infof("releasing metadata snapshot for thin-pool %v", w.poolName)
|
||||
w.dmsetup.Message(w.poolName, 0, releaseMetadataMessage)
|
||||
}()
|
||||
|
||||
glog.V(5).Infof("running thin_ls on metadata device %v", w.metadataDevice)
|
||||
klog.V(5).Infof("running thin_ls on metadata device %v", w.metadataDevice)
|
||||
newCache, err := w.thinLsClient.ThinLs(w.metadataDevice)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error performing thin_ls on metadata device %v: %v", w.metadataDevice, err)
|
||||
@ -157,7 +157,7 @@ const (
|
||||
// checkReservation checks to see whether the thin device is currently holding
|
||||
// userspace metadata.
|
||||
func (w *ThinPoolWatcher) checkReservation(poolName string) (bool, error) {
|
||||
glog.V(5).Infof("checking whether the thin-pool is holding a metadata snapshot")
|
||||
klog.V(5).Infof("checking whether the thin-pool is holding a metadata snapshot")
|
||||
output, err := w.dmsetup.Status(poolName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
2
vendor/github.com/google/cadvisor/events/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/events/BUILD
generated
vendored
@ -7,9 +7,9 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/events",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/google/cadvisor/events/handler.go
generated
vendored
6
vendor/github.com/google/cadvisor/events/handler.go
generated
vendored
@ -24,7 +24,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/utils"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type byTimestamp []*info.Event
|
||||
@ -322,7 +322,7 @@ func (self *events) AddEvent(e *info.Event) error {
|
||||
for _, watchObject := range watchesToSend {
|
||||
watchObject.eventChannel.GetChannel() <- e
|
||||
}
|
||||
glog.V(4).Infof("Added event %v", e)
|
||||
klog.V(4).Infof("Added event %v", e)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ func (self *events) StopWatch(watchId int) {
|
||||
defer self.watcherLock.Unlock()
|
||||
_, ok := self.watchers[watchId]
|
||||
if !ok {
|
||||
glog.Errorf("Could not find watcher instance %v", watchId)
|
||||
klog.Errorf("Could not find watcher instance %v", watchId)
|
||||
}
|
||||
close(self.watchers[watchId].eventChannel.GetChannel())
|
||||
delete(self.watchers, watchId)
|
||||
|
2
vendor/github.com/google/cadvisor/fs/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/fs/BUILD
generated
vendored
@ -12,11 +12,11 @@ go_library(
|
||||
deps = select({
|
||||
"@io_bazel_rules_go//go/platform:linux": [
|
||||
"//vendor/github.com/docker/docker/pkg/mount:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/devicemapper:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils/docker:go_default_library",
|
||||
"//vendor/github.com/mistifyio/go-zfs:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
|
38
vendor/github.com/google/cadvisor/fs/fs.go
generated
vendored
38
vendor/github.com/google/cadvisor/fs/fs.go
generated
vendored
@ -33,11 +33,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/devicemapper"
|
||||
"github.com/google/cadvisor/utils"
|
||||
dockerutil "github.com/google/cadvisor/utils/docker"
|
||||
zfs "github.com/mistifyio/go-zfs"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -114,9 +114,9 @@ func NewFsInfo(context Context) (FsInfo, error) {
|
||||
|
||||
fsUUIDToDeviceName, err := getFsUUIDToDeviceNameMap()
|
||||
if err != nil {
|
||||
// UUID is not always avaiable across different OS distributions.
|
||||
// UUID is not always available across different OS distributions.
|
||||
// Do not fail if there is an error.
|
||||
glog.Warningf("Failed to get disk UUID mapping, getting disk info by uuid will not work: %v", err)
|
||||
klog.Warningf("Failed to get disk UUID mapping, getting disk info by uuid will not work: %v", err)
|
||||
}
|
||||
|
||||
// Avoid devicemapper container mounts - these are tracked by the ThinPoolWatcher
|
||||
@ -139,8 +139,8 @@ func NewFsInfo(context Context) (FsInfo, error) {
|
||||
fsInfo.addDockerImagesLabel(context, mounts)
|
||||
fsInfo.addCrioImagesLabel(context, mounts)
|
||||
|
||||
glog.V(1).Infof("Filesystem UUIDs: %+v", fsInfo.fsUUIDToDeviceName)
|
||||
glog.V(1).Infof("Filesystem partitions: %+v", fsInfo.partitions)
|
||||
klog.V(1).Infof("Filesystem UUIDs: %+v", fsInfo.fsUUIDToDeviceName)
|
||||
klog.V(1).Infof("Filesystem partitions: %+v", fsInfo.partitions)
|
||||
fsInfo.addSystemRootLabel(mounts)
|
||||
return fsInfo, nil
|
||||
}
|
||||
@ -165,7 +165,7 @@ func getFsUUIDToDeviceNameMap() (map[string]string, error) {
|
||||
path := filepath.Join(dir, file.Name())
|
||||
target, err := os.Readlink(path)
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to resolve symlink for %q", path)
|
||||
klog.Warningf("Failed to resolve symlink for %q", path)
|
||||
continue
|
||||
}
|
||||
device, err := filepath.Abs(filepath.Join(dir, target))
|
||||
@ -213,7 +213,7 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
|
||||
if mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") {
|
||||
major, minor, err := getBtrfsMajorMinorIds(mount)
|
||||
if err != nil {
|
||||
glog.Warningf("%s", err)
|
||||
klog.Warningf("%s", err)
|
||||
} else {
|
||||
mount.Major = major
|
||||
mount.Minor = minor
|
||||
@ -278,7 +278,7 @@ func (self *RealFsInfo) addSystemRootLabel(mounts []*mount.Info) {
|
||||
func (self *RealFsInfo) addDockerImagesLabel(context Context, mounts []*mount.Info) {
|
||||
dockerDev, dockerPartition, err := self.getDockerDeviceMapperInfo(context.Docker)
|
||||
if err != nil {
|
||||
glog.Warningf("Could not get Docker devicemapper device: %v", err)
|
||||
klog.Warningf("Could not get Docker devicemapper device: %v", err)
|
||||
}
|
||||
if len(dockerDev) > 0 && dockerPartition != nil {
|
||||
self.partitions[dockerDev] = *dockerPartition
|
||||
@ -405,7 +405,7 @@ func (self *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, er
|
||||
switch partition.fsType {
|
||||
case DeviceMapper.String():
|
||||
fs.Capacity, fs.Free, fs.Available, err = getDMStats(device, partition.blockSize)
|
||||
glog.V(5).Infof("got devicemapper fs capacity stats: capacity: %v free: %v available: %v:", fs.Capacity, fs.Free, fs.Available)
|
||||
klog.V(5).Infof("got devicemapper fs capacity stats: capacity: %v free: %v available: %v:", fs.Capacity, fs.Free, fs.Available)
|
||||
fs.Type = DeviceMapper
|
||||
case ZFS.String():
|
||||
fs.Capacity, fs.Free, fs.Available, err = getZfstats(device)
|
||||
@ -418,11 +418,11 @@ func (self *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, er
|
||||
fs.InodesFree = &inodesFree
|
||||
fs.Type = VFS
|
||||
} else {
|
||||
glog.V(4).Infof("unable to determine file system type, partition mountpoint does not exist: %v", partition.mountpoint)
|
||||
klog.V(4).Infof("unable to determine file system type, partition mountpoint does not exist: %v", partition.mountpoint)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Stat fs failed. Error: %v", err)
|
||||
klog.V(4).Infof("Stat fs failed. Error: %v", err)
|
||||
} else {
|
||||
deviceSet[device] = struct{}{}
|
||||
fs.DeviceInfo = DeviceInfo{
|
||||
@ -445,7 +445,7 @@ func getDiskStatsMap(diskStatsFile string) (map[string]DiskStats, error) {
|
||||
file, err := os.Open(diskStatsFile)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
glog.Warningf("Not collecting filesystem statistics because file %q was not found", diskStatsFile)
|
||||
klog.Warningf("Not collecting filesystem statistics because file %q was not found", diskStatsFile)
|
||||
return diskStatsMap, nil
|
||||
}
|
||||
return nil, err
|
||||
@ -551,7 +551,7 @@ func (self *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) {
|
||||
if found && mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") {
|
||||
major, minor, err := getBtrfsMajorMinorIds(mount)
|
||||
if err != nil {
|
||||
glog.Warningf("%s", err)
|
||||
klog.Warningf("%s", err)
|
||||
} else {
|
||||
return &DeviceInfo{mount.Source, uint(major), uint(minor)}, nil
|
||||
}
|
||||
@ -583,12 +583,12 @@ func GetDirDiskUsage(dir string, timeout time.Duration) (uint64, error) {
|
||||
return 0, fmt.Errorf("failed to exec du - %v", err)
|
||||
}
|
||||
timer := time.AfterFunc(timeout, func() {
|
||||
glog.Warningf("Killing cmd %v due to timeout(%s)", cmd.Args, timeout.String())
|
||||
klog.Warningf("Killing cmd %v due to timeout(%s)", cmd.Args, timeout.String())
|
||||
cmd.Process.Kill()
|
||||
})
|
||||
stdoutb, souterr := ioutil.ReadAll(stdoutp)
|
||||
if souterr != nil {
|
||||
glog.Errorf("Failed to read from stdout for cmd %v - %v", cmd.Args, souterr)
|
||||
klog.Errorf("Failed to read from stdout for cmd %v - %v", cmd.Args, souterr)
|
||||
}
|
||||
stderrb, _ := ioutil.ReadAll(stderrp)
|
||||
err = cmd.Wait()
|
||||
@ -622,7 +622,7 @@ func GetDirInodeUsage(dir string, timeout time.Duration) (uint64, error) {
|
||||
return 0, fmt.Errorf("failed to exec cmd %v - %v; stderr: %v", findCmd.Args, err, stderr.String())
|
||||
}
|
||||
timer := time.AfterFunc(timeout, func() {
|
||||
glog.Warningf("Killing cmd %v due to timeout(%s)", findCmd.Args, timeout.String())
|
||||
klog.Warningf("Killing cmd %v due to timeout(%s)", findCmd.Args, timeout.String())
|
||||
findCmd.Process.Kill()
|
||||
})
|
||||
err := findCmd.Wait()
|
||||
@ -763,7 +763,7 @@ func getBtrfsMajorMinorIds(mount *mount.Info) (int, int, error) {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("btrfs mount %#v", mount)
|
||||
klog.V(4).Infof("btrfs mount %#v", mount)
|
||||
if buf.Mode&syscall.S_IFMT == syscall.S_IFBLK {
|
||||
err := syscall.Stat(mount.Mountpoint, buf)
|
||||
if err != nil {
|
||||
@ -771,8 +771,8 @@ func getBtrfsMajorMinorIds(mount *mount.Info) (int, int, error) {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("btrfs dev major:minor %d:%d\n", int(major(buf.Dev)), int(minor(buf.Dev)))
|
||||
glog.V(4).Infof("btrfs rdev major:minor %d:%d\n", int(major(buf.Rdev)), int(minor(buf.Rdev)))
|
||||
klog.V(4).Infof("btrfs dev major:minor %d:%d\n", int(major(buf.Dev)), int(minor(buf.Dev)))
|
||||
klog.V(4).Infof("btrfs rdev major:minor %d:%d\n", int(major(buf.Rdev)), int(minor(buf.Rdev)))
|
||||
|
||||
return int(major(buf.Dev)), int(minor(buf.Dev)), nil
|
||||
} else {
|
||||
|
15
vendor/github.com/google/cadvisor/info/v1/container.go
generated
vendored
15
vendor/github.com/google/cadvisor/info/v1/container.go
generated
vendored
@ -102,11 +102,11 @@ type ContainerInfoRequest struct {
|
||||
NumStats int `json:"num_stats,omitempty"`
|
||||
|
||||
// Start time for which to query information.
|
||||
// If ommitted, the beginning of time is assumed.
|
||||
// If omitted, the beginning of time is assumed.
|
||||
Start time.Time `json:"start,omitempty"`
|
||||
|
||||
// End time for which to query information.
|
||||
// If ommitted, current time is assumed.
|
||||
// If omitted, current time is assumed.
|
||||
End time.Time `json:"end,omitempty"`
|
||||
}
|
||||
|
||||
@ -557,6 +557,14 @@ type AcceleratorStats struct {
|
||||
DutyCycle uint64 `json:"duty_cycle"`
|
||||
}
|
||||
|
||||
type ProcessStats struct {
|
||||
// Number of processes
|
||||
ProcessCount uint64 `json:"process_count"`
|
||||
|
||||
// Number of open file descriptors
|
||||
FdCount uint64 `json:"fd_count"`
|
||||
}
|
||||
|
||||
type ContainerStats struct {
|
||||
// The time of this stat point.
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
@ -574,6 +582,9 @@ type ContainerStats struct {
|
||||
// Metrics for Accelerators. Each Accelerator corresponds to one element in the array.
|
||||
Accelerators []AcceleratorStats `json:"accelerators,omitempty"`
|
||||
|
||||
// ProcessStats for Containers
|
||||
Processes ProcessStats `json:"processes,omitempty"`
|
||||
|
||||
// Custom metrics from all collectors
|
||||
CustomMetrics map[string][]MetricVal `json:"custom_metrics,omitempty"`
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/info/v2/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/info/v2/BUILD
generated
vendored
@ -11,8 +11,8 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/info/v2",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
3
vendor/github.com/google/cadvisor/info/v2/container.go
generated
vendored
3
vendor/github.com/google/cadvisor/info/v2/container.go
generated
vendored
@ -38,7 +38,7 @@ type CpuSpec struct {
|
||||
Mask string `json:"mask,omitempty"`
|
||||
// CPUQuota Default is disabled
|
||||
Quota uint64 `json:"quota,omitempty"`
|
||||
// Period is the CPU reference time in ns e.g the quota is compared aginst this.
|
||||
// Period is the CPU reference time in ns e.g the quota is compared against this.
|
||||
Period uint64 `json:"period,omitempty"`
|
||||
}
|
||||
|
||||
@ -254,6 +254,7 @@ type ProcessInfo struct {
|
||||
RunningTime string `json:"running_time"`
|
||||
CgroupPath string `json:"cgroup_path"`
|
||||
Cmd string `json:"cmd"`
|
||||
FdCount int `json:"fd_count"`
|
||||
}
|
||||
|
||||
type TcpStat struct {
|
||||
|
10
vendor/github.com/google/cadvisor/info/v2/conversion.go
generated
vendored
10
vendor/github.com/google/cadvisor/info/v2/conversion.go
generated
vendored
@ -18,8 +18,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/info/v1"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
func machineFsStatsFromV1(fsStats []v1.FsStats) []MachineFsStats {
|
||||
@ -70,7 +70,7 @@ func MachineStatsFromV1(cont *v1.ContainerInfo) []MachineStats {
|
||||
stat.Cpu = &val.Cpu
|
||||
cpuInst, err := InstCpuStats(last, val)
|
||||
if err != nil {
|
||||
glog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
klog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
} else {
|
||||
stat.CpuInst = cpuInst
|
||||
}
|
||||
@ -107,7 +107,7 @@ func ContainerStatsFromV1(containerName string, spec *v1.ContainerSpec, stats []
|
||||
stat.Cpu = &val.Cpu
|
||||
cpuInst, err := InstCpuStats(last, val)
|
||||
if err != nil {
|
||||
glog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
klog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
} else {
|
||||
stat.CpuInst = cpuInst
|
||||
}
|
||||
@ -133,7 +133,7 @@ func ContainerStatsFromV1(containerName string, spec *v1.ContainerSpec, stats []
|
||||
}
|
||||
} else if len(val.Filesystem) > 1 && containerName != "/" {
|
||||
// Cannot handle multiple devices per container.
|
||||
glog.V(4).Infof("failed to handle multiple devices for container %s. Skipping Filesystem stats", containerName)
|
||||
klog.V(4).Infof("failed to handle multiple devices for container %s. Skipping Filesystem stats", containerName)
|
||||
}
|
||||
}
|
||||
if spec.HasDiskIo {
|
||||
@ -168,7 +168,7 @@ func DeprecatedStatsFromV1(cont *v1.ContainerInfo) []DeprecatedContainerStats {
|
||||
stat.Cpu = val.Cpu
|
||||
cpuInst, err := InstCpuStats(last, val)
|
||||
if err != nil {
|
||||
glog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
klog.Warningf("Could not get instant cpu stats: %v", err)
|
||||
} else {
|
||||
stat.CpuInst = cpuInst
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/machine/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/machine/BUILD
generated
vendored
@ -11,7 +11,6 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/docker/docker/pkg/parsers/operatingsystem:go_default_library",
|
||||
"//vendor/github.com/golang/glog: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",
|
||||
@ -19,6 +18,7 @@ go_library(
|
||||
"//vendor/github.com/google/cadvisor/utils/sysfs:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils/sysinfo:go_default_library",
|
||||
"//vendor/golang.org/x/sys/unix:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
14
vendor/github.com/google/cadvisor/machine/info.go
generated
vendored
14
vendor/github.com/google/cadvisor/machine/info.go
generated
vendored
@ -30,7 +30,7 @@ import (
|
||||
"github.com/google/cadvisor/utils/sysfs"
|
||||
"github.com/google/cadvisor/utils/sysinfo"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@ -50,7 +50,7 @@ func getInfoFromFiles(filePaths string) string {
|
||||
return strings.TrimSpace(string(id))
|
||||
}
|
||||
}
|
||||
glog.Warningf("Couldn't collect info from any of the files in %q", filePaths)
|
||||
klog.Warningf("Couldn't collect info from any of the files in %q", filePaths)
|
||||
return ""
|
||||
}
|
||||
|
||||
@ -117,27 +117,27 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach
|
||||
|
||||
filesystems, err := fsInfo.GetGlobalFsInfo()
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get global filesystem information: %v", err)
|
||||
klog.Errorf("Failed to get global filesystem information: %v", err)
|
||||
}
|
||||
|
||||
diskMap, err := sysinfo.GetBlockDeviceInfo(sysFs)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get disk map: %v", err)
|
||||
klog.Errorf("Failed to get disk map: %v", err)
|
||||
}
|
||||
|
||||
netDevices, err := sysinfo.GetNetworkDevices(sysFs)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get network devices: %v", err)
|
||||
klog.Errorf("Failed to get network devices: %v", err)
|
||||
}
|
||||
|
||||
topology, numCores, err := GetTopology(sysFs, string(cpuinfo))
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get topology information: %v", err)
|
||||
klog.Errorf("Failed to get topology information: %v", err)
|
||||
}
|
||||
|
||||
systemUUID, err := sysinfo.GetSystemUUID(sysFs)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to get system UUID: %v", err)
|
||||
klog.Errorf("Failed to get system UUID: %v", err)
|
||||
}
|
||||
|
||||
realCloudInfo := cloudinfo.NewRealCloudInfo()
|
||||
|
4
vendor/github.com/google/cadvisor/machine/machine.go
generated
vendored
4
vendor/github.com/google/cadvisor/machine/machine.go
generated
vendored
@ -30,7 +30,7 @@ import (
|
||||
"github.com/google/cadvisor/utils/sysfs"
|
||||
"github.com/google/cadvisor/utils/sysinfo"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@ -191,7 +191,7 @@ func GetTopology(sysFs sysfs.SysFs, cpuinfo string) ([]info.Node, int, error) {
|
||||
for idx, node := range nodes {
|
||||
caches, err := sysinfo.GetCacheInfo(sysFs, node.Cores[0].Threads[0])
|
||||
if err != nil {
|
||||
glog.Errorf("failed to get cache information for node %d: %v", node.Id, err)
|
||||
klog.Errorf("failed to get cache information for node %d: %v", node.Id, err)
|
||||
continue
|
||||
}
|
||||
numThreadsPerCore := len(node.Cores[0].Threads)
|
||||
|
2
vendor/github.com/google/cadvisor/manager/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/manager/BUILD
generated
vendored
@ -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",
|
||||
],
|
||||
)
|
||||
|
46
vendor/github.com/google/cadvisor/manager/container.go
generated
vendored
46
vendor/github.com/google/cadvisor/manager/container.go
generated
vendored
@ -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
|
||||
|
82
vendor/github.com/google/cadvisor/manager/manager.go
generated
vendored
82
vendor/github.com/google/cadvisor/manager/manager.go
generated
vendored
@ -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" {
|
||||
|
4
vendor/github.com/google/cadvisor/manager/watcher/raw/BUILD
generated
vendored
4
vendor/github.com/google/cadvisor/manager/watcher/raw/BUILD
generated
vendored
@ -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",
|
||||
],
|
||||
)
|
||||
|
||||
|
12
vendor/github.com/google/cadvisor/manager/watcher/raw/raw.go
generated
vendored
12
vendor/github.com/google/cadvisor/manager/watcher/raw/raw.go
generated
vendored
@ -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)
|
||||
|
2
vendor/github.com/google/cadvisor/manager/watcher/rkt/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/manager/watcher/rkt/BUILD
generated
vendored
@ -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",
|
||||
],
|
||||
)
|
||||
|
||||
|
10
vendor/github.com/google/cadvisor/manager/watcher/rkt/rkt.go
generated
vendored
10
vendor/github.com/google/cadvisor/manager/watcher/rkt/rkt.go
generated
vendored
@ -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)
|
||||
}
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/metrics/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/metrics/BUILD
generated
vendored
@ -7,10 +7,10 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/metrics",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
63
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
63
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
@ -22,8 +22,8 @@ import (
|
||||
"github.com/google/cadvisor/container"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// infoProvider will usually be manager.Manager, but can be swapped out for testing.
|
||||
@ -109,6 +109,7 @@ type PrometheusCollector struct {
|
||||
errors prometheus.Gauge
|
||||
containerMetrics []containerMetric
|
||||
containerLabelsFunc ContainerLabelsFunc
|
||||
includedMetrics container.MetricSet
|
||||
}
|
||||
|
||||
// NewPrometheusCollector returns a new PrometheusCollector. The passed
|
||||
@ -137,6 +138,7 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
|
||||
},
|
||||
},
|
||||
},
|
||||
includedMetrics: includedMetrics,
|
||||
}
|
||||
if includedMetrics.Has(container.CpuUsageMetrics) {
|
||||
c.containerMetrics = append(c.containerMetrics, []containerMetric{
|
||||
@ -336,7 +338,7 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
|
||||
name: "container_memory_failures_total",
|
||||
help: "Cumulative count of memory allocation failures.",
|
||||
valueType: prometheus.CounterValue,
|
||||
extraLabels: []string{"type", "scope"},
|
||||
extraLabels: []string{"failure_type", "scope"},
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{
|
||||
{
|
||||
@ -835,6 +837,26 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
|
||||
},
|
||||
}...)
|
||||
}
|
||||
if includedMetrics.Has(container.ProcessMetrics) {
|
||||
c.containerMetrics = append(c.containerMetrics, []containerMetric{
|
||||
{
|
||||
name: "container_processes",
|
||||
help: "Number of processes running inside the container.",
|
||||
valueType: prometheus.GaugeValue,
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Processes.ProcessCount)}}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "container_file_descriptors",
|
||||
help: "Number of open file descriptors for the container.",
|
||||
valueType: prometheus.GaugeValue,
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Processes.FdCount)}}
|
||||
},
|
||||
},
|
||||
}...)
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
@ -917,7 +939,7 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
||||
containers, err := c.infoProvider.SubcontainersInfo("/", &info.ContainerInfoRequest{NumStats: 1})
|
||||
if err != nil {
|
||||
c.errors.Set(1)
|
||||
glog.Warningf("Couldn't get containers: %s", err)
|
||||
klog.Warningf("Couldn't get containers: %s", err)
|
||||
return
|
||||
}
|
||||
rawLabels := map[string]struct{}{}
|
||||
@ -926,10 +948,11 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
||||
rawLabels[l] = struct{}{}
|
||||
}
|
||||
}
|
||||
for _, container := range containers {
|
||||
|
||||
for _, cont := range containers {
|
||||
values := make([]string, 0, len(rawLabels))
|
||||
labels := make([]string, 0, len(rawLabels))
|
||||
containerLabels := c.containerLabelsFunc(container)
|
||||
containerLabels := c.containerLabelsFunc(cont)
|
||||
for l := range rawLabels {
|
||||
labels = append(labels, sanitizeLabelName(l))
|
||||
values = append(values, containerLabels[l])
|
||||
@ -937,35 +960,35 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
||||
|
||||
// Container spec
|
||||
desc := prometheus.NewDesc("container_start_time_seconds", "Start time of the container since unix epoch in seconds.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(container.Spec.CreationTime.Unix()), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(cont.Spec.CreationTime.Unix()), values...)
|
||||
|
||||
if container.Spec.HasCpu {
|
||||
if cont.Spec.HasCpu {
|
||||
desc = prometheus.NewDesc("container_spec_cpu_period", "CPU period of the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(container.Spec.Cpu.Period), values...)
|
||||
if container.Spec.Cpu.Quota != 0 {
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(cont.Spec.Cpu.Period), values...)
|
||||
if cont.Spec.Cpu.Quota != 0 {
|
||||
desc = prometheus.NewDesc("container_spec_cpu_quota", "CPU quota of the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(container.Spec.Cpu.Quota), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(cont.Spec.Cpu.Quota), values...)
|
||||
}
|
||||
desc := prometheus.NewDesc("container_spec_cpu_shares", "CPU share of the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(container.Spec.Cpu.Limit), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(cont.Spec.Cpu.Limit), values...)
|
||||
|
||||
}
|
||||
if container.Spec.HasMemory {
|
||||
if cont.Spec.HasMemory {
|
||||
desc := prometheus.NewDesc("container_spec_memory_limit_bytes", "Memory limit for the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.Limit), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(cont.Spec.Memory.Limit), values...)
|
||||
desc = prometheus.NewDesc("container_spec_memory_swap_limit_bytes", "Memory swap limit for the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.SwapLimit), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(cont.Spec.Memory.SwapLimit), values...)
|
||||
desc = prometheus.NewDesc("container_spec_memory_reservation_limit_bytes", "Memory reservation limit for the container.", labels, nil)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.Reservation), values...)
|
||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(cont.Spec.Memory.Reservation), values...)
|
||||
}
|
||||
|
||||
// Now for the actual metrics
|
||||
if len(container.Stats) == 0 {
|
||||
if len(cont.Stats) == 0 {
|
||||
continue
|
||||
}
|
||||
stats := container.Stats[0]
|
||||
stats := cont.Stats[0]
|
||||
for _, cm := range c.containerMetrics {
|
||||
if cm.condition != nil && !cm.condition(container.Spec) {
|
||||
if cm.condition != nil && !cm.condition(cont.Spec) {
|
||||
continue
|
||||
}
|
||||
desc := cm.desc(labels)
|
||||
@ -980,7 +1003,7 @@ func (c *PrometheusCollector) collectVersionInfo(ch chan<- prometheus.Metric) {
|
||||
versionInfo, err := c.infoProvider.GetVersionInfo()
|
||||
if err != nil {
|
||||
c.errors.Set(1)
|
||||
glog.Warningf("Couldn't get version info: %s", err)
|
||||
klog.Warningf("Couldn't get version info: %s", err)
|
||||
return
|
||||
}
|
||||
ch <- prometheus.MustNewConstMetric(versionInfoDesc, prometheus.GaugeValue, 1, []string{versionInfo.KernelVersion, versionInfo.ContainerOsVersion, versionInfo.DockerVersion, versionInfo.CadvisorVersion, versionInfo.CadvisorRevision}...)
|
||||
@ -990,7 +1013,7 @@ func (c *PrometheusCollector) collectMachineInfo(ch chan<- prometheus.Metric) {
|
||||
machineInfo, err := c.infoProvider.GetMachineInfo()
|
||||
if err != nil {
|
||||
c.errors.Set(1)
|
||||
glog.Warningf("Couldn't get machine info: %s", err)
|
||||
klog.Warningf("Couldn't get machine info: %s", err)
|
||||
return
|
||||
}
|
||||
ch <- prometheus.MustNewConstMetric(machineInfoCoresDesc, prometheus.GaugeValue, float64(machineInfo.NumCores))
|
||||
|
2
vendor/github.com/google/cadvisor/utils/cloudinfo/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/utils/cloudinfo/BUILD
generated
vendored
@ -16,8 +16,8 @@ go_library(
|
||||
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
|
||||
"//vendor/github.com/aws/aws-sdk-go/aws/ec2metadata:go_default_library",
|
||||
"//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/utils/cloudinfo/gce.go
generated
vendored
4
vendor/github.com/google/cadvisor/utils/cloudinfo/gce.go
generated
vendored
@ -21,7 +21,7 @@ import (
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -32,7 +32,7 @@ const (
|
||||
func onGCE() bool {
|
||||
data, err := ioutil.ReadFile(gceProductName)
|
||||
if err != nil {
|
||||
glog.V(2).Infof("Error while reading product_name: %v", err)
|
||||
klog.V(2).Infof("Error while reading product_name: %v", err)
|
||||
return false
|
||||
}
|
||||
return strings.Contains(string(data), google)
|
||||
|
2
vendor/github.com/google/cadvisor/utils/cpuload/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/utils/cpuload/BUILD
generated
vendored
@ -7,9 +7,9 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/utils/cpuload",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/utils/cpuload/netlink:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
4
vendor/github.com/google/cadvisor/utils/cpuload/cpuload.go
generated
vendored
4
vendor/github.com/google/cadvisor/utils/cpuload/cpuload.go
generated
vendored
@ -19,8 +19,8 @@ import (
|
||||
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/utils/cpuload/netlink"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type CpuLoadReader interface {
|
||||
@ -41,6 +41,6 @@ func New() (CpuLoadReader, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create a netlink based cpuload reader: %v", err)
|
||||
}
|
||||
glog.V(4).Info("Using a netlink-based load reader")
|
||||
klog.V(4).Info("Using a netlink-based load reader")
|
||||
return reader, nil
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/utils/cpuload/netlink/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/utils/cpuload/netlink/BUILD
generated
vendored
@ -13,8 +13,8 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/utils/cpuload/netlink",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/google/cadvisor/utils/cpuload/netlink/reader.go
generated
vendored
6
vendor/github.com/google/cadvisor/utils/cpuload/netlink/reader.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
type NetlinkReader struct {
|
||||
@ -38,7 +38,7 @@ func New() (*NetlinkReader, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get netlink family id for task stats: %s", err)
|
||||
}
|
||||
glog.V(4).Infof("Family id for taskstats: %d", id)
|
||||
klog.V(4).Infof("Family id for taskstats: %d", id)
|
||||
return &NetlinkReader{
|
||||
familyId: id,
|
||||
conn: conn,
|
||||
@ -75,6 +75,6 @@ func (self *NetlinkReader) GetCpuLoad(name string, path string) (info.LoadStats,
|
||||
if err != nil {
|
||||
return info.LoadStats{}, err
|
||||
}
|
||||
glog.V(4).Infof("Task stats for %q: %+v", path, stats)
|
||||
klog.V(4).Infof("Task stats for %q: %+v", path, stats)
|
||||
return stats, nil
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/utils/oomparser/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/utils/oomparser/BUILD
generated
vendored
@ -8,7 +8,7 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/euank/go-kmsg-parser/kmsgparser:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
14
vendor/github.com/google/cadvisor/utils/oomparser/oomparser.go
generated
vendored
14
vendor/github.com/google/cadvisor/utils/oomparser/oomparser.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/euank/go-kmsg-parser/kmsgparser"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -107,11 +107,11 @@ func (self *OomParser) StreamOoms(outStream chan<- *OomInstance) {
|
||||
for msg := range kmsgEntries {
|
||||
err := getContainerName(msg.Message, oomCurrentInstance)
|
||||
if err != nil {
|
||||
glog.Errorf("%v", err)
|
||||
klog.Errorf("%v", err)
|
||||
}
|
||||
finished, err := getProcessNamePid(msg.Message, oomCurrentInstance)
|
||||
if err != nil {
|
||||
glog.Errorf("%v", err)
|
||||
klog.Errorf("%v", err)
|
||||
}
|
||||
if finished {
|
||||
oomCurrentInstance.TimeOfDeath = msg.Timestamp
|
||||
@ -122,7 +122,7 @@ func (self *OomParser) StreamOoms(outStream chan<- *OomInstance) {
|
||||
}
|
||||
}
|
||||
// Should not happen
|
||||
glog.Errorf("exiting analyzeLines. OOM events will not be reported.")
|
||||
klog.Errorf("exiting analyzeLines. OOM events will not be reported.")
|
||||
}
|
||||
|
||||
// initializes an OomParser object. Returns an OomParser object and an error.
|
||||
@ -140,11 +140,11 @@ type glogAdapter struct{}
|
||||
var _ kmsgparser.Logger = glogAdapter{}
|
||||
|
||||
func (glogAdapter) Infof(format string, args ...interface{}) {
|
||||
glog.V(4).Infof(format, args)
|
||||
klog.V(4).Infof(format, args...)
|
||||
}
|
||||
func (glogAdapter) Warningf(format string, args ...interface{}) {
|
||||
glog.V(2).Infof(format, args)
|
||||
klog.V(2).Infof(format, args...)
|
||||
}
|
||||
func (glogAdapter) Errorf(format string, args ...interface{}) {
|
||||
glog.Warningf(format, args)
|
||||
klog.Warningf(format, args...)
|
||||
}
|
||||
|
2
vendor/github.com/google/cadvisor/zfs/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/zfs/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "github.com/google/cadvisor/zfs",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/mistifyio/go-zfs:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
12
vendor/github.com/google/cadvisor/zfs/watcher.go
generated
vendored
12
vendor/github.com/google/cadvisor/zfs/watcher.go
generated
vendored
@ -18,8 +18,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
zfs "github.com/mistifyio/go-zfs"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// zfsWatcher maintains a cache of filesystem -> usage stats for a
|
||||
@ -49,7 +49,7 @@ func NewZfsWatcher(filesystem string) (*ZfsWatcher, error) {
|
||||
func (w *ZfsWatcher) Start() {
|
||||
err := w.Refresh()
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error refreshing zfs watcher: %v", err)
|
||||
klog.Errorf("encountered error refreshing zfs watcher: %v", err)
|
||||
}
|
||||
|
||||
for {
|
||||
@ -60,12 +60,12 @@ func (w *ZfsWatcher) Start() {
|
||||
start := time.Now()
|
||||
err = w.Refresh()
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error refreshing zfs watcher: %v", err)
|
||||
klog.Errorf("encountered error refreshing zfs watcher: %v", err)
|
||||
}
|
||||
|
||||
// print latency for refresh
|
||||
duration := time.Since(start)
|
||||
glog.V(5).Infof("zfs(%d) took %s", start.Unix(), duration)
|
||||
klog.V(5).Infof("zfs(%d) took %s", start.Unix(), duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,12 +95,12 @@ func (w *ZfsWatcher) Refresh() error {
|
||||
newCache := make(map[string]uint64)
|
||||
parent, err := zfs.GetDataset(w.filesystem)
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error getting zfs filesystem: %s: %v", w.filesystem, err)
|
||||
klog.Errorf("encountered error getting zfs filesystem: %s: %v", w.filesystem, err)
|
||||
return err
|
||||
}
|
||||
children, err := parent.Children(0)
|
||||
if err != nil {
|
||||
glog.Errorf("encountered error getting children of zfs filesystem: %s: %v", w.filesystem, err)
|
||||
klog.Errorf("encountered error getting children of zfs filesystem: %s: %v", w.filesystem, err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
14
vendor/github.com/karrick/godirwalk/.gitignore
generated
vendored
Normal file
14
vendor/github.com/karrick/godirwalk/.gitignore
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||
.glide/
|
35
vendor/github.com/karrick/godirwalk/BUILD
generated
vendored
Normal file
35
vendor/github.com/karrick/godirwalk/BUILD
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"dirent.go",
|
||||
"doc.go",
|
||||
"readdir.go",
|
||||
"readdir_unix.go",
|
||||
"readdir_windows.go",
|
||||
"walk.go",
|
||||
"withFileno.go",
|
||||
"withIno.go",
|
||||
"withNamlen.go",
|
||||
"withoutNamlen.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/karrick/godirwalk",
|
||||
importpath = "github.com/karrick/godirwalk",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/github.com/pkg/errors:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
25
vendor/github.com/karrick/godirwalk/LICENSE
generated
vendored
Normal file
25
vendor/github.com/karrick/godirwalk/LICENSE
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2017, Karrick McDermott
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
208
vendor/github.com/karrick/godirwalk/README.md
generated
vendored
Normal file
208
vendor/github.com/karrick/godirwalk/README.md
generated
vendored
Normal file
@ -0,0 +1,208 @@
|
||||
# godirwalk
|
||||
|
||||
`godirwalk` is a library for traversing a directory tree on a file
|
||||
system.
|
||||
|
||||
In short, why do I use this library?
|
||||
|
||||
1. It's faster than `filepath.Walk`.
|
||||
1. It's more correct on Windows than `filepath.Walk`.
|
||||
1. It's more easy to use than `filepath.Walk`.
|
||||
1. It's more flexible than `filepath.Walk`.
|
||||
|
||||
## Usage Example
|
||||
|
||||
Additional examples are provided in the `examples/` subdirectory.
|
||||
|
||||
This library will normalize the provided top level directory name
|
||||
based on the os-specific path separator by calling `filepath.Clean` on
|
||||
its first argument. However it always provides the pathname created by
|
||||
using the correct os-specific path separator when invoking the
|
||||
provided callback function.
|
||||
|
||||
```Go
|
||||
dirname := "some/directory/root"
|
||||
err := godirwalk.Walk(dirname, &godirwalk.Options{
|
||||
Callback: func(osPathname string, de *godirwalk.Dirent) error {
|
||||
fmt.Printf("%s %s\n", de.ModeType(), osPathname)
|
||||
return nil
|
||||
},
|
||||
Unsorted: true, // (optional) set true for faster yet non-deterministic enumeration (see godoc)
|
||||
})
|
||||
```
|
||||
|
||||
This library not only provides functions for traversing a file system
|
||||
directory tree, but also for obtaining a list of immediate descendants
|
||||
of a particular directory, typically much more quickly than using
|
||||
`os.ReadDir` or `os.ReadDirnames`.
|
||||
|
||||
Documentation is available via
|
||||
[](https://godoc.org/github.com/karrick/godirwalk).
|
||||
|
||||
## Description
|
||||
|
||||
Here's why I use `godirwalk` in preference to `filepath.Walk`,
|
||||
`os.ReadDir`, and `os.ReadDirnames`.
|
||||
|
||||
### It's faster than `filepath.Walk`
|
||||
|
||||
When compared against `filepath.Walk` in benchmarks, it has been
|
||||
observed to run between five and ten times the speed on darwin, at
|
||||
speeds comparable to the that of the unix `find` utility; about twice
|
||||
the speed on linux; and about four times the speed on Windows.
|
||||
|
||||
How does it obtain this performance boost? It does less work to give
|
||||
you nearly the same output. This library calls the same `syscall`
|
||||
functions to do the work, but it makes fewer calls, does not throw
|
||||
away information that it might need, and creates less memory churn
|
||||
along the way by reusing the same scratch buffer rather than
|
||||
reallocating a new buffer every time it reads data from the operating
|
||||
system.
|
||||
|
||||
While traversing a file system directory tree, `filepath.Walk` obtains
|
||||
the list of immediate descendants of a directory, and throws away the
|
||||
file system node type information provided by the operating system
|
||||
that comes with the node's name. Then, immediately prior to invoking
|
||||
the callback function, `filepath.Walk` invokes `os.Stat` for each
|
||||
node, and passes the returned `os.FileInfo` information to the
|
||||
callback.
|
||||
|
||||
While the `os.FileInfo` information provided by `os.Stat` is extremely
|
||||
helpful--and even includes the `os.FileMode` data--providing it
|
||||
requires an additional system call for each node.
|
||||
|
||||
Because most callbacks only care about what the node type is, this
|
||||
library does not throw the type information away, but rather provides
|
||||
that information to the callback function in the form of a
|
||||
`os.FileMode` value. Note that the provided `os.FileMode` value that
|
||||
this library provides only has the node type information, and does not
|
||||
have the permission bits, sticky bits, or other information from the
|
||||
file's mode. If the callback does care about a particular node's
|
||||
entire `os.FileInfo` data structure, the callback can easiy invoke
|
||||
`os.Stat` when needed, and only when needed.
|
||||
|
||||
#### Benchmarks
|
||||
|
||||
##### macOS
|
||||
|
||||
```Bash
|
||||
go test -bench=.
|
||||
goos: darwin
|
||||
goarch: amd64
|
||||
pkg: github.com/karrick/godirwalk
|
||||
BenchmarkFilepathWalk-8 1 3001274570 ns/op
|
||||
BenchmarkGoDirWalk-8 3 465573172 ns/op
|
||||
BenchmarkFlameGraphFilepathWalk-8 1 6957916936 ns/op
|
||||
BenchmarkFlameGraphGoDirWalk-8 1 4210582571 ns/op
|
||||
PASS
|
||||
ok github.com/karrick/godirwalk 16.822s
|
||||
```
|
||||
|
||||
##### Linux
|
||||
|
||||
```Bash
|
||||
go test -bench=.
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/karrick/godirwalk
|
||||
BenchmarkFilepathWalk-12 1 1609189170 ns/op
|
||||
BenchmarkGoDirWalk-12 5 211336628 ns/op
|
||||
BenchmarkFlameGraphFilepathWalk-12 1 3968119932 ns/op
|
||||
BenchmarkFlameGraphGoDirWalk-12 1 2139598998 ns/op
|
||||
PASS
|
||||
ok github.com/karrick/godirwalk 9.007s
|
||||
```
|
||||
|
||||
### It's more correct on Windows than `filepath.Walk`
|
||||
|
||||
I did not previously care about this either, but humor me. We all love
|
||||
how we can write once and run everywhere. It is essential for the
|
||||
language's adoption, growth, and success, that the software we create
|
||||
can run unmodified on all architectures and operating systems
|
||||
supported by Go.
|
||||
|
||||
When the traversed file system has a logical loop caused by symbolic
|
||||
links to directories, on unix `filepath.Walk` ignores symbolic links
|
||||
and traverses the entire directory tree without error. On Windows
|
||||
however, `filepath.Walk` will continue following directory symbolic
|
||||
links, even though it is not supposed to, eventually causing
|
||||
`filepath.Walk` to terminate early and return an error when the
|
||||
pathname gets too long from concatenating endless loops of symbolic
|
||||
links onto the pathname. This error comes from Windows, passes through
|
||||
`filepath.Walk`, and to the upstream client running `filepath.Walk`.
|
||||
|
||||
The takeaway is that behavior is different based on which platform
|
||||
`filepath.Walk` is running. While this is clearly not intentional,
|
||||
until it is fixed in the standard library, it presents a compatibility
|
||||
problem.
|
||||
|
||||
This library correctly identifies symbolic links that point to
|
||||
directories and will only follow them when `FollowSymbolicLinks` is
|
||||
set to true. Behavior on Windows and other operating systems is
|
||||
identical.
|
||||
|
||||
### It's more easy to use than `filepath.Walk`
|
||||
|
||||
Since this library does not invoke `os.Stat` on every file system node
|
||||
it encounters, there is no possible error event for the callback
|
||||
function to filter on. The third argument in the `filepath.WalkFunc`
|
||||
function signature to pass the error from `os.Stat` to the callback
|
||||
function is no longer necessary, and thus eliminated from signature of
|
||||
the callback function from this library.
|
||||
|
||||
Also, `filepath.Walk` invokes the callback function with a solidus
|
||||
delimited pathname regardless of the os-specific path separator. This
|
||||
library invokes the callback function with the os-specific pathname
|
||||
separator, obviating a call to `filepath.Clean` in the callback
|
||||
function for each node prior to actually using the provided pathname.
|
||||
|
||||
In other words, even on Windows, `filepath.Walk` will invoke the
|
||||
callback with `some/path/to/foo.txt`, requiring well written clients
|
||||
to perform pathname normalization for every file prior to working with
|
||||
the specified file. In truth, many clients developed on unix and not
|
||||
tested on Windows neglect this subtlety, and will result in software
|
||||
bugs when running on Windows. This library would invoke the callback
|
||||
function with `some\path\to\foo.txt` for the same file when running on
|
||||
Windows, eliminating the need to normalize the pathname by the client,
|
||||
and lessen the likelyhood that a client will work on unix but not on
|
||||
Windows.
|
||||
|
||||
### It's more flexible than `filepath.Walk`
|
||||
|
||||
#### Configurable Handling of Symbolic Links
|
||||
|
||||
The default behavior of this library is to ignore symbolic links to
|
||||
directories when walking a directory tree, just like `filepath.Walk`
|
||||
does. However, it does invoke the callback function with each node it
|
||||
finds, including symbolic links. If a particular use case exists to
|
||||
follow symbolic links when traversing a directory tree, this library
|
||||
can be invoked in manner to do so, by setting the
|
||||
`FollowSymbolicLinks` parameter to true.
|
||||
|
||||
#### Configurable Sorting of Directory Children
|
||||
|
||||
The default behavior of this library is to always sort the immediate
|
||||
descendants of a directory prior to visiting each node, just like
|
||||
`filepath.Walk` does. This is usually the desired behavior. However,
|
||||
this does come at a performance penalty to sort the names when a
|
||||
directory node has many entries. If a particular use case exists that
|
||||
does not require sorting the directory's immediate descendants prior
|
||||
to visiting its nodes, this library will skip the sorting step when
|
||||
the `Unsorted` parameter is set to true.
|
||||
|
||||
#### Configurable Post Children Callback
|
||||
|
||||
This library provides upstream code with the ability to specify a
|
||||
callback to be invoked for each directory after its children are
|
||||
processed. This has been used to recursively delete empty directories
|
||||
after traversing the file system in a more efficient manner. See the
|
||||
`examples/clean-empties` directory for an example of this usage.
|
||||
|
||||
#### Configurable Error Callback
|
||||
|
||||
This library provides upstream code with the ability to specify a
|
||||
callback to be invoked for errors that the operating system returns,
|
||||
allowing the upstream code to determine the next course of action to
|
||||
take, whether to halt walking the hierarchy, as it would do were no
|
||||
error callback provided, or skip the node that caused the error. See
|
||||
the `examples/walk-fast` directory for an example of this usage.
|
74
vendor/github.com/karrick/godirwalk/dirent.go
generated
vendored
Normal file
74
vendor/github.com/karrick/godirwalk/dirent.go
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Dirent stores the name and file system mode type of discovered file system
|
||||
// entries.
|
||||
type Dirent struct {
|
||||
name string
|
||||
modeType os.FileMode
|
||||
}
|
||||
|
||||
// NewDirent returns a newly initialized Dirent structure, or an error. This
|
||||
// function does not follow symbolic links.
|
||||
//
|
||||
// This function is rarely used, as Dirent structures are provided by other
|
||||
// functions in this library that read and walk directories.
|
||||
func NewDirent(osPathname string) (*Dirent, error) {
|
||||
fi, err := os.Lstat(osPathname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot lstat")
|
||||
}
|
||||
return &Dirent{
|
||||
name: filepath.Base(osPathname),
|
||||
modeType: fi.Mode() & os.ModeType,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Name returns the basename of the file system entry.
|
||||
func (de Dirent) Name() string { return de.name }
|
||||
|
||||
// ModeType returns the mode bits that specify the file system node type. We
|
||||
// could make our own enum-like data type for encoding the file type, but Go's
|
||||
// runtime already gives us architecture independent file modes, as discussed in
|
||||
// `os/types.go`:
|
||||
//
|
||||
// Go's runtime FileMode type has same definition on all systems, so that
|
||||
// information about files can be moved from one system to another portably.
|
||||
func (de Dirent) ModeType() os.FileMode { return de.modeType }
|
||||
|
||||
// IsDir returns true if and only if the Dirent represents a file system
|
||||
// directory. Note that on some operating systems, more than one file mode bit
|
||||
// may be set for a node. For instance, on Windows, a symbolic link that points
|
||||
// to a directory will have both the directory and the symbolic link bits set.
|
||||
func (de Dirent) IsDir() bool { return de.modeType&os.ModeDir != 0 }
|
||||
|
||||
// IsRegular returns true if and only if the Dirent represents a regular
|
||||
// file. That is, it ensures that no mode type bits are set.
|
||||
func (de Dirent) IsRegular() bool { return de.modeType&os.ModeType == 0 }
|
||||
|
||||
// IsSymlink returns true if and only if the Dirent represents a file system
|
||||
// symbolic link. Note that on some operating systems, more than one file mode
|
||||
// bit may be set for a node. For instance, on Windows, a symbolic link that
|
||||
// points to a directory will have both the directory and the symbolic link bits
|
||||
// set.
|
||||
func (de Dirent) IsSymlink() bool { return de.modeType&os.ModeSymlink != 0 }
|
||||
|
||||
// Dirents represents a slice of Dirent pointers, which are sortable by
|
||||
// name. This type satisfies the `sort.Interface` interface.
|
||||
type Dirents []*Dirent
|
||||
|
||||
// Len returns the count of Dirent structures in the slice.
|
||||
func (l Dirents) Len() int { return len(l) }
|
||||
|
||||
// Less returns true if and only if the Name of the element specified by the
|
||||
// first index is lexicographically less than that of the second index.
|
||||
func (l Dirents) Less(i, j int) bool { return l[i].name < l[j].name }
|
||||
|
||||
// Swap exchanges the two Dirent entries specified by the two provided indexes.
|
||||
func (l Dirents) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
34
vendor/github.com/karrick/godirwalk/doc.go
generated
vendored
Normal file
34
vendor/github.com/karrick/godirwalk/doc.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Package godirwalk provides functions to read and traverse directory trees.
|
||||
|
||||
In short, why do I use this library?
|
||||
|
||||
* It's faster than `filepath.Walk`.
|
||||
|
||||
* It's more correct on Windows than `filepath.Walk`.
|
||||
|
||||
* It's more easy to use than `filepath.Walk`.
|
||||
|
||||
* It's more flexible than `filepath.Walk`.
|
||||
|
||||
USAGE
|
||||
|
||||
This library will normalize the provided top level directory name based on the
|
||||
os-specific path separator by calling `filepath.Clean` on its first
|
||||
argument. However it always provides the pathname created by using the correct
|
||||
os-specific path separator when invoking the provided callback function.
|
||||
|
||||
dirname := "some/directory/root"
|
||||
err := godirwalk.Walk(dirname, &godirwalk.Options{
|
||||
Callback: func(osPathname string, de *godirwalk.Dirent) error {
|
||||
fmt.Printf("%s %s\n", de.ModeType(), osPathname)
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
This library not only provides functions for traversing a file system directory
|
||||
tree, but also for obtaining a list of immediate descendants of a particular
|
||||
directory, typically much more quickly than using `os.ReadDir` or
|
||||
`os.ReadDirnames`.
|
||||
*/
|
||||
package godirwalk
|
3
vendor/github.com/karrick/godirwalk/go.mod
generated
vendored
Normal file
3
vendor/github.com/karrick/godirwalk/go.mod
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/karrick/godirwalk
|
||||
|
||||
require github.com/pkg/errors v0.8.0
|
1
vendor/github.com/karrick/godirwalk/go.sum
generated
vendored
Normal file
1
vendor/github.com/karrick/godirwalk/go.sum
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
47
vendor/github.com/karrick/godirwalk/readdir.go
generated
vendored
Normal file
47
vendor/github.com/karrick/godirwalk/readdir.go
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
package godirwalk
|
||||
|
||||
// ReadDirents returns a sortable slice of pointers to Dirent structures, each
|
||||
// representing the file system name and mode type for one of the immediate
|
||||
// descendant of the specified directory. If the specified directory is a
|
||||
// symbolic link, it will be resolved.
|
||||
//
|
||||
// If an optional scratch buffer is provided that is at least one page of
|
||||
// memory, it will be used when reading directory entries from the file system.
|
||||
//
|
||||
// children, err := godirwalk.ReadDirents(osDirname, nil)
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "cannot get list of directory children")
|
||||
// }
|
||||
// sort.Sort(children)
|
||||
// for _, child := range children {
|
||||
// fmt.Printf("%s %s\n", child.ModeType, child.Name)
|
||||
// }
|
||||
func ReadDirents(osDirname string, scratchBuffer []byte) (Dirents, error) {
|
||||
return readdirents(osDirname, scratchBuffer)
|
||||
}
|
||||
|
||||
// ReadDirnames returns a slice of strings, representing the immediate
|
||||
// descendants of the specified directory. If the specified directory is a
|
||||
// symbolic link, it will be resolved.
|
||||
//
|
||||
// If an optional scratch buffer is provided that is at least one page of
|
||||
// memory, it will be used when reading directory entries from the file system.
|
||||
//
|
||||
// Note that this function, depending on operating system, may or may not invoke
|
||||
// the ReadDirents function, in order to prepare the list of immediate
|
||||
// descendants. Therefore, if your program needs both the names and the file
|
||||
// system mode types of descendants, it will always be faster to invoke
|
||||
// ReadDirents directly, rather than calling this function, then looping over
|
||||
// the results and calling os.Stat for each child.
|
||||
//
|
||||
// children, err := godirwalk.ReadDirnames(osDirname, nil)
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "cannot get list of directory children")
|
||||
// }
|
||||
// sort.Strings(children)
|
||||
// for _, child := range children {
|
||||
// fmt.Printf("%s\n", child)
|
||||
// }
|
||||
func ReadDirnames(osDirname string, scratchBuffer []byte) ([]string, error) {
|
||||
return readdirnames(osDirname, scratchBuffer)
|
||||
}
|
109
vendor/github.com/karrick/godirwalk/readdir_unix.go
generated
vendored
Normal file
109
vendor/github.com/karrick/godirwalk/readdir_unix.go
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
// +build darwin freebsd linux netbsd openbsd
|
||||
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func readdirents(osDirname string, scratchBuffer []byte) (Dirents, error) {
|
||||
dh, err := os.Open(osDirname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot Open")
|
||||
}
|
||||
|
||||
var entries Dirents
|
||||
|
||||
fd := int(dh.Fd())
|
||||
|
||||
if len(scratchBuffer) < MinimumScratchBufferSize {
|
||||
scratchBuffer = make([]byte, DefaultScratchBufferSize)
|
||||
}
|
||||
|
||||
var de *syscall.Dirent
|
||||
|
||||
for {
|
||||
n, err := syscall.ReadDirent(fd, scratchBuffer)
|
||||
if err != nil {
|
||||
_ = dh.Close() // ignore potential error returned by Close
|
||||
return nil, errors.Wrap(err, "cannot ReadDirent")
|
||||
}
|
||||
if n <= 0 {
|
||||
break // end of directory reached
|
||||
}
|
||||
// Loop over the bytes returned by reading the directory entries.
|
||||
buf := scratchBuffer[:n]
|
||||
for len(buf) > 0 {
|
||||
de = (*syscall.Dirent)(unsafe.Pointer(&buf[0])) // point entry to first syscall.Dirent in buffer
|
||||
buf = buf[de.Reclen:] // advance buffer
|
||||
|
||||
if inoFromDirent(de) == 0 {
|
||||
continue // this item has been deleted, but not yet removed from directory
|
||||
}
|
||||
|
||||
nameSlice := nameFromDirent(de)
|
||||
namlen := len(nameSlice)
|
||||
if (namlen == 0) || (namlen == 1 && nameSlice[0] == '.') || (namlen == 2 && nameSlice[0] == '.' && nameSlice[1] == '.') {
|
||||
continue // skip unimportant entries
|
||||
}
|
||||
osChildname := string(nameSlice)
|
||||
|
||||
// Convert syscall constant, which is in purview of OS, to a
|
||||
// constant defined by Go, assumed by this project to be stable.
|
||||
var mode os.FileMode
|
||||
switch de.Type {
|
||||
case syscall.DT_REG:
|
||||
// regular file
|
||||
case syscall.DT_DIR:
|
||||
mode = os.ModeDir
|
||||
case syscall.DT_LNK:
|
||||
mode = os.ModeSymlink
|
||||
case syscall.DT_CHR:
|
||||
mode = os.ModeDevice | os.ModeCharDevice
|
||||
case syscall.DT_BLK:
|
||||
mode = os.ModeDevice
|
||||
case syscall.DT_FIFO:
|
||||
mode = os.ModeNamedPipe
|
||||
case syscall.DT_SOCK:
|
||||
mode = os.ModeSocket
|
||||
default:
|
||||
// If syscall returned unknown type (e.g., DT_UNKNOWN, DT_WHT),
|
||||
// then resolve actual mode by getting stat.
|
||||
fi, err := os.Lstat(filepath.Join(osDirname, osChildname))
|
||||
if err != nil {
|
||||
_ = dh.Close() // ignore potential error returned by Close
|
||||
return nil, errors.Wrap(err, "cannot Stat")
|
||||
}
|
||||
// We only care about the bits that identify the type of a file
|
||||
// system node, and can ignore append, exclusive, temporary,
|
||||
// setuid, setgid, permission bits, and sticky bits, which are
|
||||
// coincident to the bits that declare type of the file system
|
||||
// node.
|
||||
mode = fi.Mode() & os.ModeType
|
||||
}
|
||||
|
||||
entries = append(entries, &Dirent{name: osChildname, modeType: mode})
|
||||
}
|
||||
}
|
||||
if err = dh.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
func readdirnames(osDirname string, scratchBuffer []byte) ([]string, error) {
|
||||
des, err := readdirents(osDirname, scratchBuffer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
names := make([]string, len(des))
|
||||
for i, v := range des {
|
||||
names[i] = v.name
|
||||
}
|
||||
return names, nil
|
||||
}
|
54
vendor/github.com/karrick/godirwalk/readdir_windows.go
generated
vendored
Normal file
54
vendor/github.com/karrick/godirwalk/readdir_windows.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// The functions in this file are mere wrappers of what is already provided by
|
||||
// standard library, in order to provide the same API as this library provides.
|
||||
//
|
||||
// The scratch buffer argument is ignored by this architecture.
|
||||
//
|
||||
// Please send PR or link to article if you know of a more performant way of
|
||||
// enumerating directory contents and mode types on Windows.
|
||||
|
||||
func readdirents(osDirname string, _ []byte) (Dirents, error) {
|
||||
dh, err := os.Open(osDirname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot Open")
|
||||
}
|
||||
|
||||
fileinfos, err := dh.Readdir(0)
|
||||
if er := dh.Close(); err == nil {
|
||||
err = er
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot Readdir")
|
||||
}
|
||||
|
||||
entries := make(Dirents, len(fileinfos))
|
||||
for i, info := range fileinfos {
|
||||
entries[i] = &Dirent{name: info.Name(), modeType: info.Mode() & os.ModeType}
|
||||
}
|
||||
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
func readdirnames(osDirname string, _ []byte) ([]string, error) {
|
||||
dh, err := os.Open(osDirname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot Open")
|
||||
}
|
||||
|
||||
entries, err := dh.Readdirnames(0)
|
||||
if er := dh.Close(); err == nil {
|
||||
err = er
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot Readdirnames")
|
||||
}
|
||||
|
||||
return entries, nil
|
||||
}
|
367
vendor/github.com/karrick/godirwalk/walk.go
generated
vendored
Normal file
367
vendor/github.com/karrick/godirwalk/walk.go
generated
vendored
Normal file
@ -0,0 +1,367 @@
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DefaultScratchBufferSize specifies the size of the scratch buffer that will
|
||||
// be allocated by Walk, ReadDirents, or ReadDirnames when a scratch buffer is
|
||||
// not provided or the scratch buffer that is provided is smaller than
|
||||
// MinimumScratchBufferSize bytes. This may seem like a large value; however,
|
||||
// when a program intends to enumerate large directories, having a larger
|
||||
// scratch buffer results in fewer operating system calls.
|
||||
const DefaultScratchBufferSize = 64 * 1024
|
||||
|
||||
// MinimumScratchBufferSize specifies the minimum size of the scratch buffer
|
||||
// that Walk, ReadDirents, and ReadDirnames will use when reading file entries
|
||||
// from the operating system. It is initialized to the result from calling
|
||||
// `os.Getpagesize()` during program startup.
|
||||
var MinimumScratchBufferSize int
|
||||
|
||||
func init() {
|
||||
MinimumScratchBufferSize = os.Getpagesize()
|
||||
}
|
||||
|
||||
// Options provide parameters for how the Walk function operates.
|
||||
type Options struct {
|
||||
// ErrorCallback specifies a function to be invoked in the case of an error
|
||||
// that could potentially be ignored while walking a file system
|
||||
// hierarchy. When set to nil or left as its zero-value, any error condition
|
||||
// causes Walk to immediately return the error describing what took
|
||||
// place. When non-nil, this user supplied function is invoked with the OS
|
||||
// pathname of the file system object that caused the error along with the
|
||||
// error that took place. The return value of the supplied ErrorCallback
|
||||
// function determines whether the error will cause Walk to halt immediately
|
||||
// as it would were no ErrorCallback value provided, or skip this file
|
||||
// system node yet continue on with the remaining nodes in the file system
|
||||
// hierarchy.
|
||||
//
|
||||
// ErrorCallback is invoked both for errors that are returned by the
|
||||
// runtime, and for errors returned by other user supplied callback
|
||||
// functions.
|
||||
ErrorCallback func(string, error) ErrorAction
|
||||
|
||||
// FollowSymbolicLinks specifies whether Walk will follow symbolic links
|
||||
// that refer to directories. When set to false or left as its zero-value,
|
||||
// Walk will still invoke the callback function with symbolic link nodes,
|
||||
// but if the symbolic link refers to a directory, it will not recurse on
|
||||
// that directory. When set to true, Walk will recurse on symbolic links
|
||||
// that refer to a directory.
|
||||
FollowSymbolicLinks bool
|
||||
|
||||
// Unsorted controls whether or not Walk will sort the immediate descendants
|
||||
// of a directory by their relative names prior to visiting each of those
|
||||
// entries.
|
||||
//
|
||||
// When set to false or left at its zero-value, Walk will get the list of
|
||||
// immediate descendants of a particular directory, sort that list by
|
||||
// lexical order of their names, and then visit each node in the list in
|
||||
// sorted order. This will cause Walk to always traverse the same directory
|
||||
// tree in the same order, however may be inefficient for directories with
|
||||
// many immediate descendants.
|
||||
//
|
||||
// When set to true, Walk skips sorting the list of immediate descendants
|
||||
// for a directory, and simply visits each node in the order the operating
|
||||
// system enumerated them. This will be more fast, but with the side effect
|
||||
// that the traversal order may be different from one invocation to the
|
||||
// next.
|
||||
Unsorted bool
|
||||
|
||||
// Callback is a required function that Walk will invoke for every file
|
||||
// system node it encounters.
|
||||
Callback WalkFunc
|
||||
|
||||
// PostChildrenCallback is an option function that Walk will invoke for
|
||||
// every file system directory it encounters after its children have been
|
||||
// processed.
|
||||
PostChildrenCallback WalkFunc
|
||||
|
||||
// ScratchBuffer is an optional byte slice to use as a scratch buffer for
|
||||
// Walk to use when reading directory entries, to reduce amount of garbage
|
||||
// generation. Not all architectures take advantage of the scratch
|
||||
// buffer. If omitted or the provided buffer has fewer bytes than
|
||||
// MinimumScratchBufferSize, then a buffer with DefaultScratchBufferSize
|
||||
// bytes will be created and used once per Walk invocation.
|
||||
ScratchBuffer []byte
|
||||
}
|
||||
|
||||
// ErrorAction defines a set of actions the Walk function could take based on
|
||||
// the occurrence of an error while walking the file system. See the
|
||||
// documentation for the ErrorCallback field of the Options structure for more
|
||||
// information.
|
||||
type ErrorAction int
|
||||
|
||||
const (
|
||||
// Halt is the ErrorAction return value when the upstream code wants to halt
|
||||
// the walk process when a runtime error takes place. It matches the default
|
||||
// action the Walk function would take were no ErrorCallback provided.
|
||||
Halt ErrorAction = iota
|
||||
|
||||
// SkipNode is the ErrorAction return value when the upstream code wants to
|
||||
// ignore the runtime error for the current file system node, skip
|
||||
// processing of the node that caused the error, and continue walking the
|
||||
// file system hierarchy with the remaining nodes.
|
||||
SkipNode
|
||||
)
|
||||
|
||||
// WalkFunc is the type of the function called for each file system node visited
|
||||
// by Walk. The pathname argument will contain the argument to Walk as a prefix;
|
||||
// that is, if Walk is called with "dir", which is a directory containing the
|
||||
// file "a", the provided WalkFunc will be invoked with the argument "dir/a",
|
||||
// using the correct os.PathSeparator for the Go Operating System architecture,
|
||||
// GOOS. The directory entry argument is a pointer to a Dirent for the node,
|
||||
// providing access to both the basename and the mode type of the file system
|
||||
// node.
|
||||
//
|
||||
// If an error is returned by the Callback or PostChildrenCallback functions,
|
||||
// and no ErrorCallback function is provided, processing stops. If an
|
||||
// ErrorCallback function is provided, then it is invoked with the OS pathname
|
||||
// of the node that caused the error along along with the error. The return
|
||||
// value of the ErrorCallback function determines whether to halt processing, or
|
||||
// skip this node and continue processing remaining file system nodes.
|
||||
//
|
||||
// The exception is when the function returns the special value
|
||||
// filepath.SkipDir. If the function returns filepath.SkipDir when invoked on a
|
||||
// directory, Walk skips the directory's contents entirely. If the function
|
||||
// returns filepath.SkipDir when invoked on a non-directory file system node,
|
||||
// Walk skips the remaining files in the containing directory. Note that any
|
||||
// supplied ErrorCallback function is not invoked with filepath.SkipDir when the
|
||||
// Callback or PostChildrenCallback functions return that special value.
|
||||
type WalkFunc func(osPathname string, directoryEntry *Dirent) error
|
||||
|
||||
// Walk walks the file tree rooted at the specified directory, calling the
|
||||
// specified callback function for each file system node in the tree, including
|
||||
// root, symbolic links, and other node types. The nodes are walked in lexical
|
||||
// order, which makes the output deterministic but means that for very large
|
||||
// directories this function can be inefficient.
|
||||
//
|
||||
// This function is often much faster than filepath.Walk because it does not
|
||||
// invoke os.Stat for every node it encounters, but rather obtains the file
|
||||
// system node type when it reads the parent directory.
|
||||
//
|
||||
// If a runtime error occurs, either from the operating system or from the
|
||||
// upstream Callback or PostChildrenCallback functions, processing typically
|
||||
// halts. However, when an ErrorCallback function is provided in the provided
|
||||
// Options structure, that function is invoked with the error along with the OS
|
||||
// pathname of the file system node that caused the error. The ErrorCallback
|
||||
// function's return value determines the action that Walk will then take.
|
||||
//
|
||||
// func main() {
|
||||
// dirname := "."
|
||||
// if len(os.Args) > 1 {
|
||||
// dirname = os.Args[1]
|
||||
// }
|
||||
// err := godirwalk.Walk(dirname, &godirwalk.Options{
|
||||
// Callback: func(osPathname string, de *godirwalk.Dirent) error {
|
||||
// fmt.Printf("%s %s\n", de.ModeType(), osPathname)
|
||||
// return nil
|
||||
// },
|
||||
// ErrorCallback: func(osPathname string, err error) godirwalk.ErrorAction {
|
||||
// // Your program may want to log the error somehow.
|
||||
// fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
//
|
||||
// // For the purposes of this example, a simple SkipNode will suffice,
|
||||
// // although in reality perhaps additional logic might be called for.
|
||||
// return godirwalk.SkipNode
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
// os.Exit(1)
|
||||
// }
|
||||
// }
|
||||
func Walk(pathname string, options *Options) error {
|
||||
pathname = filepath.Clean(pathname)
|
||||
|
||||
var fi os.FileInfo
|
||||
var err error
|
||||
|
||||
if options.FollowSymbolicLinks {
|
||||
fi, err = os.Stat(pathname)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "cannot Stat")
|
||||
}
|
||||
} else {
|
||||
fi, err = os.Lstat(pathname)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "cannot Lstat")
|
||||
}
|
||||
}
|
||||
|
||||
mode := fi.Mode()
|
||||
if mode&os.ModeDir == 0 {
|
||||
return errors.Errorf("cannot Walk non-directory: %s", pathname)
|
||||
}
|
||||
|
||||
dirent := &Dirent{
|
||||
name: filepath.Base(pathname),
|
||||
modeType: mode & os.ModeType,
|
||||
}
|
||||
|
||||
// If ErrorCallback is nil, set to a default value that halts the walk
|
||||
// process on all operating system errors. This is done to allow error
|
||||
// handling to be more succinct in the walk code.
|
||||
if options.ErrorCallback == nil {
|
||||
options.ErrorCallback = defaultErrorCallback
|
||||
}
|
||||
|
||||
if len(options.ScratchBuffer) < MinimumScratchBufferSize {
|
||||
options.ScratchBuffer = make([]byte, DefaultScratchBufferSize)
|
||||
}
|
||||
|
||||
err = walk(pathname, dirent, options)
|
||||
if err == filepath.SkipDir {
|
||||
return nil // silence SkipDir for top level
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// defaultErrorCallback always returns Halt because if the upstream code did not
|
||||
// provide an ErrorCallback function, walking the file system hierarchy ought to
|
||||
// halt upon any operating system error.
|
||||
func defaultErrorCallback(_ string, _ error) ErrorAction { return Halt }
|
||||
|
||||
// walk recursively traverses the file system node specified by pathname and the
|
||||
// Dirent.
|
||||
func walk(osPathname string, dirent *Dirent, options *Options) error {
|
||||
err := options.Callback(osPathname, dirent)
|
||||
if err != nil {
|
||||
if err == filepath.SkipDir {
|
||||
return err
|
||||
}
|
||||
err = errors.Wrap(err, "Callback") // wrap potential errors returned by callback
|
||||
if action := options.ErrorCallback(osPathname, err); action == SkipNode {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// On some platforms, an entry can have more than one mode type bit set.
|
||||
// For instance, it could have both the symlink bit and the directory bit
|
||||
// set indicating it's a symlink to a directory.
|
||||
if dirent.IsSymlink() {
|
||||
if !options.FollowSymbolicLinks {
|
||||
return nil
|
||||
}
|
||||
// Only need to Stat entry if platform did not already have os.ModeDir
|
||||
// set, such as would be the case for unix like operating systems. (This
|
||||
// guard eliminates extra os.Stat check on Windows.)
|
||||
if !dirent.IsDir() {
|
||||
referent, err := os.Readlink(osPathname)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot Readlink")
|
||||
if action := options.ErrorCallback(osPathname, err); action == SkipNode {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
var osp string
|
||||
if filepath.IsAbs(referent) {
|
||||
osp = referent
|
||||
} else {
|
||||
osp = filepath.Join(filepath.Dir(osPathname), referent)
|
||||
}
|
||||
|
||||
fi, err := os.Stat(osp)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot Stat")
|
||||
if action := options.ErrorCallback(osp, err); action == SkipNode {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
dirent.modeType = fi.Mode() & os.ModeType
|
||||
}
|
||||
}
|
||||
|
||||
if !dirent.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If get here, then specified pathname refers to a directory.
|
||||
deChildren, err := ReadDirents(osPathname, options.ScratchBuffer)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot ReadDirents")
|
||||
if action := options.ErrorCallback(osPathname, err); action == SkipNode {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
if !options.Unsorted {
|
||||
sort.Sort(deChildren) // sort children entries unless upstream says to leave unsorted
|
||||
}
|
||||
|
||||
for _, deChild := range deChildren {
|
||||
osChildname := filepath.Join(osPathname, deChild.name)
|
||||
err = walk(osChildname, deChild, options)
|
||||
if err != nil {
|
||||
if err != filepath.SkipDir {
|
||||
return err
|
||||
}
|
||||
// If received skipdir on a directory, stop processing that
|
||||
// directory, but continue to its siblings. If received skipdir on a
|
||||
// non-directory, stop processing remaining siblings.
|
||||
if deChild.IsSymlink() {
|
||||
// Only need to Stat entry if platform did not already have
|
||||
// os.ModeDir set, such as would be the case for unix like
|
||||
// operating systems. (This guard eliminates extra os.Stat check
|
||||
// on Windows.)
|
||||
if !deChild.IsDir() {
|
||||
// Resolve symbolic link referent to determine whether node
|
||||
// is directory or not.
|
||||
referent, err := os.Readlink(osChildname)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot Readlink")
|
||||
if action := options.ErrorCallback(osChildname, err); action == SkipNode {
|
||||
continue // with next child
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
var osp string
|
||||
if filepath.IsAbs(referent) {
|
||||
osp = referent
|
||||
} else {
|
||||
osp = filepath.Join(osPathname, referent)
|
||||
}
|
||||
|
||||
fi, err := os.Stat(osp)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot Stat")
|
||||
if action := options.ErrorCallback(osp, err); action == SkipNode {
|
||||
continue // with next child
|
||||
}
|
||||
return err
|
||||
}
|
||||
deChild.modeType = fi.Mode() & os.ModeType
|
||||
}
|
||||
}
|
||||
if !deChild.IsDir() {
|
||||
// If not directory, return immediately, thus skipping remainder
|
||||
// of siblings.
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if options.PostChildrenCallback == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
err = options.PostChildrenCallback(osPathname, dirent)
|
||||
if err == nil || err == filepath.SkipDir {
|
||||
return err
|
||||
}
|
||||
|
||||
err = errors.Wrap(err, "PostChildrenCallback") // wrap potential errors returned by callback
|
||||
if action := options.ErrorCallback(osPathname, err); action == SkipNode {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
9
vendor/github.com/karrick/godirwalk/withFileno.go
generated
vendored
Normal file
9
vendor/github.com/karrick/godirwalk/withFileno.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// +build dragonfly freebsd openbsd netbsd
|
||||
|
||||
package godirwalk
|
||||
|
||||
import "syscall"
|
||||
|
||||
func inoFromDirent(de *syscall.Dirent) uint64 {
|
||||
return uint64(de.Fileno)
|
||||
}
|
9
vendor/github.com/karrick/godirwalk/withIno.go
generated
vendored
Normal file
9
vendor/github.com/karrick/godirwalk/withIno.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// +build darwin linux
|
||||
|
||||
package godirwalk
|
||||
|
||||
import "syscall"
|
||||
|
||||
func inoFromDirent(de *syscall.Dirent) uint64 {
|
||||
return de.Ino
|
||||
}
|
29
vendor/github.com/karrick/godirwalk/withNamlen.go
generated
vendored
Normal file
29
vendor/github.com/karrick/godirwalk/withNamlen.go
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func nameFromDirent(de *syscall.Dirent) []byte {
|
||||
// Because this GOOS' syscall.Dirent provides a Namlen field that says how
|
||||
// long the name is, this function does not need to search for the NULL
|
||||
// byte.
|
||||
ml := int(de.Namlen)
|
||||
|
||||
// Convert syscall.Dirent.Name, which is array of int8, to []byte, by
|
||||
// overwriting Cap, Len, and Data slice header fields to values from
|
||||
// syscall.Dirent fields. Setting the Cap, Len, and Data field values for
|
||||
// the slice header modifies what the slice header points to, and in this
|
||||
// case, the name buffer.
|
||||
var name []byte
|
||||
sh := (*reflect.SliceHeader)(unsafe.Pointer(&name))
|
||||
sh.Cap = ml
|
||||
sh.Len = ml
|
||||
sh.Data = uintptr(unsafe.Pointer(&de.Name[0]))
|
||||
|
||||
return name
|
||||
}
|
36
vendor/github.com/karrick/godirwalk/withoutNamlen.go
generated
vendored
Normal file
36
vendor/github.com/karrick/godirwalk/withoutNamlen.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// +build nacl linux solaris
|
||||
|
||||
package godirwalk
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func nameFromDirent(de *syscall.Dirent) []byte {
|
||||
// Because this GOOS' syscall.Dirent does not provide a field that specifies
|
||||
// the name length, this function must first calculate the max possible name
|
||||
// length, and then search for the NULL byte.
|
||||
ml := int(uint64(de.Reclen) - uint64(unsafe.Offsetof(syscall.Dirent{}.Name)))
|
||||
|
||||
// Convert syscall.Dirent.Name, which is array of int8, to []byte, by
|
||||
// overwriting Cap, Len, and Data slice header fields to values from
|
||||
// syscall.Dirent fields. Setting the Cap, Len, and Data field values for
|
||||
// the slice header modifies what the slice header points to, and in this
|
||||
// case, the name buffer.
|
||||
var name []byte
|
||||
sh := (*reflect.SliceHeader)(unsafe.Pointer(&name))
|
||||
sh.Cap = ml
|
||||
sh.Len = ml
|
||||
sh.Data = uintptr(unsafe.Pointer(&de.Name[0]))
|
||||
|
||||
if index := bytes.IndexByte(name, 0); index >= 0 {
|
||||
// Found NULL byte; set slice's cap and len accordingly.
|
||||
sh.Cap = index
|
||||
sh.Len = index
|
||||
}
|
||||
|
||||
return name
|
||||
}
|
2
vendor/github.com/kubernetes/repo-infra/kazel/BUILD
generated
vendored
2
vendor/github.com/kubernetes/repo-infra/kazel/BUILD
generated
vendored
@ -14,7 +14,7 @@ go_library(
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
3
vendor/github.com/kubernetes/repo-infra/kazel/config.go
generated
vendored
3
vendor/github.com/kubernetes/repo-infra/kazel/config.go
generated
vendored
@ -28,6 +28,9 @@ type Cfg struct {
|
||||
SrcDirs []string
|
||||
// regexps that match packages to skip
|
||||
SkippedPaths []string
|
||||
// regexps that match packages to skip for K8SOpenAPIGen.
|
||||
// note that this skips anything matched by SkippedPaths as well.
|
||||
SkippedOpenAPIGenPaths []string
|
||||
// whether to add "pkg-srcs" and "all-srcs" filegroups
|
||||
// note that this operates on the entire tree (not just SrcsDirs) but skips anything matching SkippedPaths
|
||||
AddSourcesRules bool
|
||||
|
2
vendor/github.com/kubernetes/repo-infra/kazel/generator.go
generated
vendored
2
vendor/github.com/kubernetes/repo-infra/kazel/generator.go
generated
vendored
@ -55,7 +55,7 @@ func (v *Vendorer) walkGenerated() error {
|
||||
// findOpenAPI searches for all packages under root that request OpenAPI. It
|
||||
// returns the go import paths. It does not follow symlinks.
|
||||
func (v *Vendorer) findOpenAPI(root string) ([]string, error) {
|
||||
for _, r := range v.skippedPaths {
|
||||
for _, r := range v.skippedOpenAPIPaths {
|
||||
if r.MatchString(root) {
|
||||
return nil, nil
|
||||
}
|
||||
|
77
vendor/github.com/kubernetes/repo-infra/kazel/kazel.go
generated
vendored
77
vendor/github.com/kubernetes/repo-infra/kazel/kazel.go
generated
vendored
@ -31,7 +31,8 @@ import (
|
||||
"strings"
|
||||
|
||||
bzl "github.com/bazelbuild/buildtools/build"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -51,36 +52,36 @@ func main() {
|
||||
flag.Parse()
|
||||
flag.Set("alsologtostderr", "true")
|
||||
if *root == "" {
|
||||
glog.Fatalf("-root argument is required")
|
||||
klog.Fatalf("-root argument is required")
|
||||
}
|
||||
if *validate {
|
||||
*dryRun = true
|
||||
}
|
||||
v, err := newVendorer(*root, *cfgPath, *dryRun)
|
||||
if err != nil {
|
||||
glog.Fatalf("unable to build vendorer: %v", err)
|
||||
klog.Fatalf("unable to build vendorer: %v", err)
|
||||
}
|
||||
if err = os.Chdir(v.root); err != nil {
|
||||
glog.Fatalf("cannot chdir into root %q: %v", v.root, err)
|
||||
klog.Fatalf("cannot chdir into root %q: %v", v.root, err)
|
||||
}
|
||||
|
||||
if v.cfg.ManageGoRules {
|
||||
if err = v.walkVendor(); err != nil {
|
||||
glog.Fatalf("err walking vendor: %v", err)
|
||||
klog.Fatalf("err walking vendor: %v", err)
|
||||
}
|
||||
if err = v.walkRepo(); err != nil {
|
||||
glog.Fatalf("err walking repo: %v", err)
|
||||
klog.Fatalf("err walking repo: %v", err)
|
||||
}
|
||||
}
|
||||
if err = v.walkGenerated(); err != nil {
|
||||
glog.Fatalf("err walking generated: %v", err)
|
||||
klog.Fatalf("err walking generated: %v", err)
|
||||
}
|
||||
if _, err = v.walkSource("."); err != nil {
|
||||
glog.Fatalf("err walking source: %v", err)
|
||||
klog.Fatalf("err walking source: %v", err)
|
||||
}
|
||||
written := 0
|
||||
if written, err = v.reconcileAllRules(); err != nil {
|
||||
glog.Fatalf("err reconciling rules: %v", err)
|
||||
klog.Fatalf("err reconciling rules: %v", err)
|
||||
}
|
||||
if *validate && written > 0 {
|
||||
fmt.Fprintf(os.Stderr, "\n%d BUILD files not up-to-date.\n", written)
|
||||
@ -90,14 +91,15 @@ func main() {
|
||||
|
||||
// Vendorer collects context, configuration, and cache while walking the tree.
|
||||
type Vendorer struct {
|
||||
ctx *build.Context
|
||||
icache map[icacheKey]icacheVal
|
||||
skippedPaths []*regexp.Regexp
|
||||
dryRun bool
|
||||
root string
|
||||
cfg *Cfg
|
||||
newRules map[string][]*bzl.Rule // package path -> list of rules to add or update
|
||||
managedAttrs []string
|
||||
ctx *build.Context
|
||||
icache map[icacheKey]icacheVal
|
||||
skippedPaths []*regexp.Regexp
|
||||
skippedOpenAPIPaths []*regexp.Regexp
|
||||
dryRun bool
|
||||
root string
|
||||
cfg *Cfg
|
||||
newRules map[string][]*bzl.Rule // package path -> list of rules to add or update
|
||||
managedAttrs []string
|
||||
}
|
||||
|
||||
func newVendorer(root, cfgPath string, dryRun bool) (*Vendorer, error) {
|
||||
@ -123,19 +125,23 @@ func newVendorer(root, cfgPath string, dryRun bool) (*Vendorer, error) {
|
||||
managedAttrs: []string{"srcs", "deps", "library"},
|
||||
}
|
||||
|
||||
for _, sp := range cfg.SkippedPaths {
|
||||
r, err := regexp.Compile(sp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.skippedPaths = append(v.skippedPaths, r)
|
||||
builtIn, err := compileSkippedPaths([]string{"^\\.git", "^bazel-*"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, builtinSkip := range []string{
|
||||
"^\\.git",
|
||||
"^bazel-*",
|
||||
} {
|
||||
v.skippedPaths = append(v.skippedPaths, regexp.MustCompile(builtinSkip))
|
||||
|
||||
sp, err := compileSkippedPaths(cfg.SkippedPaths)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sp = append(builtIn, sp...)
|
||||
v.skippedPaths = sp
|
||||
|
||||
sop, err := compileSkippedPaths(cfg.SkippedOpenAPIGenPaths)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.skippedOpenAPIPaths = append(sop, sp...)
|
||||
|
||||
return &v, nil
|
||||
|
||||
@ -541,7 +547,7 @@ func asExpr(e interface{}) bzl.Expr {
|
||||
}
|
||||
return &bzl.ListExpr{List: list}
|
||||
default:
|
||||
glog.Fatalf("Uh oh")
|
||||
klog.Fatalf("Uh oh")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -782,3 +788,16 @@ func context() *build.Context {
|
||||
func walk(root string, walkFn filepath.WalkFunc) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func compileSkippedPaths(skippedPaths []string) ([]*regexp.Regexp, error) {
|
||||
regexPaths := []*regexp.Regexp{}
|
||||
|
||||
for _, sp := range skippedPaths {
|
||||
r, err := regexp.Compile(sp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
regexPaths = append(regexPaths, r)
|
||||
}
|
||||
return regexPaths, nil
|
||||
}
|
||||
|
23
vendor/github.com/sigma/go-inotify/BUILD
generated
vendored
Normal file
23
vendor/github.com/sigma/go-inotify/BUILD
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["inotify_linux.go"],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/sigma/go-inotify",
|
||||
importpath = "github.com/sigma/go-inotify",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
27
vendor/github.com/sigma/go-inotify/LICENSE
generated
vendored
Normal file
27
vendor/github.com/sigma/go-inotify/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
22
vendor/github.com/sigma/go-inotify/PATENTS
generated
vendored
Normal file
22
vendor/github.com/sigma/go-inotify/PATENTS
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Additional IP Rights Grant (Patents)
|
||||
|
||||
"This implementation" means the copyrightable works distributed by
|
||||
Google as part of the Go project.
|
||||
|
||||
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section)
|
||||
patent license to make, have made, use, offer to sell, sell, import,
|
||||
transfer and otherwise run, modify and propagate the contents of this
|
||||
implementation of Go, where such license applies only to those patent
|
||||
claims, both currently owned or controlled by Google and acquired in
|
||||
the future, licensable by Google that are necessarily infringed by this
|
||||
implementation of Go. This grant does not include claims that would be
|
||||
infringed only as a consequence of further modification of this
|
||||
implementation. If you or your agent or exclusive licensee institute or
|
||||
order or agree to the institution of patent litigation against any
|
||||
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that this implementation of Go or any code incorporated within this
|
||||
implementation of Go constitutes direct or contributory patent
|
||||
infringement, or inducement of patent infringement, then any patent
|
||||
rights granted to you under this License for this implementation of Go
|
||||
shall terminate as of the date such litigation is filed.
|
5
vendor/github.com/sigma/go-inotify/README.md
generated
vendored
Normal file
5
vendor/github.com/sigma/go-inotify/README.md
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
This is a fork of golang.org/x/exp/inotify before it was deleted.
|
||||
|
||||
Please use gopkg.in/fsnotify.v0 instead.
|
||||
|
||||
For updates, see: https://fsnotify.org/
|
306
vendor/github.com/sigma/go-inotify/inotify_linux.go
generated
vendored
Normal file
306
vendor/github.com/sigma/go-inotify/inotify_linux.go
generated
vendored
Normal file
@ -0,0 +1,306 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
Package inotify implements a wrapper for the Linux inotify system.
|
||||
|
||||
Example:
|
||||
watcher, err := inotify.NewWatcher()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = watcher.Watch("/tmp")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case ev := <-watcher.Event:
|
||||
log.Println("event:", ev)
|
||||
case err := <-watcher.Error:
|
||||
log.Println("error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
package inotify
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
Mask uint32 // Mask of events
|
||||
Cookie uint32 // Unique cookie associating related events (for rename(2))
|
||||
Name string // File name (optional)
|
||||
}
|
||||
|
||||
type watch struct {
|
||||
wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall)
|
||||
flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags)
|
||||
}
|
||||
|
||||
type Watcher struct {
|
||||
mu sync.Mutex
|
||||
fd int // File descriptor (as returned by the inotify_init() syscall)
|
||||
watches map[string]*watch // Map of inotify watches (key: path)
|
||||
paths map[int]string // Map of watched paths (key: watch descriptor)
|
||||
Error chan error // Errors are sent on this channel
|
||||
Event chan *Event // Events are returned on this channel
|
||||
done chan bool // Channel for sending a "quit message" to the reader goroutine
|
||||
isClosed bool // Set to true when Close() is first called
|
||||
}
|
||||
|
||||
// NewWatcher creates and returns a new inotify instance using inotify_init(2)
|
||||
func NewWatcher() (*Watcher, error) {
|
||||
fd, errno := syscall.InotifyInit()
|
||||
if fd == -1 {
|
||||
return nil, os.NewSyscallError("inotify_init", errno)
|
||||
}
|
||||
w := &Watcher{
|
||||
fd: fd,
|
||||
watches: make(map[string]*watch),
|
||||
paths: make(map[int]string),
|
||||
Event: make(chan *Event),
|
||||
Error: make(chan error),
|
||||
done: make(chan bool, 1),
|
||||
}
|
||||
|
||||
go w.readEvents()
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// Close closes an inotify watcher instance
|
||||
// It sends a message to the reader goroutine to quit and removes all watches
|
||||
// associated with the inotify instance
|
||||
func (w *Watcher) Close() error {
|
||||
if w.isClosed {
|
||||
return nil
|
||||
}
|
||||
w.isClosed = true
|
||||
|
||||
// Send "quit" message to the reader goroutine
|
||||
w.done <- true
|
||||
for path := range w.watches {
|
||||
w.RemoveWatch(path)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddWatch adds path to the watched file set.
|
||||
// The flags are interpreted as described in inotify_add_watch(2).
|
||||
func (w *Watcher) AddWatch(path string, flags uint32) error {
|
||||
if w.isClosed {
|
||||
return errors.New("inotify instance already closed")
|
||||
}
|
||||
|
||||
watchEntry, found := w.watches[path]
|
||||
if found {
|
||||
watchEntry.flags |= flags
|
||||
flags |= syscall.IN_MASK_ADD
|
||||
}
|
||||
|
||||
w.mu.Lock() // synchronize with readEvents goroutine
|
||||
|
||||
wd, err := syscall.InotifyAddWatch(w.fd, path, flags)
|
||||
if err != nil {
|
||||
w.mu.Unlock()
|
||||
return &os.PathError{
|
||||
Op: "inotify_add_watch",
|
||||
Path: path,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
w.watches[path] = &watch{wd: uint32(wd), flags: flags}
|
||||
w.paths[wd] = path
|
||||
}
|
||||
w.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Watch adds path to the watched file set, watching all events.
|
||||
func (w *Watcher) Watch(path string) error {
|
||||
return w.AddWatch(path, IN_ALL_EVENTS)
|
||||
}
|
||||
|
||||
// RemoveWatch removes path from the watched file set.
|
||||
func (w *Watcher) RemoveWatch(path string) error {
|
||||
watch, ok := w.watches[path]
|
||||
if !ok {
|
||||
return errors.New(fmt.Sprintf("can't remove non-existent inotify watch for: %s", path))
|
||||
}
|
||||
success, errno := syscall.InotifyRmWatch(w.fd, watch.wd)
|
||||
if success == -1 {
|
||||
return os.NewSyscallError("inotify_rm_watch", errno)
|
||||
}
|
||||
delete(w.watches, path)
|
||||
// Locking here to protect the read from paths in readEvents.
|
||||
w.mu.Lock()
|
||||
delete(w.paths, int(watch.wd))
|
||||
w.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
// readEvents reads from the inotify file descriptor, converts the
|
||||
// received events into Event objects and sends them via the Event channel
|
||||
func (w *Watcher) readEvents() {
|
||||
var buf [syscall.SizeofInotifyEvent * 4096]byte
|
||||
|
||||
for {
|
||||
n, err := syscall.Read(w.fd, buf[:])
|
||||
// See if there is a message on the "done" channel
|
||||
var done bool
|
||||
select {
|
||||
case done = <-w.done:
|
||||
default:
|
||||
}
|
||||
|
||||
// If EOF or a "done" message is received
|
||||
if n == 0 || done {
|
||||
// The syscall.Close can be slow. Close
|
||||
// w.Event first.
|
||||
close(w.Event)
|
||||
err := syscall.Close(w.fd)
|
||||
if err != nil {
|
||||
w.Error <- os.NewSyscallError("close", err)
|
||||
}
|
||||
close(w.Error)
|
||||
return
|
||||
}
|
||||
if n < 0 {
|
||||
w.Error <- os.NewSyscallError("read", err)
|
||||
continue
|
||||
}
|
||||
if n < syscall.SizeofInotifyEvent {
|
||||
w.Error <- errors.New("inotify: short read in readEvents()")
|
||||
continue
|
||||
}
|
||||
|
||||
var offset uint32 = 0
|
||||
// We don't know how many events we just read into the buffer
|
||||
// While the offset points to at least one whole event...
|
||||
for offset <= uint32(n-syscall.SizeofInotifyEvent) {
|
||||
// Point "raw" to the event in the buffer
|
||||
raw := (*syscall.InotifyEvent)(unsafe.Pointer(&buf[offset]))
|
||||
event := new(Event)
|
||||
event.Mask = uint32(raw.Mask)
|
||||
event.Cookie = uint32(raw.Cookie)
|
||||
nameLen := uint32(raw.Len)
|
||||
// If the event happened to the watched directory or the watched file, the kernel
|
||||
// doesn't append the filename to the event, but we would like to always fill the
|
||||
// the "Name" field with a valid filename. We retrieve the path of the watch from
|
||||
// the "paths" map.
|
||||
w.mu.Lock()
|
||||
name, ok := w.paths[int(raw.Wd)]
|
||||
w.mu.Unlock()
|
||||
if ok {
|
||||
event.Name = name
|
||||
if nameLen > 0 {
|
||||
// Point "bytes" at the first byte of the filename
|
||||
bytes := (*[syscall.PathMax]byte)(unsafe.Pointer(&buf[offset+syscall.SizeofInotifyEvent]))
|
||||
// The filename is padded with NUL bytes. TrimRight() gets rid of those.
|
||||
event.Name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000")
|
||||
}
|
||||
// Send the event on the events channel
|
||||
w.Event <- event
|
||||
}
|
||||
// Move to the next event in the buffer
|
||||
offset += syscall.SizeofInotifyEvent + nameLen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// String formats the event e in the form
|
||||
// "filename: 0xEventMask = IN_ACCESS|IN_ATTRIB_|..."
|
||||
func (e *Event) String() string {
|
||||
var events string = ""
|
||||
|
||||
m := e.Mask
|
||||
for _, b := range eventBits {
|
||||
if m&b.Value == b.Value {
|
||||
m &^= b.Value
|
||||
events += "|" + b.Name
|
||||
}
|
||||
}
|
||||
|
||||
if m != 0 {
|
||||
events += fmt.Sprintf("|%#x", m)
|
||||
}
|
||||
if len(events) > 0 {
|
||||
events = " == " + events[1:]
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%q: %#x%s", e.Name, e.Mask, events)
|
||||
}
|
||||
|
||||
const (
|
||||
// Options for inotify_init() are not exported
|
||||
// IN_CLOEXEC uint32 = syscall.IN_CLOEXEC
|
||||
// IN_NONBLOCK uint32 = syscall.IN_NONBLOCK
|
||||
|
||||
// Options for AddWatch
|
||||
IN_DONT_FOLLOW uint32 = syscall.IN_DONT_FOLLOW
|
||||
IN_ONESHOT uint32 = syscall.IN_ONESHOT
|
||||
IN_ONLYDIR uint32 = syscall.IN_ONLYDIR
|
||||
|
||||
// The "IN_MASK_ADD" option is not exported, as AddWatch
|
||||
// adds it automatically, if there is already a watch for the given path
|
||||
// IN_MASK_ADD uint32 = syscall.IN_MASK_ADD
|
||||
|
||||
// Events
|
||||
IN_ACCESS uint32 = syscall.IN_ACCESS
|
||||
IN_ALL_EVENTS uint32 = syscall.IN_ALL_EVENTS
|
||||
IN_ATTRIB uint32 = syscall.IN_ATTRIB
|
||||
IN_CLOSE uint32 = syscall.IN_CLOSE
|
||||
IN_CLOSE_NOWRITE uint32 = syscall.IN_CLOSE_NOWRITE
|
||||
IN_CLOSE_WRITE uint32 = syscall.IN_CLOSE_WRITE
|
||||
IN_CREATE uint32 = syscall.IN_CREATE
|
||||
IN_DELETE uint32 = syscall.IN_DELETE
|
||||
IN_DELETE_SELF uint32 = syscall.IN_DELETE_SELF
|
||||
IN_MODIFY uint32 = syscall.IN_MODIFY
|
||||
IN_MOVE uint32 = syscall.IN_MOVE
|
||||
IN_MOVED_FROM uint32 = syscall.IN_MOVED_FROM
|
||||
IN_MOVED_TO uint32 = syscall.IN_MOVED_TO
|
||||
IN_MOVE_SELF uint32 = syscall.IN_MOVE_SELF
|
||||
IN_OPEN uint32 = syscall.IN_OPEN
|
||||
|
||||
// Special events
|
||||
IN_ISDIR uint32 = syscall.IN_ISDIR
|
||||
IN_IGNORED uint32 = syscall.IN_IGNORED
|
||||
IN_Q_OVERFLOW uint32 = syscall.IN_Q_OVERFLOW
|
||||
IN_UNMOUNT uint32 = syscall.IN_UNMOUNT
|
||||
)
|
||||
|
||||
var eventBits = []struct {
|
||||
Value uint32
|
||||
Name string
|
||||
}{
|
||||
{IN_ACCESS, "IN_ACCESS"},
|
||||
{IN_ATTRIB, "IN_ATTRIB"},
|
||||
{IN_CLOSE, "IN_CLOSE"},
|
||||
{IN_CLOSE_NOWRITE, "IN_CLOSE_NOWRITE"},
|
||||
{IN_CLOSE_WRITE, "IN_CLOSE_WRITE"},
|
||||
{IN_CREATE, "IN_CREATE"},
|
||||
{IN_DELETE, "IN_DELETE"},
|
||||
{IN_DELETE_SELF, "IN_DELETE_SELF"},
|
||||
{IN_MODIFY, "IN_MODIFY"},
|
||||
{IN_MOVE, "IN_MOVE"},
|
||||
{IN_MOVED_FROM, "IN_MOVED_FROM"},
|
||||
{IN_MOVED_TO, "IN_MOVED_TO"},
|
||||
{IN_MOVE_SELF, "IN_MOVE_SELF"},
|
||||
{IN_OPEN, "IN_OPEN"},
|
||||
{IN_ISDIR, "IN_ISDIR"},
|
||||
{IN_IGNORED, "IN_IGNORED"},
|
||||
{IN_Q_OVERFLOW, "IN_Q_OVERFLOW"},
|
||||
{IN_UNMOUNT, "IN_UNMOUNT"},
|
||||
}
|
2
vendor/k8s.io/gengo/examples/deepcopy-gen/generators/BUILD
generated
vendored
2
vendor/k8s.io/gengo/examples/deepcopy-gen/generators/BUILD
generated
vendored
@ -7,12 +7,12 @@ go_library(
|
||||
importpath = "k8s.io/gengo/examples/deepcopy-gen/generators",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/gengo/args:go_default_library",
|
||||
"//vendor/k8s.io/gengo/examples/set-gen/sets:go_default_library",
|
||||
"//vendor/k8s.io/gengo/generator:go_default_library",
|
||||
"//vendor/k8s.io/gengo/namer:go_default_library",
|
||||
"//vendor/k8s.io/gengo/types:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
60
vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go
generated
vendored
60
vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go
generated
vendored
@ -29,7 +29,7 @@ import (
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// CustomArgs is used tby the go2idl framework to pass args specific to this
|
||||
@ -62,7 +62,7 @@ func extractTag(comments []string) *tagValue {
|
||||
}
|
||||
// If there are multiple values, abort.
|
||||
if len(tagVals) > 1 {
|
||||
glog.Fatalf("Found %d %s tags: %q", len(tagVals), tagName, tagVals)
|
||||
klog.Fatalf("Found %d %s tags: %q", len(tagVals), tagName, tagVals)
|
||||
}
|
||||
|
||||
// If we got here we are returning something.
|
||||
@ -89,7 +89,7 @@ func extractTag(comments []string) *tagValue {
|
||||
tag.register = true
|
||||
}
|
||||
default:
|
||||
glog.Fatalf("Unsupported %s param: %q", tagName, parts[i])
|
||||
klog.Fatalf("Unsupported %s param: %q", tagName, parts[i])
|
||||
}
|
||||
}
|
||||
return tag
|
||||
@ -123,7 +123,7 @@ func DefaultNameSystem() string {
|
||||
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
|
||||
boilerplate, err := arguments.LoadGoBoilerplate()
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed loading boilerplate: %v", err)
|
||||
klog.Fatalf("Failed loading boilerplate: %v", err)
|
||||
}
|
||||
|
||||
inputs := sets.NewString(context.Inputs...)
|
||||
@ -143,7 +143,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
}
|
||||
|
||||
for i := range inputs {
|
||||
glog.V(5).Infof("Considering pkg %q", i)
|
||||
klog.V(5).Infof("Considering pkg %q", i)
|
||||
pkg := context.Universe[i]
|
||||
if pkg == nil {
|
||||
// If the input had no Go files, for example.
|
||||
@ -156,12 +156,12 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
if ptag != nil {
|
||||
ptagValue = ptag.value
|
||||
if ptagValue != tagValuePackage {
|
||||
glog.Fatalf("Package %v: unsupported %s value: %q", i, tagName, ptagValue)
|
||||
klog.Fatalf("Package %v: unsupported %s value: %q", i, tagName, ptagValue)
|
||||
}
|
||||
ptagRegister = ptag.register
|
||||
glog.V(5).Infof(" tag.value: %q, tag.register: %t", ptagValue, ptagRegister)
|
||||
klog.V(5).Infof(" tag.value: %q, tag.register: %t", ptagValue, ptagRegister)
|
||||
} else {
|
||||
glog.V(5).Infof(" no tag")
|
||||
klog.V(5).Infof(" no tag")
|
||||
}
|
||||
|
||||
// If the pkg-scoped tag says to generate, we can skip scanning types.
|
||||
@ -170,12 +170,12 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
// If the pkg-scoped tag did not exist, scan all types for one that
|
||||
// explicitly wants generation.
|
||||
for _, t := range pkg.Types {
|
||||
glog.V(5).Infof(" considering type %q", t.Name.String())
|
||||
klog.V(5).Infof(" considering type %q", t.Name.String())
|
||||
ttag := extractTag(t.CommentLines)
|
||||
if ttag != nil && ttag.value == "true" {
|
||||
glog.V(5).Infof(" tag=true")
|
||||
klog.V(5).Infof(" tag=true")
|
||||
if !copyableType(t) {
|
||||
glog.Fatalf("Type %v requests deepcopy generation but is not copyable", t)
|
||||
klog.Fatalf("Type %v requests deepcopy generation but is not copyable", t)
|
||||
}
|
||||
pkgNeedsGeneration = true
|
||||
break
|
||||
@ -184,7 +184,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
}
|
||||
|
||||
if pkgNeedsGeneration {
|
||||
glog.V(3).Infof("Package %q needs generation", i)
|
||||
klog.V(3).Infof("Package %q needs generation", i)
|
||||
path := pkg.Path
|
||||
// if the source path is within a /vendor/ directory (for example,
|
||||
// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow
|
||||
@ -263,10 +263,10 @@ func (g *genDeepCopy) Filter(c *generator.Context, t *types.Type) bool {
|
||||
return false
|
||||
}
|
||||
if !copyableType(t) {
|
||||
glog.V(2).Infof("Type %v is not copyable", t)
|
||||
klog.V(2).Infof("Type %v is not copyable", t)
|
||||
return false
|
||||
}
|
||||
glog.V(4).Infof("Type %v is copyable", t)
|
||||
klog.V(4).Infof("Type %v is copyable", t)
|
||||
g.typesForInit = append(g.typesForInit, t)
|
||||
return true
|
||||
}
|
||||
@ -321,12 +321,12 @@ func deepCopyMethod(t *types.Type) (*types.Signature, error) {
|
||||
return f.Signature, nil
|
||||
}
|
||||
|
||||
// deepCopyMethodOrDie returns the signatrue of a DeepCopy method, nil or calls glog.Fatalf
|
||||
// deepCopyMethodOrDie returns the signatrue of a DeepCopy method, nil or calls klog.Fatalf
|
||||
// if the type does not match.
|
||||
func deepCopyMethodOrDie(t *types.Type) *types.Signature {
|
||||
ret, err := deepCopyMethod(t)
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
klog.Fatal(err)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@ -367,12 +367,12 @@ func deepCopyIntoMethod(t *types.Type) (*types.Signature, error) {
|
||||
return f.Signature, nil
|
||||
}
|
||||
|
||||
// deepCopyIntoMethodOrDie returns the signature of a DeepCopyInto() method, nil or calls glog.Fatalf
|
||||
// deepCopyIntoMethodOrDie returns the signature of a DeepCopyInto() method, nil or calls klog.Fatalf
|
||||
// if the type is wrong.
|
||||
func deepCopyIntoMethodOrDie(t *types.Type) *types.Signature {
|
||||
ret, err := deepCopyIntoMethod(t)
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
klog.Fatal(err)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@ -465,17 +465,17 @@ func (g *genDeepCopy) needsGeneration(t *types.Type) bool {
|
||||
if tag != nil {
|
||||
tv = tag.value
|
||||
if tv != "true" && tv != "false" {
|
||||
glog.Fatalf("Type %v: unsupported %s value: %q", t, tagName, tag.value)
|
||||
klog.Fatalf("Type %v: unsupported %s value: %q", t, tagName, tag.value)
|
||||
}
|
||||
}
|
||||
if g.allTypes && tv == "false" {
|
||||
// The whole package is being generated, but this type has opted out.
|
||||
glog.V(5).Infof("Not generating for type %v because type opted out", t)
|
||||
klog.V(5).Infof("Not generating for type %v because type opted out", t)
|
||||
return false
|
||||
}
|
||||
if !g.allTypes && tv != "true" {
|
||||
// The whole package is NOT being generated, and this type has NOT opted in.
|
||||
glog.V(5).Infof("Not generating for type %v because type did not opt in", t)
|
||||
klog.V(5).Infof("Not generating for type %v because type did not opt in", t)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -576,7 +576,7 @@ func (g *genDeepCopy) GenerateType(c *generator.Context, t *types.Type, w io.Wri
|
||||
if !g.needsGeneration(t) {
|
||||
return nil
|
||||
}
|
||||
glog.V(5).Infof("Generating deepcopy function for type %v", t)
|
||||
klog.V(5).Infof("Generating deepcopy function for type %v", t)
|
||||
|
||||
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
||||
args := argsFromType(t)
|
||||
@ -678,12 +678,12 @@ func (g *genDeepCopy) generateFor(t *types.Type, sw *generator.SnippetWriter) {
|
||||
f = g.doPointer
|
||||
case types.Interface:
|
||||
// interfaces are handled in-line in the other cases
|
||||
glog.Fatalf("Hit an interface type %v. This should never happen.", t)
|
||||
klog.Fatalf("Hit an interface type %v. This should never happen.", t)
|
||||
case types.Alias:
|
||||
// can never happen because we branch on the underlying type which is never an alias
|
||||
glog.Fatalf("Hit an alias type %v. This should never happen.", t)
|
||||
klog.Fatalf("Hit an alias type %v. This should never happen.", t)
|
||||
default:
|
||||
glog.Fatalf("Hit an unsupported type %v.", t)
|
||||
klog.Fatalf("Hit an unsupported type %v.", t)
|
||||
}
|
||||
f(t, sw)
|
||||
}
|
||||
@ -711,7 +711,7 @@ func (g *genDeepCopy) doMap(t *types.Type, sw *generator.SnippetWriter) {
|
||||
}
|
||||
|
||||
if !ut.Key.IsAssignable() {
|
||||
glog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
klog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
}
|
||||
|
||||
sw.Do("*out = make($.|raw$, len(*in))\n", t)
|
||||
@ -754,7 +754,7 @@ func (g *genDeepCopy) doMap(t *types.Type, sw *generator.SnippetWriter) {
|
||||
case uet.Kind == types.Struct:
|
||||
sw.Do("(*out)[key] = *val.DeepCopy()\n", uet)
|
||||
default:
|
||||
glog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
klog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
}
|
||||
sw.Do("}\n", nil)
|
||||
}
|
||||
@ -795,7 +795,7 @@ func (g *genDeepCopy) doSlice(t *types.Type, sw *generator.SnippetWriter) {
|
||||
} else if uet.Kind == types.Struct {
|
||||
sw.Do("(*in)[i].DeepCopyInto(&(*out)[i])\n", nil)
|
||||
} else {
|
||||
glog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
klog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
}
|
||||
sw.Do("}\n", nil)
|
||||
}
|
||||
@ -863,7 +863,7 @@ func (g *genDeepCopy) doStruct(t *types.Type, sw *generator.SnippetWriter) {
|
||||
sw.Do(fmt.Sprintf("out.$.name$ = in.$.name$.DeepCopy%s()\n", uft.Name.Name), args)
|
||||
sw.Do("}\n", nil)
|
||||
default:
|
||||
glog.Fatalf("Hit an unsupported type %v.", uft)
|
||||
klog.Fatalf("Hit an unsupported type %v.", uft)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -900,6 +900,6 @@ func (g *genDeepCopy) doPointer(t *types.Type, sw *generator.SnippetWriter) {
|
||||
sw.Do("*out = new($.Elem|raw$)\n", ut)
|
||||
sw.Do("(*in).DeepCopyInto(*out)\n", nil)
|
||||
default:
|
||||
glog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
klog.Fatalf("Hit an unsupported type %v.", uet)
|
||||
}
|
||||
}
|
||||
|
2
vendor/k8s.io/gengo/examples/defaulter-gen/generators/BUILD
generated
vendored
2
vendor/k8s.io/gengo/examples/defaulter-gen/generators/BUILD
generated
vendored
@ -7,11 +7,11 @@ go_library(
|
||||
importpath = "k8s.io/gengo/examples/defaulter-gen/generators",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/gengo/args:go_default_library",
|
||||
"//vendor/k8s.io/gengo/generator:go_default_library",
|
||||
"//vendor/k8s.io/gengo/namer:go_default_library",
|
||||
"//vendor/k8s.io/gengo/types:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
38
vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go
generated
vendored
38
vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go
generated
vendored
@ -29,7 +29,7 @@ import (
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// CustomArgs is used tby the go2idl framework to pass args specific to this
|
||||
@ -117,11 +117,11 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package
|
||||
|
||||
for _, f := range pkg.Functions {
|
||||
if f.Underlying == nil || f.Underlying.Kind != types.Func {
|
||||
glog.Errorf("Malformed function: %#v", f)
|
||||
klog.Errorf("Malformed function: %#v", f)
|
||||
continue
|
||||
}
|
||||
if f.Underlying.Signature == nil {
|
||||
glog.Errorf("Function without signature: %#v", f)
|
||||
klog.Errorf("Function without signature: %#v", f)
|
||||
continue
|
||||
}
|
||||
signature := f.Underlying.Signature
|
||||
@ -156,7 +156,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package
|
||||
}
|
||||
v.base = f
|
||||
manualMap[key] = v
|
||||
glog.V(6).Infof("found base defaulter function for %s from %s", key.Name, f.Name)
|
||||
klog.V(6).Infof("found base defaulter function for %s from %s", key.Name, f.Name)
|
||||
// Is one of the additional defaulters - a top level defaulter on a type that is
|
||||
// also invoked.
|
||||
case strings.HasPrefix(f.Name.Name, buffer.String()+"_"):
|
||||
@ -176,7 +176,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package
|
||||
}
|
||||
v.additional = append(v.additional, f)
|
||||
manualMap[key] = v
|
||||
glog.V(6).Infof("found additional defaulter function for %s from %s", key.Name, f.Name)
|
||||
klog.V(6).Infof("found additional defaulter function for %s from %s", key.Name, f.Name)
|
||||
}
|
||||
buffer.Reset()
|
||||
sw.Do("$.inType|objectdefaultfn$", args)
|
||||
@ -189,7 +189,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package
|
||||
}
|
||||
v.object = f
|
||||
manualMap[key] = v
|
||||
glog.V(6).Infof("found object defaulter function for %s from %s", key.Name, f.Name)
|
||||
klog.V(6).Infof("found object defaulter function for %s from %s", key.Name, f.Name)
|
||||
}
|
||||
buffer.Reset()
|
||||
}
|
||||
@ -198,7 +198,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package
|
||||
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
|
||||
boilerplate, err := arguments.LoadGoBoilerplate()
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed loading boilerplate: %v", err)
|
||||
klog.Fatalf("Failed loading boilerplate: %v", err)
|
||||
}
|
||||
|
||||
packages := generator.Packages{}
|
||||
@ -214,7 +214,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
// We are generating defaults only for packages that are explicitly
|
||||
// passed as InputDir.
|
||||
for _, i := range context.Inputs {
|
||||
glog.V(5).Infof("considering pkg %q", i)
|
||||
klog.V(5).Infof("considering pkg %q", i)
|
||||
pkg := context.Universe[i]
|
||||
if pkg == nil {
|
||||
// If the input had no Go files, for example.
|
||||
@ -248,7 +248,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
shouldCreateObjectDefaulterFn := func(t *types.Type) bool {
|
||||
if defaults, ok := existingDefaulters[t]; ok && defaults.object != nil {
|
||||
// A default generator is defined
|
||||
glog.V(5).Infof(" an object defaulter already exists as %s", defaults.base.Name)
|
||||
klog.V(5).Infof(" an object defaulter already exists as %s", defaults.base.Name)
|
||||
return false
|
||||
}
|
||||
// opt-out
|
||||
@ -285,7 +285,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
var err error
|
||||
typesPkg, err = context.AddDirectory(filepath.Join(pkg.Path, inputTags[0]))
|
||||
if err != nil {
|
||||
glog.Fatalf("cannot import package %s", inputTags[0])
|
||||
klog.Fatalf("cannot import package %s", inputTags[0])
|
||||
}
|
||||
// update context.Order to the latest context.Universe
|
||||
orderer := namer.Orderer{Namer: namer.NewPublicNamer(1)}
|
||||
@ -299,7 +299,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
}
|
||||
if namer.IsPrivateGoName(t.Name.Name) {
|
||||
// We won't be able to convert to a private type.
|
||||
glog.V(5).Infof(" found a type %v, but it is a private name", t)
|
||||
klog.V(5).Infof(" found a type %v, but it is a private name", t)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
// prune any types that were not used
|
||||
for t, d := range newDefaulters {
|
||||
if d.object == nil {
|
||||
glog.V(6).Infof("did not generate defaulter for %s because no child defaulters were registered", t.Name)
|
||||
klog.V(6).Infof("did not generate defaulter for %s because no child defaulters were registered", t.Name)
|
||||
delete(newDefaulters, t)
|
||||
}
|
||||
}
|
||||
@ -346,7 +346,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
}
|
||||
|
||||
if len(newDefaulters) == 0 {
|
||||
glog.V(5).Infof("no defaulters in package %s", pkg.Name)
|
||||
klog.V(5).Infof("no defaulters in package %s", pkg.Name)
|
||||
}
|
||||
|
||||
path := pkg.Path
|
||||
@ -421,7 +421,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode {
|
||||
parent.call = append(parent.call, newDefaults.object)
|
||||
// if we will be generating the defaulter, it by definition is a covering
|
||||
// defaulter, so we halt recursion
|
||||
glog.V(6).Infof("the defaulter %s will be generated as an object defaulter", t.Name)
|
||||
klog.V(6).Infof("the defaulter %s will be generated as an object defaulter", t.Name)
|
||||
return parent
|
||||
|
||||
case defaults.object != nil:
|
||||
@ -434,7 +434,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode {
|
||||
// if the base function indicates it "covers" (it already includes defaulters)
|
||||
// we can halt recursion
|
||||
if checkTag(defaults.base.CommentLines, "covers") {
|
||||
glog.V(6).Infof("the defaulter %s indicates it covers all sub generators", t.Name)
|
||||
klog.V(6).Infof("the defaulter %s indicates it covers all sub generators", t.Name)
|
||||
return parent
|
||||
}
|
||||
}
|
||||
@ -496,7 +496,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode {
|
||||
}
|
||||
}
|
||||
if len(parent.children) == 0 && len(parent.call) == 0 {
|
||||
//glog.V(6).Infof("decided type %s needs no generation", t.Name)
|
||||
//klog.V(6).Infof("decided type %s needs no generation", t.Name)
|
||||
return nil
|
||||
}
|
||||
return parent
|
||||
@ -596,11 +596,11 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.V(5).Infof("generating for type %v", t)
|
||||
klog.V(5).Infof("generating for type %v", t)
|
||||
|
||||
callTree := newCallTreeForType(g.existingDefaulters, g.newDefaulters).build(t, true)
|
||||
if callTree == nil {
|
||||
glog.V(5).Infof(" no defaulters defined")
|
||||
klog.V(5).Infof(" no defaulters defined")
|
||||
return nil
|
||||
}
|
||||
i := 0
|
||||
@ -609,7 +609,7 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr
|
||||
return
|
||||
}
|
||||
path := callPath(append(ancestors, current))
|
||||
glog.V(5).Infof(" %d: %s", i, path)
|
||||
klog.V(5).Infof(" %d: %s", i, path)
|
||||
i++
|
||||
})
|
||||
|
||||
|
2
vendor/k8s.io/gengo/examples/import-boss/generators/BUILD
generated
vendored
2
vendor/k8s.io/gengo/examples/import-boss/generators/BUILD
generated
vendored
@ -7,11 +7,11 @@ go_library(
|
||||
importpath = "k8s.io/gengo/examples/import-boss/generators",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/gengo/args:go_default_library",
|
||||
"//vendor/k8s.io/gengo/generator:go_default_library",
|
||||
"//vendor/k8s.io/gengo/namer:go_default_library",
|
||||
"//vendor/k8s.io/gengo/types:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user