From 44f2b8237b8ddddb51ab6c28be942c22a02379be Mon Sep 17 00:00:00 2001 From: Michael Beaver Date: Wed, 27 Oct 2021 17:38:17 +0000 Subject: [PATCH] AIAP Gate - Update script to use status-checker This change updates the 20_apply_aiap.sh script to utilize the status-checker container to determine if airship-in-a-pod has successfully completed. It also includes a check to fail when the status-checker has detected a failure. Relates-To: #659 Change-Id: I3673de7157f498778154c798878ab20245396c62 --- tools/airship-in-a-pod/scripts/20_apply_aiap.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/airship-in-a-pod/scripts/20_apply_aiap.sh b/tools/airship-in-a-pod/scripts/20_apply_aiap.sh index 309bb2006..bc9558afa 100755 --- a/tools/airship-in-a-pod/scripts/20_apply_aiap.sh +++ b/tools/airship-in-a-pod/scripts/20_apply_aiap.sh @@ -21,10 +21,14 @@ set -ex INTERVAL=15 +# Number of statuses that the status checker is looking at +STATUS_CHECKER_NUM=3 + READY=false KUBE_READY=false + # Wait for the Kubernetes environment to become completely ready while [[ $KUBE_READY == "false" ]]; do @@ -62,3 +66,14 @@ do sleep "$INTERVAL" done +# Now that all of the containers are ready, keep an eye on the status-checker +# container until it shows that every status succeeds, and exit on any failure +while [[ $(kubectl logs airship-in-a-pod -c status-checker --tail 1 | grep -o "SUCCESS" | wc -l) -lt ${STATUS_CHECKER_NUM} ]] +do + # If any status is listed as "FAILED" then we should kill the script with a non 0 exit code + if [[ $(kubectl logs airship-in-a-pod -c status-checker --tail 1 | grep -c -o "FAILED") -gt 0 ]]; then + kubectl logs airship-in-a-pod -c status-checker --tail 1 + exit 3 + fi + sleep "$INTERVAL" +done