Use the CNI bridge plugin to set hairpin mode
Pass the flag down in kubenet, and disable it in DockerManager
This commit is contained in:
parent
6558b30f11
commit
26a53fcd47
@ -428,7 +428,7 @@ func NewMainKubelet(
|
||||
imageBackOff,
|
||||
serializeImagePulls,
|
||||
enableCustomMetrics,
|
||||
klet.hairpinMode == componentconfig.HairpinVeth,
|
||||
klet.hairpinMode == componentconfig.HairpinVeth && networkPluginName != "kubenet",
|
||||
seccompProfileRoot,
|
||||
containerRuntimeOptions...,
|
||||
)
|
||||
|
@ -186,6 +186,7 @@ const NET_CONFIG_TEMPLATE = `{
|
||||
"addIf": "%s",
|
||||
"isGateway": true,
|
||||
"ipMasq": false,
|
||||
"hairpin": "%t",
|
||||
"ipam": {
|
||||
"type": "host-local",
|
||||
"subnet": "%s",
|
||||
@ -218,10 +219,11 @@ func (plugin *kubenetNetworkPlugin) Event(name string, details map[string]interf
|
||||
glog.V(5).Infof("PodCIDR is set to %q", podCIDR)
|
||||
_, cidr, err := net.ParseCIDR(podCIDR)
|
||||
if err == nil {
|
||||
setHairpin := plugin.hairpinMode == componentconfig.HairpinVeth
|
||||
// Set bridge address to first address in IPNet
|
||||
cidr.IP.To4()[3] += 1
|
||||
|
||||
json := fmt.Sprintf(NET_CONFIG_TEMPLATE, BridgeName, plugin.MTU, network.DefaultInterfaceName, podCIDR, cidr.IP.String())
|
||||
json := fmt.Sprintf(NET_CONFIG_TEMPLATE, BridgeName, plugin.MTU, network.DefaultInterfaceName, setHairpin, podCIDR, cidr.IP.String())
|
||||
glog.V(2).Infof("CNI network config set to %v", json)
|
||||
plugin.netConfig, err = libcni.ConfFromBytes([]byte(json))
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user