Created
February 17, 2018 20:14
-
-
Save denniswebb/4888848763e7a99c5140dc05eab1bc15 to your computer and use it in GitHub Desktop.
Run Kubernetes CronJob on Demand
This file contains hidden or 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
#!/usr/bin/env bash | |
usage () { | |
echo "Usage: $(basename "$0") <cronjob_name>" | |
exit 1 | |
} | |
if [ -z "$1" ]; then usage; fi | |
kubectl get cronjob "$1" -ojson | jq '{ "apiVersion": "batch/v1", "kind": "Job", "metadata": {"name": .metadata.name }, "spec": .spec.jobTemplate.spec }' | kubectl apply -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment