Skip to content

Commit

Permalink
Change the order of awsvpc initialization
Browse files Browse the repository at this point in the history
We want to setup the necessary arp settings as soon as possible
and before we re-insert DNS entries. Otherwise, the announced
containers might not be reachable.

Also, do not try to reclaim for weave:expose inside populate_router,
because we do expose before calling it.
  • Loading branch information
brb committed Jun 29, 2016
1 parent 4026792 commit 0efb731
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions weave
Expand Up @@ -1645,13 +1645,12 @@ launch_router() {
"$@")
setup_router_iface_$BRIDGE_TYPE
wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR
populate_router
setup_awsvpc
populate_router
}

setup_awsvpc() {
if [ -n "$AWSVPC" ]; then
expose_ip
# Set proxy_arp on the bridge, so that it could accept packets destined
# to containers within the same subnet but running on remote hosts.
# Without it, exact routes on each container are required.
Expand All @@ -1660,6 +1659,7 @@ setup_awsvpc() {
# placing the request into a bounded queue as it can be seen:
# https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/ipv4/arp.c?id=refs/tags/v4.6.1#n819
echo 0 >/proc/sys/net/ipv4/neigh/$BRIDGE/proxy_delay
expose_ip
fi
}

Expand All @@ -1673,7 +1673,8 @@ fetch_router_args() {
populate_router() {
if [ -n "$IPRANGE" ] ; then
# Tell the newly-started weave IP allocator about existing weave IPs
with_container_addresses ipam_reclaim_no_check_alive weave:expose
# In the case of AWSVPC, we do expose before calling populate_router
[ -n "$AWSVPC" ] || with_container_addresses ipam_reclaim_no_check_alive weave:expose
with_container_addresses ipam_reclaim $(docker ps -q --no-trunc)
fi
if [ -z "$NO_DNS_OPT" ] ; then
Expand Down Expand Up @@ -1955,8 +1956,8 @@ EOF
fetch_router_args
setup_router_iface_$BRIDGE_TYPE
wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR
populate_router
setup_awsvpc
populate_router
;;
launch-proxy)
deprecation_warnings "$@"
Expand Down

0 comments on commit 0efb731

Please sign in to comment.