Skip to content

Instantly share code, notes, and snippets.

@mgoodness
Created December 14, 2017 16:37
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 mgoodness/7b57b57c74f4303792edc296dc584283 to your computer and use it in GitHub Desktop.
Save mgoodness/7b57b57c74f4303792edc296dc584283 to your computer and use it in GitHub Desktop.
Outputs the number of Ingresses (>=5) in each Namespace, plus Annotations
function count-ingress
for namespace in (kubectl get ns -o name | cut -d/ -f2)
set -l product_name (kubectl get ns $namespace -o json | jq -r '.metadata.annotations."ticketmaster.com/name"')
set -l tech_owners (kubectl get ns $namespace -o json | jq -r '.metadata.annotations."ticketmaster.com/tech-owner"')
set -l count (kubectl -n $namespace get ing --no-headers --ignore-not-found | wc -l | tr -d ' ')
if test $count -ge 5; echo $namespace \($product_name - $tech_owners\): $count; end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment