From fca23f805a4d3db980487e9d28393a2277b168a2 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Thu, 27 Feb 2020 12:43:58 +0530 Subject: [PATCH 1/3] modify launch.sh to launch weaver with --no-masq-local by default --- prog/weave-kube/launch.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prog/weave-kube/launch.sh b/prog/weave-kube/launch.sh index d6e68a1e..01ea699b 100755 --- a/prog/weave-kube/launch.sh +++ b/prog/weave-kube/launch.sh @@ -67,6 +67,7 @@ DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net} # Default for network policy EXPECT_NPC=${EXPECT_NPC:-1} +NO_MASQ_LOCAL=${NO_MASQ_LOCAL:-1} # Ensure we have the required modules for NPC if [ "${EXPECT_NPC}" != "0" ]; then @@ -96,9 +97,9 @@ if [ "${EXPECT_NPC}" = "0" ]; then WEAVE_NPC_OPTS="" fi -NO_MASQ_LOCAL_OPT="" -if [ -n "${NO_MASQ_LOCAL}" ]; then - NO_MASQ_LOCAL_OPT="--no-masq-local" +NO_MASQ_LOCAL_OPT="--no-masq-local" +if [ "${NO_MASQ_LOCAL}" = "0" ]; then + NO_MASQ_LOCAL_OPT="" fi # Kubernetes sets HOSTNAME to the host's hostname From 4d7e9931f96b28bcebb4d1dd0d9cc144a48185ae Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 4 Aug 2020 16:15:45 +0000 Subject: [PATCH 2/3] Remove NO_MASQ_LOCAL setting from test 840 now it's the default --- test/840_weave_kube_3_test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/840_weave_kube_3_test.sh b/test/840_weave_kube_3_test.sh index c490fdcf..c2f9af37 100755 --- a/test/840_weave_kube_3_test.sh +++ b/test/840_weave_kube_3_test.sh @@ -366,7 +366,6 @@ assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http CLIENT_IP_MASQ="$($SSH $HOST1 curl -sS http://$HOST2:31138/client_ip)" -WEAVE_ENV_VARS="${WEAVE_ENV_VARS}\\n - name: NO_MASQ_LOCAL\\n value: \"1\"" $SSH $HOST1 "$KUBECTL delete ds weave-net -n=kube-system" sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \ -e "s%env:%$WEAVE_ENV_VARS%" \ From 0ab2d08f0c889e626220cfc471f16b4c55a9d204 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 4 Aug 2020 16:16:05 +0000 Subject: [PATCH 3/3] Update docs now NO_MASQ_LOCAL is the default --- site/kubernetes/kube-addon.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/kubernetes/kube-addon.md b/site/kubernetes/kube-addon.md index 9efc3054..40ea4c2f 100644 --- a/site/kubernetes/kube-addon.md +++ b/site/kubernetes/kube-addon.md @@ -421,9 +421,9 @@ The list of variables you can set is: a larger size for better performance if your network supports jumbo frames - see [here](/site/tasks/manage/fastdp.md#mtu) for more details. -* `NO_MASQ_LOCAL` - set to 1 to preserve the client source IP address when +* `NO_MASQ_LOCAL` - set to 0 to disable preserving the client source IP address when accessing Service annotated with `service.spec.externalTrafficPolicy=Local`. - The feature works only with Weave IPAM (default). + This feature works only with Weave IPAM (default). * `IPTABLES_BACKEND` - set to `nft` to use `nftables` backend for `iptables` (default is `iptables`) Example: