Merge pull request #57141 from andyxning/fix_magic_string_for_runtime_type

Automatic merge from submit-queue (batch tested with PRs 57148, 57123, 57091, 57141, 57131). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix magic string for runtime type

**What this PR does / why we need it**:
This PR correct the magic string about container runtime to the constants.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
This PR correct the magic string about container runtime to the constants.
**Release note**:

```release-note
None
```
This commit is contained in:
Kubernetes Submit Queue
2017-12-16 21:00:48 -08:00
committed by GitHub

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