From cf315fb6baea2aa3cbc26e0254574da02ec90af8 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 9 Dec 2016 13:13:45 +0000 Subject: [PATCH 1/2] Take peerName from weave bridge if not specified --- prog/weaver/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 2050f49e..2d47a8fb 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -232,7 +232,7 @@ func main() { } } - name := peerName(routerName, bridge.Interface()) + name := peerName(routerName) if nickName == "" { var err error @@ -528,10 +528,11 @@ func determinePassword(password string) []byte { return []byte(password) } -func peerName(routerName string, iface *net.Interface) mesh.PeerName { +func peerName(routerName string) mesh.PeerName { if routerName == "" { - if iface == nil { - Log.Fatal("Either an interface must be specified with --datapath or --iface, or a name with --name") + iface, err := net.InterfaceByName(weavenet.WeaveBridgeName) + if err != nil { + Log.Fatalf("Unable to find bridge %q", weavenet.WeaveBridgeName) } routerName = iface.HardwareAddr.String() } From bbd631f08f7e3fe32132e3d1ab6c06304b3ceead Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 9 Dec 2016 13:22:16 +0000 Subject: [PATCH 2/2] weave-kube no longer needs to supply the peer address --- prog/weave-kube/launch.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/prog/weave-kube/launch.sh b/prog/weave-kube/launch.sh index 8ad397c4..458386f4 100755 --- a/prog/weave-kube/launch.sh +++ b/prog/weave-kube/launch.sh @@ -22,8 +22,7 @@ else fi fi -# Need to create bridge before running weaver so we can use the peer address -# (because of https://github.com/weaveworks/weave/issues/2480) +# Explicitly create the bridge so we can pass --expect-npc WEAVE_NPC_OPTS="--expect-npc" if [ "${EXPECT_NPC}" = "0" ]; then WEAVE_NPC_OPTS="" @@ -69,7 +68,7 @@ fi --http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \ --ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \ --ipalloc-init $IPALLOC_INIT \ - --name=$(cat /sys/class/net/weave/address) "$@" \ + "$@" \ $KUBE_PEERS & WEAVE_PID=$!