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
1 changed files with 9 additions and 0 deletions

View File

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