cfg/bin/kube-list-rss-names
Knut Ahlers fd63efc409
Add kube-list-rss-names script
to get all available rss in namespace

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-08-19 10:54:11 +02:00

23 lines
498 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
source ~/bin/script_framework.sh
namespace="${1:-}"
[[ -n $namespace ]] || fatal "Missing namespace."
step "Collecting available api-resources..."
api_rss=($(
kubectl api-resources --verbs=list --namespaced -o name |
grep -v "events.events.k8s.io" |
grep -v "events" |
sort | uniq
))
for rss in "${api_rss[@]}"; do
step "Listing names in api-resource ${rss}..."
kubectl -n "${namespace}" \
get --ignore-not-found "${rss}" \
-o name
done