Skip to content

Instantly share code, notes, and snippets.

@trevorbox
Last active July 22, 2020 23:43
Show Gist options
  • Save trevorbox/a5ec53af4a0d7d476ceefe6e3a4876f2 to your computer and use it in GitHub Desktop.
Save trevorbox/a5ec53af4a0d7d476ceefe6e3a4876f2 to your computer and use it in GitHub Desktop.
Kiali member and maistra member label mismatch
#!/bin/bash
echo "Starting job at $(date)..."
OUT=$(oc get projects -o go-template=$'{{range .items}}{{with .metadata}}{{if .labels}}{{ $kiali:=("" | or (index .labels "kiali.io/member-of")) }}{{ $maistra:=("" | or (index .labels "maistra.io/member-of")) }}{{if ne $kiali $maistra}}Mismatch => project:{{.name}} kiali.io/member-of:{{$kiali}} maistra.io/member-of:{{$maistra}}\n{{end}}{{end}}{{end}}{{end}}')
echo "$OUT"
if [ -z "$OUT" ]; then echo "No mismatches found."; fi
echo "Done at $(date)."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment