...
1#!/usr/bin/env bash
2
3# Purpose: Prints a nice table mapping banner guids to their gcp project ids and display names
4
5set -eu
6
7context=$(kubectl config current-context)
8if [[ "$context" != *"banner-infra"* ]]; then
9 echo "current k8s context is $context. expected a banner-infra cluster"
10 exit 1
11fi
12
13colsarr=(
14 'DISPLAY NAME:spec.displayName'
15 'GCP ID:spec.gcp.projectId'
16 'GUID (NAMESPACE):metadata.name'
17)
18cols=$(printf ",%s" "${colsarr[@]}")
19
20kubectl get banners \
21 --sort-by='{.spec.displayName}' \
22 -o custom-columns="${cols:1}" \
23 2> /dev/null # blackhole annoying throttle warnings
View as plain text