IP Allocation Management
Using the Ring CRDT and Weave gossip, provides an interface for the weave script to allocate IP addresses in `weave run`, `weave start` and `weave expose`. See docs/ipam.md for implementation details, and site/features.md for user-visible changes.
This commit is contained in:
1 parent
72112d7aef
commit
3cd1a17c23
22 files changed
+2930
-80
No files matched your search
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
UNIVERSE=10.2.1.0/24
|
||||
|
||||
start_suite "Ping over cross-host weave network with IPAM"
|
||||
|
||||
weave_on $HOST1 launch -iprange $UNIVERSE
|
||||
weave_on $HOST2 launch -iprange $UNIVERSE $HOST1
|
||||
|
||||
weave_on $HOST1 run -t --name=c1 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST2 run -t --name=c2 gliderlabs/alpine /bin/sh
|
||||
# Note can't use weave_on here because it echoes the command
|
||||
C2IP=$(DOCKER_HOST=tcp://$HOST2:2375 $WEAVE ps | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2IP"
|
||||
|
||||
end_suite
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#! /bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
R1=10.2.1.0/24
|
||||
C3=10.2.2.34
|
||||
C4=10.2.2.37
|
||||
|
||||
PING="ping -nq -W 1 -c 1"
|
||||
|
||||
weave_on1() {
|
||||
assert_raises "weave_on $HOST1 $@"
|
||||
}
|
||||
|
||||
run_on1() {
|
||||
assert_raises "run_on $HOST1 $@"
|
||||
}
|
||||
|
||||
exec_on1() {
|
||||
assert_raises "exec_on $HOST1 $@"
|
||||
}
|
||||
|
||||
check_container_connectivity() {
|
||||
exec_on1 "c2 $PING $C1"
|
||||
exec_on1 "c3 $PING $C4"
|
||||
# fails due to #620
|
||||
# exec_on1 "c3 ! $PING $C1"
|
||||
}
|
||||
|
||||
start_suite "exposing weave network to host"
|
||||
|
||||
weave_on $HOST1 launch -iprange $R1
|
||||
|
||||
weave_on $HOST1 run -t --name=c1 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run -t --name=c2 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run $C3/24 -t --name=c3 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run $C4/24 -t --name=c4 gliderlabs/alpine /bin/sh
|
||||
|
||||
# Note can't use weave_on here because it echoes the command
|
||||
C1=$(DOCKER_HOST=tcp://$HOST1:2375 $WEAVE ps c1 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
|
||||
# absence of host connectivity by default
|
||||
run_on1 "! $PING $C1"
|
||||
check_container_connectivity
|
||||
|
||||
# host connectivity after 'expose'
|
||||
weave_on1 "expose"
|
||||
run_on1 " $PING $C1"
|
||||
run_on1 "! $PING $C3"
|
||||
check_container_connectivity
|
||||
|
||||
# idempotence of 'expose'
|
||||
weave_on1 "expose"
|
||||
run_on1 " $PING $C1"
|
||||
|
||||
# no host connectivity after 'hide'
|
||||
weave_on1 "hide"
|
||||
run_on1 "! $PING $C1"
|
||||
|
||||
# idempotence of 'hide'
|
||||
weave_on1 "hide"
|
||||
|
||||
end_suite
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#! /bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
UNIVERSE=10.2.3.0/24
|
||||
|
||||
start_suite "Resolve names over cross-host weave network with IPAM"
|
||||
|
||||
weave_on $HOST1 launch -iprange $UNIVERSE
|
||||
weave_on $HOST2 launch -iprange $UNIVERSE $HOST1
|
||||
|
||||
weave_on $HOST1 launch-dns 10.2.254.1/24
|
||||
weave_on $HOST2 launch-dns 10.2.254.2/24
|
||||
|
||||
weave_on $HOST2 run -t --name=c2 -h seetwo.weave.local gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run --with-dns --name=c1 -t aanand/docker-dnsutils /bin/sh
|
||||
|
||||
# Note can't use weave_on here because it echoes the command
|
||||
C2IP=$(DOCKER_HOST=tcp://$HOST2:2375 $WEAVE ps c2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec -i c1 dig +short seetwo.weave.local)
|
||||
assert "echo $ok" "$C2IP"
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec -i c1 dig +short -x $C2IP)
|
||||
assert "echo $ok" "seetwo.weave.local."
|
||||
|
||||
end_suite
|
||||
Reference in new issue
Block a user