Bump cAdvisor to v0.43.0

Bumping cAdvisor from v0.39.2 -> v0.43.0

* Also pin transitive dependencies
  * containerd v1.4.9 -> v1.4.11
  * docker v20.10.2+incompatible> v20.10.7+incompatible

Signed-off-by: David Porter <david@porter.me>
This commit is contained in:
David Porter
2021-11-09 14:23:06 -08:00
parent e4adf7f31c
commit c6452be958
80 changed files with 1637 additions and 465 deletions

View File

@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// +build linux
// Provides Filesystem Stats
@@ -19,6 +20,7 @@ package fs
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
@@ -30,11 +32,12 @@ import (
"strings"
"syscall"
"github.com/google/cadvisor/devicemapper"
"github.com/google/cadvisor/utils"
zfs "github.com/mistifyio/go-zfs"
mount "github.com/moby/sys/mountinfo"
"github.com/google/cadvisor/devicemapper"
"github.com/google/cadvisor/utils"
"k8s.io/klog/v2"
)
@@ -56,6 +59,9 @@ const (
// A pool for restricting the number of consecutive `du` and `find` tasks running.
var pool = make(chan struct{}, maxConcurrentOps)
// ErrDeviceNotInPartitionsMap is the error resulting if a device could not be found in the partitions map.
var ErrDeviceNotInPartitionsMap = errors.New("could not find device in cached partitions map")
func init() {
for i := 0; i < maxConcurrentOps; i++ {
releaseToken()
@@ -279,15 +285,17 @@ func (i *RealFsInfo) addSystemRootLabel(mounts []*mount.Info) {
// addDockerImagesLabel attempts to determine which device contains the mount for docker images.
func (i *RealFsInfo) addDockerImagesLabel(context Context, mounts []*mount.Info) {
dockerDev, dockerPartition, err := i.getDockerDeviceMapperInfo(context.Docker)
if err != nil {
klog.Warningf("Could not get Docker devicemapper device: %v", err)
}
if len(dockerDev) > 0 && dockerPartition != nil {
i.partitions[dockerDev] = *dockerPartition
i.labels[LabelDockerImages] = dockerDev
} else {
i.updateContainerImagesPath(LabelDockerImages, mounts, getDockerImagePaths(context))
if context.Docker.Driver != "" {
dockerDev, dockerPartition, err := i.getDockerDeviceMapperInfo(context.Docker)
if err != nil {
klog.Warningf("Could not get Docker devicemapper device: %v", err)
}
if len(dockerDev) > 0 && dockerPartition != nil {
i.partitions[dockerDev] = *dockerPartition
i.labels[LabelDockerImages] = dockerDev
} else {
i.updateContainerImagesPath(LabelDockerImages, mounts, getDockerImagePaths(context))
}
}
}
@@ -582,15 +590,20 @@ 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/") {
major, minor, err := getBtrfsMajorMinorIds(mnt)
if err != nil {
klog.Warningf("%s", err)
} else {
return &DeviceInfo{mnt.Source, uint(major), uint(minor)}, nil
if found && strings.HasPrefix(mnt.Source, "/dev/") {
major, minor := mnt.Major, mnt.Minor
if mnt.FSType == "btrfs" && major == 0 {
major, minor, err = getBtrfsMajorMinorIds(mnt)
if err != nil {
klog.Warningf("Unable to get btrfs mountpoint IDs: %v", err)
}
}
return &DeviceInfo{mnt.Source, uint(major), uint(minor)}, nil
}
return nil, fmt.Errorf("could not find device with major: %d, minor: %d in cached partitions map", major, minor)
return nil, fmt.Errorf("with major: %d, minor: %d: %w", major, minor, ErrDeviceNotInPartitionsMap)
}
func GetDirUsage(dir string) (UsageInfo, error) {