Use ContainerID when restarting a container
Otherwise, we are risking to leak DNS entries which happens when ContainerName is passed to `weave reset` and subsequent internal call to nameserver creates a new entry instead of replacing the old one. The ContainerID of the new entry is set to ContainerName and in such case stopping the container will not remove the new entry.
This commit is contained in:
1 parent
c984ec1e86
commit
427b6d2902
2 files changed
+4
-2
No files matched your search
@@ -30,6 +30,8 @@ assert_raises "exec_on $HOST1 c5 $PING $C6"
|
|||||||
# check that restart retains the same IP, and reclaims it in IPAM
|
# check that restart retains the same IP, and reclaims it in IPAM
|
||||||
weave_on $HOST2 restart c6
|
weave_on $HOST2 restart c6
|
||||||
assert_raises "exec_on $HOST1 c5 $PING $C6"
|
assert_raises "exec_on $HOST1 c5 $PING $C6"
|
||||||
|
# check that restart does not create any additional DNS entry
|
||||||
|
assert "weave_on $HOST2 report -f \"{{len .DNS.Entries}}\"" "6"
|
||||||
sleep 31 # past the IPAM timeout
|
sleep 31 # past the IPAM timeout
|
||||||
start_container $HOST2 net:$SUBNET_2 --name=c7
|
start_container $HOST2 net:$SUBNET_2 --name=c7
|
||||||
C7=$(container_ip $HOST2 c7)
|
C7=$(container_ip $HOST2 c7)
|
||||||
|
|||||||
@@ -2179,8 +2179,8 @@ EOF
|
|||||||
for CIDR in $ALL_CIDRS ; do
|
for CIDR in $ALL_CIDRS ; do
|
||||||
call_weave PUT /ip/$CONTAINER/$CIDR?check-alive=true
|
call_weave PUT /ip/$CONTAINER/$CIDR?check-alive=true
|
||||||
done
|
done
|
||||||
with_container_netns_or_die $1 attach $ALL_CIDRS
|
with_container_netns_or_die $CONTAINER attach $ALL_CIDRS
|
||||||
when_weave_running with_container_fqdn $1 put_dns_fqdn $ALL_CIDRS
|
when_weave_running with_container_fqdn $CONTAINER put_dns_fqdn $ALL_CIDRS
|
||||||
echo $RES
|
echo $RES
|
||||||
;;
|
;;
|
||||||
dns-add)
|
dns-add)
|
||||||
|
|||||||
Reference in new issue
Block a user