fix magic string for runtime type

This commit is contained in:
Andy Xie 2017-12-16 19:19:49 +08:00
parent 2712540196
commit 81897022db

View File

@ -22,6 +22,7 @@ import (
"fmt"
cadvisorfs "github.com/google/cadvisor/fs"
"k8s.io/kubernetes/pkg/kubelet/types"
)
// imageFsInfoProvider knows how to translate the configured runtime
@ -35,11 +36,11 @@ type imageFsInfoProvider struct {
// For remote runtimes, it handles additional runtimes natively understood by cAdvisor.
func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
switch i.runtime {
case "docker":
case types.DockerContainerRuntime:
return cadvisorfs.LabelDockerImages, nil
case "rkt":
case types.RktContainerRuntime:
return cadvisorfs.LabelRktImages, nil
case "remote":
case types.RemoteContainerRuntime:
// This is a temporary workaround to get stats for cri-o from cadvisor
// and should be removed.
// Related to https://github.com/kubernetes/kubernetes/issues/51798