File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,26 @@ DEFAULT_TIMEOUT=300
2121TIMEOUT=${4:- ${DEFAULT_TIMEOUT} }
2222echo " Waiting for deployment $DEPLOYMENT . Expecting $REQUIRED_COUNT replicas. Timeout in $TIMEOUT seconds"
2323CUNNRENT_COUNT=$( kubectl get deployment/$DEPLOYMENT -n $NAMESPACE -o=jsonpath=' {.status.availableReplicas}' )
24- if [ $? -ne 0 ]; then
25- echo " An error occurred. Exiting"
26- exit 1
27- fi
2824SLEEP=5
2925exit=$(( SECONDS+ TIMEOUT))
30- while [ " ${CUNNRENT_COUNT} " -ne " ${REQUIRED_COUNT} " ] && [ ${SECONDS} -lt ${exit} ]; do
26+ while [ -z " ${CUNNRENT_COUNT} " ] && [ ${SECONDS} -lt ${exit} ]; do
27+ CUNNRENT_COUNT=$( kubectl get deployment/$DEPLOYMENT -n $NAMESPACE -o=jsonpath=' {.status.availableReplicas}' )
28+ timeout_in=$(( exit- SECONDS))
29+ sleep ${SLEEP}
30+ done
31+
32+ if [ -z " ${CUNNRENT_COUNT} " ]; then
33+ printError $DEPLOYMENT $NAMESPACE
34+ exit 1
35+ fi
36+
37+ while [ " ${CUNNRENT_COUNT} " -lt " ${REQUIRED_COUNT} " ] && [ ${SECONDS} -lt ${exit} ]; do
3138 CUNNRENT_COUNT=$( kubectl get deployment/$DEPLOYMENT -n $NAMESPACE -o=jsonpath=' {.status.availableReplicas}' )
3239 timeout_in=$(( exit- SECONDS))
3340 sleep ${SLEEP}
3441done
3542
36- if [ " ${CUNNRENT_COUNT} " -ne " ${REQUIRED_COUNT} " ]; then
43+ if [ " ${CUNNRENT_COUNT} " -lt " ${REQUIRED_COUNT} " ]; then
3744 printError $DEPLOYMENT $NAMESPACE
3845 exit 1
3946elif [ ${SECONDS} -ge ${exit} ]; then
You can’t perform that action at this time.
0 commit comments