Files
stream-applications/scripts/list-clusters-gke.sh
2022-11-02 11:09:47 +02:00

15 lines
408 B
Bash
Executable File

#!/bin/bash
if [ "$1" = "" ]; then
echo "cluster name portion to match must be provided"
exit 1
fi
set +e
COUNT=$(gcloud container clusters list | grep -c "$1")
if [ "$COUNT" != "0" ]; then
echo "There are $COUNT $1 clusters"
export CLUSTERS=$(gcloud container clusters list | grep "$1" | awk '{print $1}' | tr "\n" " " | tr "\r" " ")
for cluster in $CLUSTERS; do
echo " $cluster"
done
fi