diff --git a/prog/weave-kube/launch.sh b/prog/weave-kube/launch.sh index 1b851d49..35557fb4 100755 --- a/prog/weave-kube/launch.sh +++ b/prog/weave-kube/launch.sh @@ -54,9 +54,6 @@ if [ "${EXPECT_NPC}" = "0" ]; then WEAVE_NPC_OPTS="" fi -export HOST_ROOT=/host -/home/weave/weave --local create-bridge --force $WEAVE_NPC_OPTS - # Kubernetes sets HOSTNAME to the host's hostname # when running a pod in host namespace. NICKNAME_ARG="" @@ -65,16 +62,6 @@ if [ -n "$HOSTNAME" ] ; then fi BRIDGE_OPTIONS="--datapath=datapath" -if [ "$(/home/weave/weave --local bridge-type)" = "bridge" ] ; then - # TODO: Call into weave script to do this - if ! ip link show vethwe-pcap >/dev/null 2>&1 ; then - ip link add name vethwe-bridge type veth peer name vethwe-pcap - ip link set vethwe-bridge up - ip link set vethwe-pcap up - ip link set vethwe-bridge master weave - fi - BRIDGE_OPTIONS="--iface=vethwe-pcap" -fi if [ -z "$KUBE_PEERS" ]; then if ! KUBE_PEERS=$(/home/weave/kube-peers) || [ -z "$KUBE_PEERS" ]; then @@ -109,6 +96,7 @@ post_start_actions() { fi fi mkdir -p $HOST_ROOT/etc/cni/net.d + export HOST_ROOT /home/weave/weave --local setup-cni # Expose the weave network so host processes can communicate with pods @@ -118,9 +106,11 @@ post_start_actions() { post_start_actions & /home/weave/weaver $EXTRA_ARGS --port=6783 $BRIDGE_OPTIONS \ + --host-root=$HOST_ROOT \ --http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \ --ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \ --ipalloc-init $IPALLOC_INIT \ --conn-limit=$CONN_LIMIT \ + $WEAVE_NPC_OPTS \ "$@" \ $KUBE_PEERS diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 3da99359..830cb630 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -170,6 +170,7 @@ func main() { mflag.BoolVar(&resume, []string{"-resume"}, false, "resume connections to previous peers") mflag.StringVar(&bridgeConfig.WeaveBridgeName, []string{"-weave-bridge"}, "weave", "name of weave bridge") mflag.StringVar(&bridgeConfig.DockerBridgeName, []string{"-docker-bridge"}, "", "name of Docker bridge") + mflag.BoolVar(&bridgeConfig.ExpectNPC, []string{"-expect-npc"}, false, "set up iptables rules for npc") mflag.StringVar(&routerName, []string{"#name", "-name"}, "", "name of router (defaults to MAC of interface)") mflag.StringVar(&nickName, []string{"#nickname", "-nickname"}, "", "nickname of peer (defaults to hostname)") mflag.StringVar(&password, []string{"#password", "-password"}, "", "network password")