allow for cadvisor to detect split filesystem and add some e2e tests

This commit is contained in:
Kevin Hannon 2023-11-04 11:52:05 -04:00
parent 3df07e446b
commit d58ff6c056
2 changed files with 2 additions and 7 deletions

View File

@ -68,7 +68,7 @@ func TestContainerFsInfoLabel(t *testing.T) {
}{{ }{{
description: "LabelCrioWriteableImages should be returned", description: "LabelCrioWriteableImages should be returned",
runtimeEndpoint: crio.CrioSocket, runtimeEndpoint: crio.CrioSocket,
expectedLabel: LabelCrioContainers, expectedLabel: cadvisorfs.LabelCrioContainers,
expectedError: nil, expectedError: nil,
}, { }, {
description: "Cannot find valid imagefs label", description: "Cannot find valid imagefs label",

View File

@ -26,11 +26,6 @@ import (
cadvisorfs "github.com/google/cadvisor/fs" cadvisorfs "github.com/google/cadvisor/fs"
) )
// LabelCrioContainers is a label to allow for cadvisor to track writeable layers
// separately from read-only layers.
// Once CAdvisor upstream changes are merged, we should remove this constant
const LabelCrioContainers string = "crio-containers"
// imageFsInfoProvider knows how to translate the configured runtime // imageFsInfoProvider knows how to translate the configured runtime
// to its file system label for images. // to its file system label for images.
type imageFsInfoProvider struct { type imageFsInfoProvider struct {
@ -50,7 +45,7 @@ func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
// For remote runtimes, it handles addition runtimes natively understood by cAdvisor. // For remote runtimes, it handles addition runtimes natively understood by cAdvisor.
func (i *imageFsInfoProvider) ContainerFsInfoLabel() (string, error) { func (i *imageFsInfoProvider) ContainerFsInfoLabel() (string, error) {
if detectCrioWorkaround(i) { if detectCrioWorkaround(i) {
return LabelCrioContainers, nil return cadvisorfs.LabelCrioContainers, nil
} }
return "", fmt.Errorf("no containerfs label for configured runtime") return "", fmt.Errorf("no containerfs label for configured runtime")
} }