18 lines
605 B
Fish
18 lines
605 B
Fish
function kubectl-get-all
|
|
set -l context
|
|
set -l namespace
|
|
set -l fields "API:apiVersion,TYPE:kind,NAME:metadata.name"
|
|
|
|
if test "$argv[1]" = -c
|
|
set context $argv[2]
|
|
set namespace $argv[3]
|
|
else
|
|
set context (kubectl config current-context)
|
|
set namespace $argv[1]
|
|
end
|
|
|
|
kubectl --context="$context" api-resources --verbs=list --namespaced -o name | grep -v events | sort | uniq | while read -l restype
|
|
kubectl --context="$context" --namespace "$namespace" get --ignore-not-found --no-headers "$restype" -o custom-columns="$fields"
|
|
end
|
|
end
|