Created
September 19, 2023 08:23
-
-
Save juandspy/8f1fb536ff44ff62de26a36b05c97fa4 to your computer and use it in GitHub Desktop.
Get resource quotas for your oc projects in a CSV
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
#/bin/bash | |
namespaces=$(oc get projects -o template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | |
echo "Namespace,Name,Type,Limits CPU,Limits Memory,PersistentVolumeClaims,Pods,Requests Storage" | |
for namespace in $namespaces | |
do | |
for type in "hard" "used" | |
do | |
oc get resourcequotas --namespace="$namespace" -o json | jq -r --arg type "$type" '.items[] | [.metadata.namespace, .metadata.name, $type, .status[$type]["limits.cpu"], .status[$type]["limits.memory"], .status[$type].persistentvolumeclaims, .status[$type].pods, .status[$type]["requests.storage"]] | @csv' | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment