Skip to content

Instantly share code, notes, and snippets.

@borntyping
Created October 21, 2019 09:19
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 borntyping/7d93ef559c99fdb263f6a1caab8d1abb to your computer and use it in GitHub Desktop.
Save borntyping/7d93ef559c99fdb263f6a1caab8d1abb to your computer and use it in GitHub Desktop.
List all Kubernetes resources and subresources
#!/usr/bin/env bash
set -e
function core_resources() {
http "http://127.0.0.1:8001/api/v1" | jq -r '.resources[].name'
}
function group_versions() {
http GET "http://127.0.0.1:8001/apis" | jq -r '.groups[].preferredVersion.groupVersion'
}
function group_resources() {
for group_version in $(group_versions); do
http "http://127.0.0.1:8001/apis/$group_version" | jq -r '.resources[].name'
done
}
function all_resources() {
core_resources
group_resources
}
all_resources | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment