Check manually-assigned addresses with IPAM to see if they clash
This commit is contained in:
1 parent
26dc83dbc2
commit
647b755b64
5 files changed
+35
-19
No files matched your search
@@ -812,10 +812,10 @@ delete_dns_fqdn() {
|
||||
|
||||
# Claim addresses for a container in IPAM. Expects to be called from
|
||||
# with_container_addresses.
|
||||
ipam_claim() {
|
||||
ipam_reclaim() {
|
||||
for CIDR in $3 ; do
|
||||
# NB: CONTAINER_IP is the IP of the weave container; it is set by wait_for_status.
|
||||
http_call_ip $CONTAINER_IP $HTTP_PORT PUT /ip/$1/${CIDR%/*}
|
||||
http_call_ip $CONTAINER_IP $HTTP_PORT PUT /ip/$1/${CIDR%/*}?reclaim=true
|
||||
done
|
||||
}
|
||||
|
||||
@@ -862,6 +862,9 @@ ipam_cidrs() {
|
||||
else
|
||||
# This is a plain IP address; warn if it clashes but carry on
|
||||
command_exists netcheck && netcheck --ignore-iface=$BRIDGE $1 || true
|
||||
if container_ip $CONTAINER_NAME 2>/dev/null ; then
|
||||
http_call_ip $CONTAINER_IP $HTTP_PORT PUT /ip/$CONTAINER_ID/${1%/*} >&2
|
||||
fi
|
||||
ALL_CIDRS="$ALL_CIDRS $1"
|
||||
fi
|
||||
shift 1
|
||||
@@ -1091,7 +1094,7 @@ launch_router() {
|
||||
wait_for_status $CONTAINER_NAME $HTTP_PORT
|
||||
if [ -n "$IPRANGE" ] ; then
|
||||
# Tell the newly-started weave IP allocator about existing weave IPs
|
||||
with_container_addresses ipam_claim weave:expose $(docker ps -q --no-trunc)
|
||||
with_container_addresses ipam_reclaim weave:expose $(docker ps -q --no-trunc)
|
||||
fi
|
||||
if [ -n "$DNS_PORT_MAPPING" ] ; then
|
||||
# Tell the newly-started weaveDNS about existing weave IPs
|
||||
|
||||
Reference in new issue
Block a user