Added an --all flag to flux-pause

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2024-02-13 12:44:24 +00:00
parent e1aad7b032
commit d7469d40ae
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

View File

@ -5,6 +5,7 @@ source .utils
set -e
VERBOSE=""
ALL=""
TARGET_RESOURCE="kustomization"
NAMESPACES="-n flux-system"
@ -15,6 +16,7 @@ print_usage() {
echo "flux-pause [options] RESOURCE_NAME..."
echo " "
underline "Options:"
echo " --all pause all Kustomizations"
echo "-n, --namespace the namespace resources belong in. Default: flux-system"
echo "-v --verbose show full verbose output"
echo "-h, --help show this help text"
@ -37,6 +39,10 @@ while test $# -gt 0; do
VERBOSE="true"
shift
;;
--all)
ALL="true"
shift
;;
*)
RESOURCES+=(${1})
shift
@ -44,6 +50,9 @@ while test $# -gt 0; do
esac
done
if [[ "${ALL}" == "true" ]]; then
RESOURCES=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\( .metadata.name)"')
fi
for RESOURCE in ${RESOURCES[@]}
do