Handle non-namespaced resouces

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
2024-06-07 13:18:56 +01:00
parent a1cd7f9eae
commit 951bbcc7fd
2 changed files with 5 additions and 2 deletions

View File

@@ -47,11 +47,14 @@ while test $# -gt 0; do
esac
done
NAMESPACED="--namespaced"
if [[ "${LABEL}" != "" ]]; then
LABEL="-l ${LABEL}"
NAMESPACED=""
fi
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | tr '\n' ,)"
NAMES="$(kubectl api-resources ${NAMESPACED} --verbs list -o name | tr '\n' ,)"
if [[ "$ALL_NAMESPACES" == "true" ]]; then
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -A 2>/dev/null