From 28bf4e6e95a19a2afdf52113a8168294aebec058 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 22 Nov 2016 18:02:55 +0000 Subject: [PATCH] Optional bridge-nf detection --- prog/weave-kube/launch.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prog/weave-kube/launch.sh b/prog/weave-kube/launch.sh index 2438c3d5..40b65e20 100755 --- a/prog/weave-kube/launch.sh +++ b/prog/weave-kube/launch.sh @@ -11,13 +11,14 @@ STATUS_ADDR=${WEAVE_STATUS_ADDR:-0.0.0.0:6782} EXPECT_NPC=${EXPECT_NPC:-1} # kube-proxy requires that bridged traffic passes through netfilter -if [ ! -f /proc/sys/net/bridge/bridge-nf-call-iptables ] ; then - echo /proc/sys/net/bridge/bridge-nf-call-iptables not found >&2 - exit 1 +if ! BRIDGE_NF_ENABLED=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables); then + echo "Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2 +else + if [ "$BRIDGE_NF_ENABLED" != "1" ]; then + echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables + fi fi -echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables - SOURCE_BINARY=/usr/bin/weaveutil VERSION=$(/home/weave/weaver $EXTRA_ARGS --version | sed -e 's/weave router //') PLUGIN="weave-plugin-$VERSION"