Use constants instead of magic string for runtime names

This commit is contained in:
Pengfei Ni
2017-08-26 22:44:27 +08:00
parent 6368c1fc82
commit 9dd589c035
3 changed files with 5 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ import (
"k8s.io/api/core/v1"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/features"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
utilfile "k8s.io/kubernetes/pkg/util/file"
)
@@ -111,7 +112,7 @@ func validateHost(runtime string) error {
}
// Check runtime support. Currently only Docker is supported.
if runtime != "docker" && runtime != "remote" {
if runtime != kubetypes.DockerContainerRuntime && runtime != kubetypes.RemoteContainerRuntime {
return fmt.Errorf("AppArmor is only enabled for 'docker' and 'remote' runtimes. Found: %q.", runtime)
}