Created
April 10, 2019 14:50
-
-
Save stuartleeks/bd5a56735c042fe1ab1c76b046d740ea to your computer and use it in GitHub Desktop.
DevOpsOpenHack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
blue="\e[1;34m" | |
green="\e[1;32m" | |
no_colour="\e[1;0m" | |
PROD=$(kubectl get service api-trip-svc-prod --output=jsonpath={.spec.selector.slot}) | |
echo -e "ProdColour: ${!PROD}$PROD$no_colour" | |
echo | |
HEALTH=$(curl --silent http://akstraefikopenhackf8g7.northeurope.cloudapp.azure.com/api/healthcheck/trips) | |
echo "Health: $HEALTH" | |
echo | |
IFS=$'\n' | |
lines=$(kubectl get pods --selector app=mydrive-trips) | |
for pod in $lines | |
do | |
colour=$(echo $pod | grep -Po "(?<=deploy-)(?:[^-]*)") | |
if [[ -n "$colour" ]]; then | |
ansiColour=${!colour} | |
echo -e "$ansiColour$pod$no_colour" | |
else | |
echo $pod | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment