mirror of https://github.com/k3s-io/k3s
Use constants instead of magic string for runtime names
parent
6368c1fc82
commit
9dd589c035
|
@ -82,7 +82,7 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
|||
obj.VolumeStatsAggPeriod = metav1.Duration{Duration: time.Minute}
|
||||
}
|
||||
if obj.ContainerRuntime == "" {
|
||||
obj.ContainerRuntime = "docker"
|
||||
obj.ContainerRuntime = kubetypes.DockerContainerRuntime
|
||||
}
|
||||
if obj.RuntimeRequestTimeout == zeroDuration {
|
||||
obj.RuntimeRequestTimeout = metav1.Duration{Duration: 2 * time.Minute}
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
|
||||
)
|
||||
|
||||
|
@ -57,7 +58,7 @@ func effectiveHairpinMode(hairpinMode kubeletconfig.HairpinMode, containerRuntim
|
|||
// - It's set to "none".
|
||||
if hairpinMode == kubeletconfig.PromiscuousBridge || hairpinMode == kubeletconfig.HairpinVeth {
|
||||
// Only on docker.
|
||||
if containerRuntime != "docker" {
|
||||
if containerRuntime != kubetypes.DockerContainerRuntime {
|
||||
glog.Warningf("Hairpin mode set to %q but container runtime is %q, ignoring", hairpinMode, containerRuntime)
|
||||
return kubeletconfig.HairpinNone, nil
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue