Skip to content

Commit

Permalink
Update docker/runc and a few other dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
  • Loading branch information
dims committed Jan 26, 2021
1 parent 19e51c8 commit c0e6c94
Show file tree
Hide file tree
Showing 7 changed files with 595 additions and 162 deletions.
8 changes: 4 additions & 4 deletions cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ require (
github.com/onsi/ginkgo v1.11.0 // indirect
github.com/onsi/gomega v1.7.1 // indirect
github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13 // indirect
github.com/prometheus/client_golang v1.8.0
github.com/stretchr/testify v1.6.1
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
google.golang.org/api v0.34.0
github.com/prometheus/client_golang v1.9.0
github.com/stretchr/testify v1.7.0
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5
google.golang.org/api v0.36.0
gopkg.in/olivere/elastic.v2 v2.0.12
k8s.io/klog/v2 v2.2.0
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
Expand Down
160 changes: 113 additions & 47 deletions cmd/go.sum

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
}

for _, mnt := range mounts {
if !strings.HasPrefix(mnt.Fstype, "ext") && !strings.HasPrefix(mnt.Fstype, "nfs") &&
!supportedFsType[mnt.Fstype] {
if !strings.HasPrefix(mnt.FSType, "ext") && !strings.HasPrefix(mnt.FSType, "nfs") &&
!supportedFsType[mnt.FSType] {
continue
}
// Avoid bind mounts, exclude tmpfs.
if _, ok := partitions[mnt.Source]; ok {
if mnt.Fstype != "tmpfs" {
if mnt.FSType != "tmpfs" {
continue
}
}
Expand All @@ -203,12 +203,12 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
}

// using mountpoint to replace device once fstype it tmpfs
if mnt.Fstype == "tmpfs" {
if mnt.FSType == "tmpfs" {
mnt.Source = mnt.Mountpoint
}
// btrfs fix: following workaround fixes wrong btrfs Major and Minor Ids reported in /proc/self/mountinfo.
// instead of using values from /proc/self/mountinfo we use stat to get Ids from btrfs mount point
if mnt.Fstype == "btrfs" && mnt.Major == 0 && strings.HasPrefix(mnt.Source, "/dev/") {
if mnt.FSType == "btrfs" && mnt.Major == 0 && strings.HasPrefix(mnt.Source, "/dev/") {
major, minor, err := getBtrfsMajorMinorIds(mnt)
if err != nil {
klog.Warningf("%s", err)
Expand All @@ -219,12 +219,12 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
}

// overlay fix: Making mount source unique for all overlay mounts, using the mount's major and minor ids.
if mnt.Fstype == "overlay" {
if mnt.FSType == "overlay" {
mnt.Source = fmt.Sprintf("%s_%d-%d", mnt.Source, mnt.Major, mnt.Minor)
}

partitions[mnt.Source] = partition{
fsType: mnt.Fstype,
fsType: mnt.FSType,
mountpoint: mnt.Mountpoint,
major: uint(mnt.Major),
minor: uint(mnt.Minor),
Expand Down Expand Up @@ -266,7 +266,7 @@ func (i *RealFsInfo) addSystemRootLabel(mounts []*mount.Info) {
for _, m := range mounts {
if m.Mountpoint == "/" {
i.partitions[m.Source] = partition{
fsType: m.Fstype,
fsType: m.FSType,
mountpoint: m.Mountpoint,
major: uint(m.Major),
minor: uint(m.Minor),
Expand Down Expand Up @@ -341,7 +341,7 @@ func (i *RealFsInfo) updateContainerImagesPath(label string, mounts []*mount.Inf
}
if useMount != nil {
i.partitions[useMount.Source] = partition{
fsType: useMount.Fstype,
fsType: useMount.FSType,
mountpoint: useMount.Mountpoint,
major: uint(useMount.Major),
minor: uint(useMount.Minor),
Expand Down Expand Up @@ -569,7 +569,7 @@ func (i *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) {
}

mnt, found := i.mountInfoFromDir(dir)
if found && mnt.Fstype == "btrfs" && mnt.Major == 0 && strings.HasPrefix(mnt.Source, "/dev/") {
if found && mnt.FSType == "btrfs" && mnt.Major == 0 && strings.HasPrefix(mnt.Source, "/dev/") {
major, minor, err := getBtrfsMajorMinorIds(mnt)
if err != nil {
klog.Warningf("%s", err)
Expand Down
54 changes: 27 additions & 27 deletions fs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,12 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "/dev/root",
Mountpoint: "/",
Fstype: "ext4",
FSType: "ext4",
},
{
Source: "/sys/fs/cgroup",
Mountpoint: "/sys/fs/cgroup",
Fstype: "tmpfs",
FSType: "tmpfs",
},
},
expectedDockerDevice: "/dev/root",
Expand All @@ -398,7 +398,7 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "/dev/mapper/vg_vagrant-lv_root",
Mountpoint: "/",
Fstype: "devicemapper",
FSType: "devicemapper",
},
},
expectedDockerDevice: "vg_vagrant-docker--pool",
Expand All @@ -417,7 +417,7 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "/dev/mapper/vg_vagrant-lv_root",
Mountpoint: "/",
Fstype: "devicemapper",
FSType: "devicemapper",
},
{
Source: "/dev/sdb1",
Expand All @@ -432,17 +432,17 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "/dev/sda1",
Mountpoint: "/",
Fstype: "ext4",
FSType: "ext4",
},
{
Source: "/dev/sdb1",
Mountpoint: "/var/lib/docker",
Fstype: "ext4",
FSType: "ext4",
},
{
Source: "/dev/sdb2",
Mountpoint: "/var/lib/docker/btrfs",
Fstype: "btrfs",
FSType: "btrfs",
},
},
expectedDockerDevice: "/dev/sdb2",
Expand All @@ -453,12 +453,12 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "overlay",
Mountpoint: "/",
Fstype: "overlay",
FSType: "overlay",
},
{
Source: "/dev/sda1",
Mountpoint: "/var/lib/docker",
Fstype: "ext4",
FSType: "ext4",
},
},
expectedDockerDevice: "/dev/sda1",
Expand All @@ -469,17 +469,17 @@ func TestAddDockerImagesLabel(t *testing.T) {
{
Source: "overlay",
Mountpoint: "/",
Fstype: "overlay",
FSType: "overlay",
},
{
Source: "/dev/sdb1",
Mountpoint: "/var/lib/docker",
Fstype: "ext4",
FSType: "ext4",
},
{
Source: "/dev/sdb2",
Mountpoint: "/var/lib/docker/overlay2",
Fstype: "ext4",
FSType: "ext4",
},
},
expectedDockerDevice: "/dev/sdb2",
Expand Down Expand Up @@ -528,15 +528,15 @@ func TestProcessMounts(t *testing.T) {
{
name: "unsupported fs types",
mounts: []*mount.Info{
{Fstype: "somethingelse"},
{FSType: "somethingelse"},
},
expected: map[string]partition{},
},
{
name: "avoid bind mounts",
mounts: []*mount.Info{
{Root: "/", Mountpoint: "/", Source: "/dev/sda1", Fstype: "xfs", Major: 253, Minor: 0},
{Root: "/foo", Mountpoint: "/bar", Source: "/dev/sda1", Fstype: "xfs", Major: 253, Minor: 0},
{Root: "/", Mountpoint: "/", Source: "/dev/sda1", FSType: "xfs", Major: 253, Minor: 0},
{Root: "/foo", Mountpoint: "/bar", Source: "/dev/sda1", FSType: "xfs", Major: 253, Minor: 0},
},
expected: map[string]partition{
"/dev/sda1": {fsType: "xfs", mountpoint: "/", major: 253, minor: 0},
Expand All @@ -545,9 +545,9 @@ func TestProcessMounts(t *testing.T) {
{
name: "exclude prefixes",
mounts: []*mount.Info{
{Root: "/", Mountpoint: "/someother", Source: "/dev/sda1", Fstype: "xfs", Major: 253, Minor: 2},
{Root: "/", Mountpoint: "/", Source: "/dev/sda2", Fstype: "xfs", Major: 253, Minor: 0},
{Root: "/", Mountpoint: "/excludeme", Source: "/dev/sda3", Fstype: "xfs", Major: 253, Minor: 1},
{Root: "/", Mountpoint: "/someother", Source: "/dev/sda1", FSType: "xfs", Major: 253, Minor: 2},
{Root: "/", Mountpoint: "/", Source: "/dev/sda2", FSType: "xfs", Major: 253, Minor: 0},
{Root: "/", Mountpoint: "/excludeme", Source: "/dev/sda3", FSType: "xfs", Major: 253, Minor: 1},
},
excludedPrefixes: []string{"/exclude", "/some"},
expected: map[string]partition{
Expand All @@ -557,15 +557,15 @@ func TestProcessMounts(t *testing.T) {
{
name: "supported fs types",
mounts: []*mount.Info{
{Root: "/", Mountpoint: "/a", Source: "/dev/sda", Fstype: "ext3", Major: 253, Minor: 0},
{Root: "/", Mountpoint: "/b", Source: "/dev/sdb", Fstype: "ext4", Major: 253, Minor: 1},
{Root: "/", Mountpoint: "/c", Source: "/dev/sdc", Fstype: "btrfs", Major: 253, Minor: 2},
{Root: "/", Mountpoint: "/d", Source: "/dev/sdd", Fstype: "xfs", Major: 253, Minor: 3},
{Root: "/", Mountpoint: "/e", Source: "/dev/sde", Fstype: "zfs", Major: 253, Minor: 4},
{Root: "/", Mountpoint: "/f", Source: "overlay", Fstype: "overlay", Major: 253, Minor: 5},
{Root: "/", Mountpoint: "/g", Source: "127.0.0.1:/nfs", Fstype: "nfs4", Major: 253, Minor: 6},
{Root: "/", Mountpoint: "/test1", Source: "tmpfs", Fstype: "tmpfs", Major: 253, Minor: 4},
{Root: "/", Mountpoint: "/test2", Source: "tmpfs", Fstype: "tmpfs", Major: 253, Minor: 4},
{Root: "/", Mountpoint: "/a", Source: "/dev/sda", FSType: "ext3", Major: 253, Minor: 0},
{Root: "/", Mountpoint: "/b", Source: "/dev/sdb", FSType: "ext4", Major: 253, Minor: 1},
{Root: "/", Mountpoint: "/c", Source: "/dev/sdc", FSType: "btrfs", Major: 253, Minor: 2},
{Root: "/", Mountpoint: "/d", Source: "/dev/sdd", FSType: "xfs", Major: 253, Minor: 3},
{Root: "/", Mountpoint: "/e", Source: "/dev/sde", FSType: "zfs", Major: 253, Minor: 4},
{Root: "/", Mountpoint: "/f", Source: "overlay", FSType: "overlay", Major: 253, Minor: 5},
{Root: "/", Mountpoint: "/g", Source: "127.0.0.1:/nfs", FSType: "nfs4", Major: 253, Minor: 6},
{Root: "/", Mountpoint: "/test1", Source: "tmpfs", FSType: "tmpfs", Major: 253, Minor: 4},
{Root: "/", Mountpoint: "/test2", Source: "tmpfs", FSType: "tmpfs", Major: 253, Minor: 4},
},
expected: map[string]partition{
"/dev/sda": {fsType: "ext3", mountpoint: "/a", major: 253, minor: 0},
Expand Down
50 changes: 23 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,47 @@ module github.com/google/cadvisor
go 1.13

require (
cloud.google.com/go v0.54.0
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.15 // indirect
github.com/aws/aws-sdk-go v1.35.24
cloud.google.com/go v0.75.0
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/aws/aws-sdk-go v1.36.31
github.com/blang/semver v3.5.1+incompatible
github.com/containerd/containerd v1.4.3
github.com/containerd/ttrpc v1.0.2 // indirect
github.com/containerd/typeurl v1.0.1
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible // indirect
github.com/docker/docker v17.12.0-ce-rc1.0.20200916142827-bd33bbf0497b+incompatible
github.com/docker/docker v20.10.2+incompatible
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.4.0
github.com/euank/go-kmsg-parser v2.0.0+incompatible
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.2.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/karrick/godirwalk v1.16.1
github.com/kr/pretty v0.2.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
github.com/moby/sys/mountinfo v0.1.3
github.com/moby/sys/mountinfo v0.4.0
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v1.0.0-rc92
github.com/opencontainers/runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6
github.com/opencontainers/runc v1.0.0-rc92.0.20210122051217-c69ae759fbf5
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_golang v1.9.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.10.0
github.com/prometheus/procfs v0.2.0 // indirect
github.com/stretchr/testify v1.6.1
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65
golang.org/x/text v0.3.4 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
google.golang.org/grpc v1.27.1
google.golang.org/protobuf v1.25.0 // indirect
gotest.tools v2.2.0+incompatible // indirect
github.com/prometheus/common v0.15.0
github.com/prometheus/procfs v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
golang.org/x/text v0.3.5 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
google.golang.org/genproto v0.0.0-20210125195502-f46fe6c6624a // indirect
google.golang.org/grpc v1.35.0
gotest.tools/v3 v3.0.3 // indirect
k8s.io/klog/v2 v2.2.0
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
)
Loading

0 comments on commit c0e6c94

Please sign in to comment.