Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
Created April 10, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartleeks/bd5a56735c042fe1ab1c76b046d740ea to your computer and use it in GitHub Desktop.
Save stuartleeks/bd5a56735c042fe1ab1c76b046d740ea to your computer and use it in GitHub Desktop.
DevOpsOpenHack
#!/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