Add HairpinMode to our CNI configs

This may resolve some issues with routing traffic between
containers using the host's IP.

Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
Matthew Heon 2020-05-11 13:57:19 -04:00
parent 7837bf3c07
commit 50487832c6
2 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@
"bridge": "cni-podman0", "bridge": "cni-podman0",
"isGateway": true, "isGateway": true,
"ipMasq": true, "ipMasq": true,
"hairpinMode": true,
"ipam": { "ipam": {
"type": "host-local", "type": "host-local",
"routes": [{ "dst": "0.0.0.0/0" }], "routes": [{ "dst": "0.0.0.0/0" }],

View File

@ -21,10 +21,11 @@ func NewNcList(name, version string) NcList {
// NewHostLocalBridge creates a new LocalBridge for host-local // NewHostLocalBridge creates a new LocalBridge for host-local
func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, ipamConf IPAMHostLocalConf) *HostLocalBridge { func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, ipamConf IPAMHostLocalConf) *HostLocalBridge {
hostLocalBridge := HostLocalBridge{ hostLocalBridge := HostLocalBridge{
PluginType: "bridge", PluginType: "bridge",
BrName: name, BrName: name,
IPMasq: ipMasq, IPMasq: ipMasq,
IPAM: ipamConf, HairpinMode: true,
IPAM: ipamConf,
} }
if isGateWay { if isGateWay {
hostLocalBridge.IsGW = true hostLocalBridge.IsGW = true