Add idempotency to setup-gateway.sh
Now docker container will not be run if it already exists. Change-Id: Ife797c0326d36e4c20a89014621b3a1f111ec51d
This commit is contained in:
parent
431611d45e
commit
5b6192746a
@ -32,7 +32,10 @@ sudo iptables -P FORWARD ACCEPT
|
|||||||
DEFAULT_ROUTE_DEV=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }')
|
DEFAULT_ROUTE_DEV=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }')
|
||||||
sudo iptables -t nat -A POSTROUTING -o ${DEFAULT_ROUTE_DEV} -s ${OSH_EXT_SUBNET} -j MASQUERADE
|
sudo iptables -t nat -A POSTROUTING -o ${DEFAULT_ROUTE_DEV} -s ${OSH_EXT_SUBNET} -j MASQUERADE
|
||||||
|
|
||||||
|
|
||||||
|
container_id="$(sudo docker ps -f name=br-ex-dns-server -q -a)"
|
||||||
# NOTE(portdirect): Setup DNS for public endpoints
|
# NOTE(portdirect): Setup DNS for public endpoints
|
||||||
|
if [ -z $container_id ]; then
|
||||||
sudo docker run -d \
|
sudo docker run -d \
|
||||||
--name br-ex-dns-server \
|
--name br-ex-dns-server \
|
||||||
--net host \
|
--net host \
|
||||||
@ -46,5 +49,8 @@ sudo docker run -d \
|
|||||||
--resolv-file=/etc/kubernetes/kubelet-resolv.conf \
|
--resolv-file=/etc/kubernetes/kubelet-resolv.conf \
|
||||||
--address="/svc.cluster.local/${OSH_BR_EX_ADDR%/*}" \
|
--address="/svc.cluster.local/${OSH_BR_EX_ADDR%/*}" \
|
||||||
--listen-address="${OSH_BR_EX_ADDR%/*}"
|
--listen-address="${OSH_BR_EX_ADDR%/*}"
|
||||||
|
else
|
||||||
|
echo "external bridge for dns already exists"
|
||||||
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
sudo docker top br-ex-dns-server
|
sudo docker top br-ex-dns-server
|
||||||
|
Loading…
Reference in New Issue
Block a user