mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
move KubeletConfiguration out of componentconfig API group
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network"
|
||||
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
|
||||
)
|
||||
@@ -47,7 +47,7 @@ const (
|
||||
|
||||
// effectiveHairpinMode determines the effective hairpin mode given the
|
||||
// configured mode, container runtime, and whether cbr0 should be configured.
|
||||
func effectiveHairpinMode(hairpinMode componentconfig.HairpinMode, containerRuntime string, networkPlugin string) (componentconfig.HairpinMode, error) {
|
||||
func effectiveHairpinMode(hairpinMode kubeletconfig.HairpinMode, containerRuntime string, networkPlugin string) (kubeletconfig.HairpinMode, error) {
|
||||
// The hairpin mode setting doesn't matter if:
|
||||
// - We're not using a bridge network. This is hard to check because we might
|
||||
// be using a plugin.
|
||||
@@ -55,20 +55,20 @@ func effectiveHairpinMode(hairpinMode componentconfig.HairpinMode, containerRunt
|
||||
// to set the hairpin flag on the veth's of containers. Currently the
|
||||
// docker runtime is the only one that understands this.
|
||||
// - It's set to "none".
|
||||
if hairpinMode == componentconfig.PromiscuousBridge || hairpinMode == componentconfig.HairpinVeth {
|
||||
if hairpinMode == kubeletconfig.PromiscuousBridge || hairpinMode == kubeletconfig.HairpinVeth {
|
||||
// Only on docker.
|
||||
if containerRuntime != "docker" {
|
||||
glog.Warningf("Hairpin mode set to %q but container runtime is %q, ignoring", hairpinMode, containerRuntime)
|
||||
return componentconfig.HairpinNone, nil
|
||||
return kubeletconfig.HairpinNone, nil
|
||||
}
|
||||
if hairpinMode == componentconfig.PromiscuousBridge && networkPlugin != "kubenet" {
|
||||
if hairpinMode == kubeletconfig.PromiscuousBridge && networkPlugin != "kubenet" {
|
||||
// This is not a valid combination, since promiscuous-bridge only works on kubenet. Users might be using the
|
||||
// default values (from before the hairpin-mode flag existed) and we
|
||||
// should keep the old behavior.
|
||||
glog.Warningf("Hairpin mode set to %q but kubenet is not enabled, falling back to %q", hairpinMode, componentconfig.HairpinVeth)
|
||||
return componentconfig.HairpinVeth, nil
|
||||
glog.Warningf("Hairpin mode set to %q but kubenet is not enabled, falling back to %q", hairpinMode, kubeletconfig.HairpinVeth)
|
||||
return kubeletconfig.HairpinVeth, nil
|
||||
}
|
||||
} else if hairpinMode != componentconfig.HairpinNone {
|
||||
} else if hairpinMode != kubeletconfig.HairpinNone {
|
||||
return "", fmt.Errorf("unknown value: %q", hairpinMode)
|
||||
}
|
||||
return hairpinMode, nil
|
||||
|
||||
Reference in New Issue
Block a user