mirror of https://github.com/k3s-io/k3s
Merge pull request #51408 from feiskyer/magic
Automatic merge from submit-queue (batch tested with PRs 50719, 51216, 50212, 51408, 51381) Use constants instead of magic string for runtime names **What this PR does / why we need it**: Use constants instead of magic string for runtime names. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #51678 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/6/head
commit
d56b676100
|
@ -86,7 +86,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
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ go_library(
|
|||
],
|
||||
deps = [
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/kubelet/types:go_default_library",
|
||||
"//pkg/util/file:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
|
|
|
@ -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