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
This commit is contained in:
Michael Beaver 2021-10-27 17:38:17 +00:00
parent 4f7a9dbf6d
commit 44f2b8237b

View File

@ -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