-
Notifications
You must be signed in to change notification settings - Fork 74
/
kubectl-really-get-all
executable file
·37 lines (33 loc) · 1.28 KB
/
kubectl-really-get-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
if [ "$1" == "--help" ]; then
echo "Lists resources of all kinds supported on the server, not just the ones shown by kubectl get all"
echo
echo "Examples: "
echo " # List all resources in the current namespace"
echo " kubectl really get all"
echo
echo " # List all resources in the specified namespace"
echo " kubectl really get all -n my-namespace"
echo
echo " # List all resources in the whole cluster (all cluster-scoped resources and all namespaced resources in all namespaces)"
echo " kubectl really get all --all-namespaces"
echo
echo " # List all resources in the whole cluster with the label foo=bar"
echo " kubectl really get all --selector foo=bar"
echo
echo " # List all resources in the whole cluster in YAML format"
echo " kubectl really get all -o yaml"
echo
echo "Usage:"
echo " kubectl really get all [--all-namespaces|-n namespace]"
echo
echo "Also supports (almost all) other parameters supported by kubectl get (e.g. -o yaml, --show-labels, --selector, ...)"
exit 0
fi
if [ "$1" == "--all-namespaces" ]; then
NAMESPACED_ONLY=""
else
NAMESPACED_ONLY="--namespaced"
fi
RESOURCES=$(kubectl api-resources --verbs=list ${NAMESPACED_ONLY} -o name | tr "\n" ,)
kubectl get ${RESOURCES%?} --show-kind --ignore-not-found $@