Last active
September 15, 2023 08:40
-
-
Save mousavian/1541a6a38c2a8db0e9a95f5944946270 to your computer and use it in GitHub Desktop.
Suspending all cronjobs in all namespaces in kubernetes
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 | |
for ns in $(kubectl get ns -o jsonpath="{.items[*].metadata.name}"); do | |
for cj in $(kubectl get cronjobs -n "$ns" -o name); do | |
kubectl patch "$cj" -n "$ns" -p '{"spec" : {"suspend" : true }}'; | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Thank you