From 2654f820a46a610ab8a51f6b1cd187e337f71414 Mon Sep 17 00:00:00 2001 From: Madhan Raj Mookkandy Date: Tue, 6 Mar 2018 21:57:09 -0800 Subject: [PATCH] Update the delegate type --- plugins/main/windows/l2bridge/l2bridge_windows.go | 9 +++++---- plugins/meta/flannel/Makefile | 7 +++++++ plugins/meta/flannel/flannel.go | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 plugins/meta/flannel/Makefile diff --git a/plugins/main/windows/l2bridge/l2bridge_windows.go b/plugins/main/windows/l2bridge/l2bridge_windows.go index 05c453a94..ae9f6942e 100644 --- a/plugins/main/windows/l2bridge/l2bridge_windows.go +++ b/plugins/main/windows/l2bridge/l2bridge_windows.go @@ -37,7 +37,7 @@ import ( type NetConf struct { hns.NetConf - IPMasq bool `json:"ipmasq,omitempty"` + ipmasq bool `json:"ipmasq,omitempty"` clusterNetworkPrefix net.IPNet `json:"clusterprefix,omitempty"` } type K8sCniEnvArgs struct { @@ -122,9 +122,10 @@ func cmdAdd(args *skel.CmdArgs) error { gw[len(gw)-1] += 2 // NAT based on the the configured cluster network - // if n.IPMasq { - // n.ApplyOutboundNatPolicy(n.clusterNetworkPrefix.String()) - // } + if n.ipmasq { + n.ApplyOutboundNatPolicy(n.clusterNetworkPrefix.String()) + } + nameservers := strings.Join(n.DNS.Nameservers, ",") if result.DNS.Nameservers != nil { nameservers = strings.Join(result.DNS.Nameservers, ",") diff --git a/plugins/meta/flannel/Makefile b/plugins/meta/flannel/Makefile new file mode 100644 index 000000000..397e1db42 --- /dev/null +++ b/plugins/meta/flannel/Makefile @@ -0,0 +1,7 @@ + + +windows: $(shell find . -type f -name '*.go') + GOOS=windows go build -o flannel.exe +clean: + rm -rf flannel.exe + diff --git a/plugins/meta/flannel/flannel.go b/plugins/meta/flannel/flannel.go index 5eac1c8c0..7d7b3a408 100644 --- a/plugins/meta/flannel/flannel.go +++ b/plugins/meta/flannel/flannel.go @@ -251,12 +251,12 @@ func cmdAddWindows(containerID string, n *NetConf, fenv *subnetEnv) error { n.Delegate["name"] = n.Name if !hasKey(n.Delegate, "type") { - n.Delegate["type"] = "win-l2bridge" + n.Delegate["type"] = "l2bridge" } // if flannel needs ipmasq - get the plugin to configure it // (this is the opposite of how linux works - on linux the flannel daemon configure ipmasq) - n.Delegate["IPMasq"] = *fenv.ipmasq + n.Delegate["ipmasq"] = *fenv.ipmasq n.Delegate["clusterNetworkPrefix"] = fenv.nw.String() n.Delegate["cniVersion"] = "0.2.0"