From 2cfdab10a102439a050e67b3b3b24f60aa9c74b0 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Thu, 28 Jan 2021 16:05:05 -0600 Subject: [PATCH] Fix race condition in deploy script This fixes a race condition in the gate, where `kubectl wait` was getting called before the objects being waited on existed, which causes it to fail [0]. [0]: https://github.com/kubernetes/kubernetes/issues/83242 Change-Id: Ideb04bbe62aaaf28f26b91c73412a009c8160265 --- tools/deployment/deploy-sip.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/deployment/deploy-sip.sh b/tools/deployment/deploy-sip.sh index 6c5c515..20abe5b 100755 --- a/tools/deployment/deploy-sip.sh +++ b/tools/deployment/deploy-sip.sh @@ -4,6 +4,15 @@ sudo snap install kustomize && sudo snap install go --classic make docker-build kubectl wait --for=condition=Ready pods --all -A --timeout=180s make deploy -#Wait for sip controller manager Pod. +#Wait for sip controller manager Pod +count=0 +until [[ $(kubectl -n sipcluster-system get pod -l control-plane=controller-manager 2>/dev/null) ]]; do + count=$((count + 1)) + if [[ ${count} -eq "120" ]]; then + echo ' Timed out waiting for sip controller manager pod to exist' >&3 + return 1 + fi + sleep 2 +done kubectl wait -n sipcluster-system pod -l control-plane=controller-manager --for=condition=ready --timeout=240s kubectl get po -A \ No newline at end of file