Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Add deps and fix empty net bug
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Telfer <[email protected]>
  • Loading branch information
ctelfer committed Oct 5, 2018
1 parent 937f32e commit 48fdeb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest
RUN apk add --update bash
RUN apk add --update bash docker jq
COPY ip-util-check /usr/bin
CMD [ "/usr/bin/ip-util-check" ]
4 changes: 2 additions & 2 deletions ip-util-check
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ done
echo "Counting container IP allocations per network"
for node in $NODEIDS ; do
for task in $(docker node ps -q $node) ; do
nets=$(docker inspect $task | jq -r '.[].Spec.Networks[].Target' | cut -c 1-12)
nets=$(docker inspect $task | jq -r '.[].Spec.Networks[].Target' 2>/dev/null | cut -c 1-12)
for net in $nets; do
NET2NCIP[$net]=$((${NET2NCIP[$net]} + 1))
done
Expand All @@ -82,7 +82,7 @@ done

echo "Counting service VIP allocations per network"
for svc in $SVCIDS ; do
for viprec in $(docker service inspect $svc | jq -rc '.[].Endpoint.VirtualIPs[]'); do
for viprec in $(docker service inspect $svc | jq -rc '.[].Endpoint.VirtualIPs[]' 2>/dev/null); do
net=$(echo "$viprec" | jq -r '.NetworkID' | cut -c 1-12)
addr=$(echo "$viprec" | jq -r '.Addr')
NET2NVIP[$net]=$((${NET2NVIP[$net]} + 1))
Expand Down

0 comments on commit 48fdeb7

Please sign in to comment.