Created
October 21, 2019 09:19
-
-
Save borntyping/7d93ef559c99fdb263f6a1caab8d1abb to your computer and use it in GitHub Desktop.
List all Kubernetes resources and subresources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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