From b87024a14cd6156c54925f3dca2cc00c43f454ee Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Fri, 12 Feb 2021 16:43:39 -0600 Subject: [PATCH] Wait for etcd to startup before trying to connect to it --- apiserver/Dockerfile | 2 +- apiserver/entrypoint.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apiserver/Dockerfile b/apiserver/Dockerfile index e1fe2d07..d82093c1 100644 --- a/apiserver/Dockerfile +++ b/apiserver/Dockerfile @@ -26,7 +26,7 @@ FROM debian:buster # Install runtime dependencies RUN apt-get -qq update && \ - apt-get -qq install --no-install-recommends binutils git ca-certificates netcat && \ + apt-get -qq install --no-install-recommends binutils git ca-certificates netcat curl && \ apt-get -qq autoremove && \ apt-get -qq autoclean && \ apt-get -qq clean all && \ diff --git a/apiserver/entrypoint.sh b/apiserver/entrypoint.sh index 9ea36548..fc1ea52b 100755 --- a/apiserver/entrypoint.sh +++ b/apiserver/entrypoint.sh @@ -169,6 +169,15 @@ cat << EOF > /apiserver.json } EOF + + # Wait for etcd to come online + echo -n "Waiting for etcd at $ETCD_ADDR..." + until $(curl -XGET --output /dev/null --silent --fail ${ETCD_ADDR}/version); do + echo -n "." + sleep 3 + done + echo -e "\netcd is online: $ETCD_ADDR" + if [ -z "$SPEC_GIT_REPO" ]; then SPEC_GIT_REPO=https://github.com/nds-org/ndslabs-specs fi @@ -185,7 +194,7 @@ EOF umask 0 if [ -z "$TEST" ]; then - apiserver -conf /apiserver.json --logtostderr=true -v=1 -passwd $ADMIN_PASSWORD + apiserver -conf /apiserver.json --logtostderr=true -v=4 -passwd $ADMIN_PASSWORD else echo "Running binary with test/coverage instrumentation" echo "Writing output to $VOLUME_PATH/coverage.out"