mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
pinned cadvisor to a latest commit
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
This commit is contained in:
parent
6d49d69c91
commit
ce31366baf
35
Godeps/LICENSES
generated
35
Godeps/LICENSES
generated
@ -16396,41 +16396,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
= 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: =
|
= vendor/github.com/sirupsen/logrus licensed under: =
|
||||||
|
|
||||||
|
6
go.mod
6
go.mod
@ -64,7 +64,7 @@ require (
|
|||||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903
|
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903
|
||||||
github.com/golang/mock v1.2.0
|
github.com/golang/mock v1.2.0
|
||||||
github.com/golang/protobuf v1.2.0
|
github.com/golang/protobuf v1.2.0
|
||||||
github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a
|
github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966
|
||||||
github.com/google/certificate-transparency-go v1.0.21 // indirect
|
github.com/google/certificate-transparency-go v1.0.21 // indirect
|
||||||
github.com/google/go-cmp v0.3.0
|
github.com/google/go-cmp v0.3.0
|
||||||
github.com/google/gofuzz v1.0.0
|
github.com/google/gofuzz v1.0.0
|
||||||
@ -113,7 +113,6 @@ require (
|
|||||||
github.com/robfig/cron v1.1.0
|
github.com/robfig/cron v1.1.0
|
||||||
github.com/russross/blackfriday v1.5.2
|
github.com/russross/blackfriday v1.5.2
|
||||||
github.com/seccomp/libseccomp-golang v0.9.1 // indirect
|
github.com/seccomp/libseccomp-golang v0.9.1 // indirect
|
||||||
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d // indirect
|
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
|
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
|
||||||
github.com/spf13/afero v1.2.2
|
github.com/spf13/afero v1.2.2
|
||||||
github.com/spf13/cobra v0.0.4
|
github.com/spf13/cobra v0.0.4
|
||||||
@ -273,7 +272,7 @@ replace (
|
|||||||
github.com/golangplus/fmt => github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995
|
github.com/golangplus/fmt => github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995
|
||||||
github.com/golangplus/testing => github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e
|
github.com/golangplus/testing => github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e
|
||||||
github.com/google/btree => github.com/google/btree v0.0.0-20160524151835-7d79101e329e
|
github.com/google/btree => github.com/google/btree v0.0.0-20160524151835-7d79101e329e
|
||||||
github.com/google/cadvisor => github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a
|
github.com/google/cadvisor => github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966
|
||||||
github.com/google/certificate-transparency-go => github.com/google/certificate-transparency-go v1.0.21
|
github.com/google/certificate-transparency-go => github.com/google/certificate-transparency-go v1.0.21
|
||||||
github.com/google/go-cmp => github.com/google/go-cmp v0.3.0
|
github.com/google/go-cmp => github.com/google/go-cmp v0.3.0
|
||||||
github.com/google/gofuzz => github.com/google/gofuzz v1.0.0
|
github.com/google/gofuzz => github.com/google/gofuzz v1.0.0
|
||||||
@ -371,7 +370,6 @@ replace (
|
|||||||
github.com/russross/blackfriday => github.com/russross/blackfriday v1.5.2
|
github.com/russross/blackfriday => github.com/russross/blackfriday v1.5.2
|
||||||
github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
|
github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
|
||||||
github.com/seccomp/libseccomp-golang => github.com/seccomp/libseccomp-golang v0.9.1
|
github.com/seccomp/libseccomp-golang => github.com/seccomp/libseccomp-golang v0.9.1
|
||||||
github.com/sigma/go-inotify => github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d
|
|
||||||
github.com/sirupsen/logrus => github.com/sirupsen/logrus v1.4.2
|
github.com/sirupsen/logrus => github.com/sirupsen/logrus v1.4.2
|
||||||
github.com/smartystreets/assertions => github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
|
github.com/smartystreets/assertions => github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
|
||||||
github.com/smartystreets/goconvey => github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a
|
github.com/smartystreets/goconvey => github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a
|
||||||
|
6
go.sum
6
go.sum
@ -183,8 +183,8 @@ github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZ
|
|||||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
|
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
|
||||||
github.com/google/btree v0.0.0-20160524151835-7d79101e329e h1:JHB7F/4TJCrYBW8+GZO8VkWDj1jxcWuCl6uxKODiyi4=
|
github.com/google/btree v0.0.0-20160524151835-7d79101e329e h1:JHB7F/4TJCrYBW8+GZO8VkWDj1jxcWuCl6uxKODiyi4=
|
||||||
github.com/google/btree v0.0.0-20160524151835-7d79101e329e/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
github.com/google/btree v0.0.0-20160524151835-7d79101e329e/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a h1:4N3IykedbdXG1ganAZbAKlViPjrtfrx2nC4qzUHieOk=
|
github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966 h1:8PpCh6R0YjmmztPXOq9aKhiUqLGUrp6Fly3vWk7l2Fg=
|
||||||
github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a/go.mod h1:1nql6U13uTHaLYB8rLS5x9IJc2qT6Xd/Tr1sTX6NE48=
|
github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966/go.mod h1:1nql6U13uTHaLYB8rLS5x9IJc2qT6Xd/Tr1sTX6NE48=
|
||||||
github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE=
|
github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE=
|
||||||
github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
|
github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
|
||||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||||
@ -362,8 +362,6 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
|||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/seccomp/libseccomp-golang v0.9.1 h1:NJjM5DNFOs0s3kYE1WUOr6G8V97sdt46rlXTMfXGWBo=
|
github.com/seccomp/libseccomp-golang v0.9.1 h1:NJjM5DNFOs0s3kYE1WUOr6G8V97sdt46rlXTMfXGWBo=
|
||||||
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
|
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
|
||||||
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d h1:G1nNtZVTzcCvVKMwcG0Vispo3bhc15EbjO5uamiLikI=
|
|
||||||
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d/go.mod h1:stlh9OsqBQSdwxTxX73mu41BBtRbIpZLQ7flcAoxAfo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||||
|
1
vendor/BUILD
vendored
1
vendor/BUILD
vendored
@ -329,7 +329,6 @@ filegroup(
|
|||||||
"//vendor/github.com/russross/blackfriday:all-srcs",
|
"//vendor/github.com/russross/blackfriday:all-srcs",
|
||||||
"//vendor/github.com/satori/go.uuid:all-srcs",
|
"//vendor/github.com/satori/go.uuid:all-srcs",
|
||||||
"//vendor/github.com/seccomp/libseccomp-golang:all-srcs",
|
"//vendor/github.com/seccomp/libseccomp-golang:all-srcs",
|
||||||
"//vendor/github.com/sigma/go-inotify:all-srcs",
|
|
||||||
"//vendor/github.com/sirupsen/logrus:all-srcs",
|
"//vendor/github.com/sirupsen/logrus:all-srcs",
|
||||||
"//vendor/github.com/soheilhy/cmux:all-srcs",
|
"//vendor/github.com/soheilhy/cmux:all-srcs",
|
||||||
"//vendor/github.com/spf13/afero:all-srcs",
|
"//vendor/github.com/spf13/afero:all-srcs",
|
||||||
|
8
vendor/github.com/google/cadvisor/cache/memory/memory.go
generated
vendored
8
vendor/github.com/google/cadvisor/cache/memory/memory.go
generated
vendored
@ -70,7 +70,7 @@ type InMemoryCache struct {
|
|||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
containerCacheMap map[string]*containerCache
|
containerCacheMap map[string]*containerCache
|
||||||
maxAge time.Duration
|
maxAge time.Duration
|
||||||
backend storage.StorageDriver
|
backend []storage.StorageDriver
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *InMemoryCache) AddStats(cInfo *info.ContainerInfo, stats *info.ContainerStats) error {
|
func (self *InMemoryCache) AddStats(cInfo *info.ContainerInfo, stats *info.ContainerStats) error {
|
||||||
@ -86,11 +86,11 @@ func (self *InMemoryCache) AddStats(cInfo *info.ContainerInfo, stats *info.Conta
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if self.backend != nil {
|
for _, backend := range self.backend {
|
||||||
// TODO(monnand): To deal with long delay write operations, we
|
// TODO(monnand): To deal with long delay write operations, we
|
||||||
// may want to start a pool of goroutines to do write
|
// may want to start a pool of goroutines to do write
|
||||||
// operations.
|
// operations.
|
||||||
if err := self.backend.AddStats(cInfo, stats); err != nil {
|
if err := backend.AddStats(cInfo, stats); err != nil {
|
||||||
klog.Error(err)
|
klog.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ func (self *InMemoryCache) RemoveContainer(containerName string) error {
|
|||||||
|
|
||||||
func New(
|
func New(
|
||||||
maxAge time.Duration,
|
maxAge time.Duration,
|
||||||
backend storage.StorageDriver,
|
backend []storage.StorageDriver,
|
||||||
) *InMemoryCache {
|
) *InMemoryCache {
|
||||||
ret := &InMemoryCache{
|
ret := &InMemoryCache{
|
||||||
containerCacheMap: make(map[string]*containerCache, 32),
|
containerCacheMap: make(map[string]*containerCache, 32),
|
||||||
|
2
vendor/github.com/google/cadvisor/container/common/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/common/BUILD
generated
vendored
@ -18,8 +18,8 @@ go_library(
|
|||||||
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
"//vendor/github.com/google/cadvisor/utils:go_default_library",
|
||||||
"//vendor/github.com/karrick/godirwalk:go_default_library",
|
"//vendor/github.com/karrick/godirwalk:go_default_library",
|
||||||
"//vendor/github.com/pkg/errors: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",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
|
"//vendor/k8s.io/utils/inotify:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
11
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
11
vendor/github.com/google/cadvisor/container/common/helpers.go
generated
vendored
@ -116,6 +116,15 @@ func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Processes, read it's value from pids path directly
|
||||||
|
pidsRoot, ok := cgroupPaths["pids"]
|
||||||
|
if ok {
|
||||||
|
if utils.FileExists(pidsRoot) {
|
||||||
|
spec.HasProcesses = true
|
||||||
|
spec.Processes.Limit = readUInt64(pidsRoot, "pids.max")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spec.HasNetwork = hasNetwork
|
spec.HasNetwork = hasNetwork
|
||||||
spec.HasFilesystem = hasFilesystem
|
spec.HasFilesystem = hasFilesystem
|
||||||
|
|
||||||
@ -143,7 +152,7 @@ func readString(dirpath string, file string) string {
|
|||||||
|
|
||||||
func readUInt64(dirpath string, file string) uint64 {
|
func readUInt64(dirpath string, file string) uint64 {
|
||||||
out := readString(dirpath, file)
|
out := readString(dirpath, file)
|
||||||
if out == "" {
|
if out == "" || out == "max" {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
inotify "github.com/sigma/go-inotify"
|
inotify "k8s.io/utils/inotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Watcher for container-related inotify events in the cgroup hierarchy.
|
// Watcher for container-related inotify events in the cgroup hierarchy.
|
||||||
@ -55,7 +55,7 @@ func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
|
|||||||
|
|
||||||
// Register an inotify notification.
|
// Register an inotify notification.
|
||||||
if !cgroupsWatched[dir] {
|
if !cgroupsWatched[dir] {
|
||||||
err := iw.watcher.AddWatch(dir, inotify.IN_CREATE|inotify.IN_DELETE|inotify.IN_MOVE)
|
err := iw.watcher.AddWatch(dir, inotify.InCreate|inotify.InDelete|inotify.InMove)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return alreadyWatched, err
|
return alreadyWatched, err
|
||||||
}
|
}
|
||||||
|
2
vendor/github.com/google/cadvisor/container/libcontainer/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/libcontainer/BUILD
generated
vendored
@ -6,7 +6,6 @@ go_library(
|
|||||||
"handler.go",
|
"handler.go",
|
||||||
"helpers.go",
|
"helpers.go",
|
||||||
],
|
],
|
||||||
cgo = True,
|
|
||||||
importmap = "k8s.io/kubernetes/vendor/github.com/google/cadvisor/container/libcontainer",
|
importmap = "k8s.io/kubernetes/vendor/github.com/google/cadvisor/container/libcontainer",
|
||||||
importpath = "github.com/google/cadvisor/container/libcontainer",
|
importpath = "github.com/google/cadvisor/container/libcontainer",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
@ -15,6 +14,7 @@ go_library(
|
|||||||
"//vendor/github.com/google/cadvisor/info/v1: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:go_default_library",
|
||||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library",
|
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library",
|
||||||
|
"//vendor/golang.org/x/sys/unix:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
46
vendor/github.com/google/cadvisor/container/libcontainer/handler.go
generated
vendored
46
vendor/github.com/google/cadvisor/container/libcontainer/handler.go
generated
vendored
@ -27,18 +27,15 @@ import (
|
|||||||
|
|
||||||
"github.com/google/cadvisor/container"
|
"github.com/google/cadvisor/container"
|
||||||
info "github.com/google/cadvisor/info/v1"
|
info "github.com/google/cadvisor/info/v1"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer"
|
"github.com/opencontainers/runc/libcontainer"
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
|
||||||
#include <unistd.h>
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
cgroupManager cgroups.Manager
|
cgroupManager cgroups.Manager
|
||||||
rootFs string
|
rootFs string
|
||||||
@ -133,6 +130,9 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
|||||||
klog.V(4).Infof("Unable to get Process Stats: %v", err)
|
klog.V(4).Infof("Unable to get Process Stats: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if include processes metrics, just set threads metrics if exist, and has no relationship with cpu path
|
||||||
|
setThreadsStats(cgroupStats, stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For backwards compatibility.
|
// For backwards compatibility.
|
||||||
@ -144,7 +144,7 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processStatsFromProcs(rootFs string, cgroupPath string) (info.ProcessStats, error) {
|
func processStatsFromProcs(rootFs string, cgroupPath string) (info.ProcessStats, error) {
|
||||||
var fdCount uint64
|
var fdCount, socketCount uint64
|
||||||
filePath := path.Join(cgroupPath, "cgroup.procs")
|
filePath := path.Join(cgroupPath, "cgroup.procs")
|
||||||
out, err := ioutil.ReadFile(filePath)
|
out, err := ioutil.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -168,11 +168,23 @@ func processStatsFromProcs(rootFs string, cgroupPath string) (info.ProcessStats,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fdCount += uint64(len(fds))
|
fdCount += uint64(len(fds))
|
||||||
|
for _, fd := range fds {
|
||||||
|
fdPath := path.Join(dirPath, fd.Name())
|
||||||
|
linkName, err := os.Readlink(fdPath)
|
||||||
|
if err != nil {
|
||||||
|
klog.V(4).Infof("error while reading %q link: %v", fdPath, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(linkName, "socket") {
|
||||||
|
socketCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processStats := info.ProcessStats{
|
processStats := info.ProcessStats{
|
||||||
ProcessCount: uint64(len(pids)),
|
ProcessCount: uint64(len(pids)),
|
||||||
FdCount: fdCount,
|
FdCount: fdCount,
|
||||||
|
SocketCount: socketCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
return processStats, nil
|
return processStats, nil
|
||||||
@ -514,19 +526,12 @@ func setCpuStats(s *cgroups.Stats, ret *info.ContainerStats, withPerCPU bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copied from
|
|
||||||
// https://github.com/moby/moby/blob/8b1adf55c2af329a4334f21d9444d6a169000c81/daemon/stats/collector_unix.go#L73
|
|
||||||
// Apache 2.0, Copyright Docker, Inc.
|
|
||||||
func getNumberOnlineCPUs() (uint32, error) {
|
func getNumberOnlineCPUs() (uint32, error) {
|
||||||
i, err := C.sysconf(C._SC_NPROCESSORS_ONLN)
|
var availableCPUs unix.CPUSet
|
||||||
// According to POSIX - errno is undefined after successful
|
if err := unix.SchedGetaffinity(0, &availableCPUs); err != nil {
|
||||||
// sysconf, and can be non-zero in several cases, so look for
|
|
||||||
// error in returned value not in errno.
|
|
||||||
// (https://sourceware.org/bugzilla/show_bug.cgi?id=21536)
|
|
||||||
if i == -1 {
|
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return uint32(i), nil
|
return uint32(availableCPUs.Count()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setDiskIoStats(s *cgroups.Stats, ret *info.ContainerStats) {
|
func setDiskIoStats(s *cgroups.Stats, ret *info.ContainerStats) {
|
||||||
@ -598,6 +603,15 @@ func setNetworkStats(libcontainerStats *libcontainer.Stats, ret *info.ContainerS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read from pids path not cpu
|
||||||
|
func setThreadsStats(s *cgroups.Stats, ret *info.ContainerStats) {
|
||||||
|
if s != nil {
|
||||||
|
ret.Processes.ThreadsCurrent = s.PidsStats.Current
|
||||||
|
ret.Processes.ThreadsMax = s.PidsStats.Limit
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func newContainerStats(libcontainerStats *libcontainer.Stats, includedMetrics container.MetricSet) *info.ContainerStats {
|
func newContainerStats(libcontainerStats *libcontainer.Stats, includedMetrics container.MetricSet) *info.ContainerStats {
|
||||||
ret := &info.ContainerStats{
|
ret := &info.ContainerStats{
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now(),
|
||||||
|
1
vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
generated
vendored
1
vendor/github.com/google/cadvisor/container/libcontainer/helpers.go
generated
vendored
@ -106,6 +106,7 @@ var supportedSubsystems map[string]struct{} = map[string]struct{}{
|
|||||||
"cpu": {},
|
"cpu": {},
|
||||||
"cpuacct": {},
|
"cpuacct": {},
|
||||||
"memory": {},
|
"memory": {},
|
||||||
|
"pids": {},
|
||||||
"cpuset": {},
|
"cpuset": {},
|
||||||
"blkio": {},
|
"blkio": {},
|
||||||
"devices": {},
|
"devices": {},
|
||||||
|
2
vendor/github.com/google/cadvisor/container/raw/BUILD
generated
vendored
2
vendor/github.com/google/cadvisor/container/raw/BUILD
generated
vendored
@ -20,8 +20,8 @@ go_library(
|
|||||||
"//vendor/github.com/google/cadvisor/watcher:go_default_library",
|
"//vendor/github.com/google/cadvisor/watcher:go_default_library",
|
||||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs: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/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
|
||||||
"//vendor/github.com/sigma/go-inotify:go_default_library",
|
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
|
"//vendor/k8s.io/utils/inotify:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
3
vendor/github.com/google/cadvisor/container/raw/handler.go
generated
vendored
3
vendor/github.com/google/cadvisor/container/raw/handler.go
generated
vendored
@ -77,6 +77,9 @@ func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSu
|
|||||||
pid := 0
|
pid := 0
|
||||||
if isRootCgroup(name) {
|
if isRootCgroup(name) {
|
||||||
pid = 1
|
pid = 1
|
||||||
|
|
||||||
|
// delete pids from cgroup paths because /sys/fs/cgroup/pids/pids.current not exist
|
||||||
|
delete(cgroupPaths, "pids")
|
||||||
}
|
}
|
||||||
|
|
||||||
handler := libcontainer.NewHandler(cgroupManager, rootFs, pid, includedMetrics)
|
handler := libcontainer.NewHandler(cgroupManager, rootFs, pid, includedMetrics)
|
||||||
|
10
vendor/github.com/google/cadvisor/container/raw/watcher.go
generated
vendored
10
vendor/github.com/google/cadvisor/container/raw/watcher.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/google/cadvisor/container/common"
|
"github.com/google/cadvisor/container/common"
|
||||||
"github.com/google/cadvisor/container/libcontainer"
|
"github.com/google/cadvisor/container/libcontainer"
|
||||||
"github.com/google/cadvisor/watcher"
|
"github.com/google/cadvisor/watcher"
|
||||||
inotify "github.com/sigma/go-inotify"
|
inotify "k8s.io/utils/inotify"
|
||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
@ -172,13 +172,13 @@ func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan
|
|||||||
// Convert the inotify event type to a container create or delete.
|
// Convert the inotify event type to a container create or delete.
|
||||||
var eventType watcher.ContainerEventType
|
var eventType watcher.ContainerEventType
|
||||||
switch {
|
switch {
|
||||||
case (event.Mask & inotify.IN_CREATE) > 0:
|
case (event.Mask & inotify.InCreate) > 0:
|
||||||
eventType = watcher.ContainerAdd
|
eventType = watcher.ContainerAdd
|
||||||
case (event.Mask & inotify.IN_DELETE) > 0:
|
case (event.Mask & inotify.InDelete) > 0:
|
||||||
eventType = watcher.ContainerDelete
|
eventType = watcher.ContainerDelete
|
||||||
case (event.Mask & inotify.IN_MOVED_FROM) > 0:
|
case (event.Mask & inotify.InMovedFrom) > 0:
|
||||||
eventType = watcher.ContainerDelete
|
eventType = watcher.ContainerDelete
|
||||||
case (event.Mask & inotify.IN_MOVED_TO) > 0:
|
case (event.Mask & inotify.InMovedTo) > 0:
|
||||||
eventType = watcher.ContainerAdd
|
eventType = watcher.ContainerAdd
|
||||||
default:
|
default:
|
||||||
// Ignore other events.
|
// Ignore other events.
|
||||||
|
19
vendor/github.com/google/cadvisor/info/v1/container.go
generated
vendored
19
vendor/github.com/google/cadvisor/info/v1/container.go
generated
vendored
@ -41,6 +41,10 @@ type MemorySpec struct {
|
|||||||
SwapLimit uint64 `json:"swap_limit,omitempty"`
|
SwapLimit uint64 `json:"swap_limit,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProcessSpec struct {
|
||||||
|
Limit uint64 `json:"limit,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ContainerSpec struct {
|
type ContainerSpec struct {
|
||||||
// Time at which the container was created.
|
// Time at which the container was created.
|
||||||
CreationTime time.Time `json:"creation_time,omitempty"`
|
CreationTime time.Time `json:"creation_time,omitempty"`
|
||||||
@ -58,6 +62,9 @@ type ContainerSpec struct {
|
|||||||
|
|
||||||
HasNetwork bool `json:"has_network"`
|
HasNetwork bool `json:"has_network"`
|
||||||
|
|
||||||
|
HasProcesses bool `json:"has_processes"`
|
||||||
|
Processes ProcessSpec `json:"processes,omitempty"`
|
||||||
|
|
||||||
HasFilesystem bool `json:"has_filesystem"`
|
HasFilesystem bool `json:"has_filesystem"`
|
||||||
|
|
||||||
// HasDiskIo when true, indicates that DiskIo stats will be available.
|
// HasDiskIo when true, indicates that DiskIo stats will be available.
|
||||||
@ -563,6 +570,15 @@ type ProcessStats struct {
|
|||||||
|
|
||||||
// Number of open file descriptors
|
// Number of open file descriptors
|
||||||
FdCount uint64 `json:"fd_count"`
|
FdCount uint64 `json:"fd_count"`
|
||||||
|
|
||||||
|
// Number of sockets
|
||||||
|
SocketCount uint64 `json:"socket_count"`
|
||||||
|
|
||||||
|
// Number of threads currently in container
|
||||||
|
ThreadsCurrent uint64 `json:"threads_current,omitempty"`
|
||||||
|
|
||||||
|
// Maxium number of threads allowed in container
|
||||||
|
ThreadsMax uint64 `json:"threads_max,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerStats struct {
|
type ContainerStats struct {
|
||||||
@ -630,6 +646,9 @@ func (a *ContainerStats) StatsEq(b *ContainerStats) bool {
|
|||||||
if !reflect.DeepEqual(a.Network, b.Network) {
|
if !reflect.DeepEqual(a.Network, b.Network) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if !reflect.DeepEqual(a.Processes, b.Processes) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if !reflect.DeepEqual(a.Filesystem, b.Filesystem) {
|
if !reflect.DeepEqual(a.Filesystem, b.Filesystem) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/google/cadvisor/info/v2/container.go
generated
vendored
8
vendor/github.com/google/cadvisor/info/v2/container.go
generated
vendored
@ -90,6 +90,9 @@ type ContainerSpec struct {
|
|||||||
HasCustomMetrics bool `json:"has_custom_metrics"`
|
HasCustomMetrics bool `json:"has_custom_metrics"`
|
||||||
CustomMetrics []v1.MetricSpec `json:"custom_metrics,omitempty"`
|
CustomMetrics []v1.MetricSpec `json:"custom_metrics,omitempty"`
|
||||||
|
|
||||||
|
HasProcesses bool `json:"has_processes"`
|
||||||
|
Processes v1.ProcessSpec `json:"processes,omitempty"`
|
||||||
|
|
||||||
// Following resources have no associated spec, but are being isolated.
|
// Following resources have no associated spec, but are being isolated.
|
||||||
HasNetwork bool `json:"has_network"`
|
HasNetwork bool `json:"has_network"`
|
||||||
HasFilesystem bool `json:"has_filesystem"`
|
HasFilesystem bool `json:"has_filesystem"`
|
||||||
@ -117,6 +120,9 @@ type DeprecatedContainerStats struct {
|
|||||||
// Network statistics
|
// Network statistics
|
||||||
HasNetwork bool `json:"has_network"`
|
HasNetwork bool `json:"has_network"`
|
||||||
Network NetworkStats `json:"network,omitempty"`
|
Network NetworkStats `json:"network,omitempty"`
|
||||||
|
// Processes statistics
|
||||||
|
HasProcesses bool `json:"has_processes"`
|
||||||
|
Processes v1.ProcessStats `json:"processes,omitempty"`
|
||||||
// Filesystem statistics
|
// Filesystem statistics
|
||||||
HasFilesystem bool `json:"has_filesystem"`
|
HasFilesystem bool `json:"has_filesystem"`
|
||||||
Filesystem []v1.FsStats `json:"filesystem,omitempty"`
|
Filesystem []v1.FsStats `json:"filesystem,omitempty"`
|
||||||
@ -142,6 +148,8 @@ type ContainerStats struct {
|
|||||||
Memory *v1.MemoryStats `json:"memory,omitempty"`
|
Memory *v1.MemoryStats `json:"memory,omitempty"`
|
||||||
// Network statistics
|
// Network statistics
|
||||||
Network *NetworkStats `json:"network,omitempty"`
|
Network *NetworkStats `json:"network,omitempty"`
|
||||||
|
// Processes statistics
|
||||||
|
Processes *v1.ProcessStats `json:"processes,omitempty"`
|
||||||
// Filesystem statistics
|
// Filesystem statistics
|
||||||
Filesystem *FilesystemStats `json:"filesystem,omitempty"`
|
Filesystem *FilesystemStats `json:"filesystem,omitempty"`
|
||||||
// Task load statistics
|
// Task load statistics
|
||||||
|
7
vendor/github.com/google/cadvisor/info/v2/conversion.go
generated
vendored
7
vendor/github.com/google/cadvisor/info/v2/conversion.go
generated
vendored
@ -124,6 +124,9 @@ func ContainerStatsFromV1(containerName string, spec *v1.ContainerSpec, stats []
|
|||||||
Interfaces: val.Network.Interfaces,
|
Interfaces: val.Network.Interfaces,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if spec.HasProcesses {
|
||||||
|
stat.Processes = &val.Processes
|
||||||
|
}
|
||||||
if spec.HasFilesystem {
|
if spec.HasFilesystem {
|
||||||
if len(val.Filesystem) == 1 {
|
if len(val.Filesystem) == 1 {
|
||||||
stat.Filesystem = &FilesystemStats{
|
stat.Filesystem = &FilesystemStats{
|
||||||
@ -180,6 +183,9 @@ func DeprecatedStatsFromV1(cont *v1.ContainerInfo) []DeprecatedContainerStats {
|
|||||||
if stat.HasNetwork {
|
if stat.HasNetwork {
|
||||||
stat.Network.Interfaces = val.Network.Interfaces
|
stat.Network.Interfaces = val.Network.Interfaces
|
||||||
}
|
}
|
||||||
|
if stat.HasProcesses {
|
||||||
|
stat.Processes = val.Processes
|
||||||
|
}
|
||||||
if stat.HasFilesystem {
|
if stat.HasFilesystem {
|
||||||
stat.Filesystem = val.Filesystem
|
stat.Filesystem = val.Filesystem
|
||||||
}
|
}
|
||||||
@ -255,6 +261,7 @@ func ContainerSpecFromV1(specV1 *v1.ContainerSpec, aliases []string, namespace s
|
|||||||
HasMemory: specV1.HasMemory,
|
HasMemory: specV1.HasMemory,
|
||||||
HasFilesystem: specV1.HasFilesystem,
|
HasFilesystem: specV1.HasFilesystem,
|
||||||
HasNetwork: specV1.HasNetwork,
|
HasNetwork: specV1.HasNetwork,
|
||||||
|
HasProcesses: specV1.HasProcesses,
|
||||||
HasDiskIo: specV1.HasDiskIo,
|
HasDiskIo: specV1.HasDiskIo,
|
||||||
HasCustomMetrics: specV1.HasCustomMetrics,
|
HasCustomMetrics: specV1.HasCustomMetrics,
|
||||||
Image: specV1.Image,
|
Image: specV1.Image,
|
||||||
|
49
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
49
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
@ -1045,7 +1045,42 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
|
|||||||
return metricValues{{value: float64(s.Processes.FdCount), timestamp: s.Timestamp}}
|
return metricValues{{value: float64(s.Processes.FdCount), timestamp: s.Timestamp}}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "container_sockets",
|
||||||
|
help: "Number of open sockets for the container.",
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
|
getValues: func(s *info.ContainerStats) metricValues {
|
||||||
|
return metricValues{{value: float64(s.Processes.SocketCount), timestamp: s.Timestamp}}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "container_threads_max",
|
||||||
|
help: "Maximum number of threads allowed inside the container, infinity if value is zero",
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
|
getValues: func(s *info.ContainerStats) metricValues {
|
||||||
|
return metricValues{
|
||||||
|
{
|
||||||
|
value: float64(s.Processes.ThreadsMax),
|
||||||
|
timestamp: s.Timestamp,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "container_threads",
|
||||||
|
help: "Number of threads running inside the container",
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
|
getValues: func(s *info.ContainerStats) metricValues {
|
||||||
|
return metricValues{
|
||||||
|
{
|
||||||
|
value: float64(s.Processes.ThreadsCurrent),
|
||||||
|
timestamp: s.Timestamp,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
@ -1156,8 +1191,18 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
|||||||
labels := make([]string, 0, len(rawLabels))
|
labels := make([]string, 0, len(rawLabels))
|
||||||
containerLabels := c.containerLabelsFunc(cont)
|
containerLabels := c.containerLabelsFunc(cont)
|
||||||
for l := range rawLabels {
|
for l := range rawLabels {
|
||||||
labels = append(labels, sanitizeLabelName(l))
|
duplicate := false
|
||||||
values = append(values, containerLabels[l])
|
sl := sanitizeLabelName(l)
|
||||||
|
for _, x := range labels {
|
||||||
|
if sl == x {
|
||||||
|
duplicate = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !duplicate {
|
||||||
|
labels = append(labels, sl)
|
||||||
|
values = append(values, containerLabels[l])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container spec
|
// Container spec
|
||||||
|
33
vendor/github.com/google/cadvisor/utils/cloudinfo/aws/aws.go
generated
vendored
33
vendor/github.com/google/cadvisor/utils/cloudinfo/aws/aws.go
generated
vendored
@ -16,7 +16,6 @@ package cloudinfo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
@ -28,9 +27,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
productVerFileName = "/sys/class/dmi/id/product_version"
|
productVerFileName = "/sys/class/dmi/id/product_version"
|
||||||
biosVerFileName = "/sys/class/dmi/id/bios_vendor"
|
biosVerFileName = "/sys/class/dmi/id/bios_vendor"
|
||||||
amazon = "amazon"
|
systemdOSReleaseFileName = "/etc/os-release"
|
||||||
|
amazon = "amazon"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -42,23 +42,18 @@ type provider struct{}
|
|||||||
var _ cloudinfo.CloudProvider = provider{}
|
var _ cloudinfo.CloudProvider = provider{}
|
||||||
|
|
||||||
func (provider) IsActiveProvider() bool {
|
func (provider) IsActiveProvider() bool {
|
||||||
var dataProduct []byte
|
return fileContainsAmazonIdentifier(productVerFileName) ||
|
||||||
var dataBios []byte
|
fileContainsAmazonIdentifier(biosVerFileName) ||
|
||||||
if _, err := os.Stat(productVerFileName); err == nil {
|
fileContainsAmazonIdentifier(systemdOSReleaseFileName)
|
||||||
dataProduct, err = ioutil.ReadFile(productVerFileName)
|
}
|
||||||
if err != nil {
|
|
||||||
return false
|
func fileContainsAmazonIdentifier(filename string) bool {
|
||||||
}
|
fileContent, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(biosVerFileName); err == nil {
|
return strings.Contains(string(fileContent), amazon)
|
||||||
dataBios, err = ioutil.ReadFile(biosVerFileName)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Contains(string(dataProduct), amazon) || strings.Contains(strings.ToLower(string(dataBios)), amazon)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAwsMetadata(name string) string {
|
func getAwsMetadata(name string) string {
|
||||||
|
3
vendor/github.com/google/cadvisor/utils/cpuload/netlink/BUILD
generated
vendored
3
vendor/github.com/google/cadvisor/utils/cpuload/netlink/BUILD
generated
vendored
@ -4,16 +4,15 @@ go_library(
|
|||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"conn.go",
|
"conn.go",
|
||||||
"defs.go",
|
|
||||||
"netlink.go",
|
"netlink.go",
|
||||||
"reader.go",
|
"reader.go",
|
||||||
],
|
],
|
||||||
cgo = True,
|
|
||||||
importmap = "k8s.io/kubernetes/vendor/github.com/google/cadvisor/utils/cpuload/netlink",
|
importmap = "k8s.io/kubernetes/vendor/github.com/google/cadvisor/utils/cpuload/netlink",
|
||||||
importpath = "github.com/google/cadvisor/utils/cpuload/netlink",
|
importpath = "github.com/google/cadvisor/utils/cpuload/netlink",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||||
|
"//vendor/golang.org/x/sys/unix:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
26
vendor/github.com/google/cadvisor/utils/cpuload/netlink/defs.go
generated
vendored
26
vendor/github.com/google/cadvisor/utils/cpuload/netlink/defs.go
generated
vendored
@ -1,26 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc. All Rights Reserved.
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
package netlink
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <linux/taskstats.h>
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
type TaskStats C.struct_taskstats
|
|
||||||
|
|
||||||
const (
|
|
||||||
__TASKSTATS_CMD_MAX = C.__TASKSTATS_CMD_MAX
|
|
||||||
)
|
|
21
vendor/github.com/google/cadvisor/utils/cpuload/netlink/netlink.go
generated
vendored
21
vendor/github.com/google/cadvisor/utils/cpuload/netlink/netlink.go
generated
vendored
@ -22,16 +22,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
info "github.com/google/cadvisor/info/v1"
|
info "github.com/google/cadvisor/info/v1"
|
||||||
)
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
const (
|
|
||||||
// Kernel constants for tasks stats.
|
|
||||||
genlIdCtrl = syscall.NLMSG_MIN_TYPE // GENL_ID_CTRL
|
|
||||||
taskstatsGenlName = "TASKSTATS" // TASKSTATS_GENL_NAME
|
|
||||||
cgroupStatsCmdAttrFd = 0x1 // CGROUPSTATS_CMD_ATTR_FD
|
|
||||||
ctrlAttrFamilyId = 0x1 // CTRL_ATTR_FAMILY_ID
|
|
||||||
ctrlAttrFamilyName = 0x2 // CTRL_ATTR_FAMILY_NAME
|
|
||||||
ctrlCmdGetFamily = 0x3 // CTRL_CMD_GETFAMILY
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -124,15 +115,15 @@ func prepareMessage(headerType uint16, cmd uint8, attributes []byte) (msg netlin
|
|||||||
// Prepares message to query family id for task stats.
|
// Prepares message to query family id for task stats.
|
||||||
func prepareFamilyMessage() (msg netlinkMessage) {
|
func prepareFamilyMessage() (msg netlinkMessage) {
|
||||||
buf := bytes.NewBuffer([]byte{})
|
buf := bytes.NewBuffer([]byte{})
|
||||||
addAttribute(buf, ctrlAttrFamilyName, taskstatsGenlName, len(taskstatsGenlName)+1)
|
addAttribute(buf, unix.CTRL_ATTR_FAMILY_NAME, unix.TASKSTATS_GENL_NAME, len(unix.TASKSTATS_GENL_NAME)+1)
|
||||||
return prepareMessage(genlIdCtrl, ctrlCmdGetFamily, buf.Bytes())
|
return prepareMessage(unix.GENL_ID_CTRL, unix.CTRL_CMD_GETFAMILY, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepares message to query task stats for a task group.
|
// Prepares message to query task stats for a task group.
|
||||||
func prepareCmdMessage(id uint16, cfd uintptr) (msg netlinkMessage) {
|
func prepareCmdMessage(id uint16, cfd uintptr) (msg netlinkMessage) {
|
||||||
buf := bytes.NewBuffer([]byte{})
|
buf := bytes.NewBuffer([]byte{})
|
||||||
addAttribute(buf, cgroupStatsCmdAttrFd, uint32(cfd), 4)
|
addAttribute(buf, unix.CGROUPSTATS_CMD_ATTR_FD, uint32(cfd), 4)
|
||||||
return prepareMessage(id, __TASKSTATS_CMD_MAX+1, buf.Bytes())
|
return prepareMessage(id, unix.CGROUPSTATS_CMD_GET, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extracts returned family id from the response.
|
// Extracts returned family id from the response.
|
||||||
@ -158,7 +149,7 @@ func parseFamilyResp(msg syscall.NetlinkMessage) (uint16, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if attr.Type == ctrlAttrFamilyId {
|
if attr.Type == unix.CTRL_ATTR_FAMILY_ID {
|
||||||
err = binary.Read(buf, Endian, &id)
|
err = binary.Read(buf, Endian, &id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
23
vendor/github.com/sigma/go-inotify/BUILD
generated
vendored
23
vendor/github.com/sigma/go-inotify/BUILD
generated
vendored
@ -1,23 +0,0 @@
|
|||||||
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
27
vendor/github.com/sigma/go-inotify/LICENSE
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
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
22
vendor/github.com/sigma/go-inotify/PATENTS
generated
vendored
@ -1,22 +0,0 @@
|
|||||||
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
5
vendor/github.com/sigma/go-inotify/README.md
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
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
306
vendor/github.com/sigma/go-inotify/inotify_linux.go
generated
vendored
@ -1,306 +0,0 @@
|
|||||||
// 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 "github.com/sigma/go-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"},
|
|
||||||
}
|
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -418,7 +418,7 @@ github.com/golang/protobuf/ptypes/timestamp
|
|||||||
github.com/golang/protobuf/ptypes/wrappers
|
github.com/golang/protobuf/ptypes/wrappers
|
||||||
# github.com/google/btree v0.0.0-20160524151835-7d79101e329e => github.com/google/btree v0.0.0-20160524151835-7d79101e329e
|
# github.com/google/btree v0.0.0-20160524151835-7d79101e329e => github.com/google/btree v0.0.0-20160524151835-7d79101e329e
|
||||||
github.com/google/btree
|
github.com/google/btree
|
||||||
# github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a => github.com/google/cadvisor v0.33.2-0.20190411163913-9db8c7dee20a
|
# github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966 => github.com/google/cadvisor v0.33.2-0.20190719172907-9fa3b1429966
|
||||||
github.com/google/cadvisor/accelerators
|
github.com/google/cadvisor/accelerators
|
||||||
github.com/google/cadvisor/cache/memory
|
github.com/google/cadvisor/cache/memory
|
||||||
github.com/google/cadvisor/client/v2
|
github.com/google/cadvisor/client/v2
|
||||||
@ -728,8 +728,6 @@ github.com/russross/blackfriday
|
|||||||
github.com/satori/go.uuid
|
github.com/satori/go.uuid
|
||||||
# github.com/seccomp/libseccomp-golang v0.9.1 => github.com/seccomp/libseccomp-golang v0.9.1
|
# github.com/seccomp/libseccomp-golang v0.9.1 => github.com/seccomp/libseccomp-golang v0.9.1
|
||||||
github.com/seccomp/libseccomp-golang
|
github.com/seccomp/libseccomp-golang
|
||||||
# github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d => github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d
|
|
||||||
github.com/sigma/go-inotify
|
|
||||||
# github.com/sirupsen/logrus v1.4.2 => github.com/sirupsen/logrus v1.4.2
|
# github.com/sirupsen/logrus v1.4.2 => github.com/sirupsen/logrus v1.4.2
|
||||||
github.com/sirupsen/logrus
|
github.com/sirupsen/logrus
|
||||||
# github.com/soheilhy/cmux v0.1.3 => github.com/soheilhy/cmux v0.1.3
|
# github.com/soheilhy/cmux v0.1.3 => github.com/soheilhy/cmux v0.1.3
|
||||||
|
Loading…
Reference in New Issue
Block a user