From fd63efc409e0417ee5b7fd4dfad8a6a05bf66bdb Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 19 Aug 2024 10:54:11 +0200 Subject: [PATCH] Add kube-list-rss-names script to get all available rss in namespace Signed-off-by: Knut Ahlers --- bin/kube-list-rss-names | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/kube-list-rss-names diff --git a/bin/kube-list-rss-names b/bin/kube-list-rss-names new file mode 100755 index 0000000..d3577b7 --- /dev/null +++ b/bin/kube-list-rss-names @@ -0,0 +1,23 @@ +#!/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