Skip to content

Instantly share code, notes, and snippets.

@mstrzele
Created May 7, 2020 07:24
Show Gist options
  • Save mstrzele/c59d3d5c41def260671f8c8bcb5209ee to your computer and use it in GitHub Desktop.
Save mstrzele/c59d3d5c41def260671f8c8bcb5209ee to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
namespace=$1
mapfile -t api_resources < <(kubectl api-resources --namespaced -o name --sort-by=name --verbs=list)
options=()
if [[ -n $namespace ]]; then
options+=("-n $namespace")
fi
IFS=','
eval "kubectl ${options[*]} get ${api_resources[*]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment