From 91eaa01652167234f07337ca1f510b8d5c18668c Mon Sep 17 00:00:00 2001 From: Chris Wedgwood Date: Mon, 7 May 2018 17:06:35 +0000 Subject: [PATCH] gate: avoid accumulation of exited 'ipcalc' containers use ephemeral containers when calling ipcalc Change-Id: Ie7d5930f1b34063d2694d448cf79a3da78d4108a --- tools/deployment/multinode/kube-node-subnet.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/deployment/multinode/kube-node-subnet.sh b/tools/deployment/multinode/kube-node-subnet.sh index 09288f7e27..2ce60994fb 100755 --- a/tools/deployment/multinode/kube-node-subnet.sh +++ b/tools/deployment/multinode/kube-node-subnet.sh @@ -18,8 +18,8 @@ set -e UTILS_IMAGE=docker.io/openstackhelm/gate-utils:v0.1.0 NODE_IPS=$(mktemp --suffix=.txt) kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP").address' | sort -V > $NODE_IPS -FIRST_IP_SUBNET=$(sudo docker run ${UTILS_IMAGE} ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }') -LAST_IP_SUBNET=$(sudo docker run ${UTILS_IMAGE} ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }') +FIRST_IP_SUBNET=$(sudo docker run --rm ${UTILS_IMAGE} ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }') +LAST_IP_SUBNET=$(sudo docker run --rm ${UTILS_IMAGE} ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }') rm -f $NODE_IPS function ip_diff { echo $(($(echo $LAST_IP_SUBNET | awk -F '.' "{ print \$$1}") - $(echo $FIRST_IP_SUBNET | awk -F '.' "{ print \$$1}")))