Last active
December 8, 2017 15:01
-
-
Save DazWilkin/accf93f04c338d8486efb37fb0723cf9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
for PROJECT in $(gcloud projects list --format="value(projectId)") | |
do | |
for CLUSTERZONES in $(gcloud beta container clusters list --project=${PROJECT} --format="csv[no-heading](name,zone)") | |
do | |
# Parse (name,zone) --> $CLUSTER, $LOCATION | |
IFS="," read CLUSTER LOCATION <<<"${CLUSTERZONES}" | |
echo -e "Project: ${PROJECT}" | |
echo -e "Cluster: ${CLUSTER}" | |
echo -e "Location: ${LOCATION}" | |
echo -e "NodePools:" | |
NODEPOOLS=$(gcloud beta container clusters describe ${CLUSTER} --project=${PROJECT} --region=${LOCATION} --flatten=nodePools --format="csv[no-heading](nodePools.name,nodePools.config.imageType)") | |
# Parse (name,imageType) --> $POOLNAME, $POOLTYPE | |
for NODEPOOL in ${NODEPOOLS} | |
do | |
IFS="," read POOLNAME POOLTYPE <<<"${NODEPOOL}" | |
echo -e "- Name: ${POOLNAME}" | |
echo -e " Type: ${POOLTYPE}" | |
done | |
echo "" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment