Last active
July 15, 2019 09:11
-
-
Save knil-sama/5bf73a509a69c21601703b70e1cec105 to your computer and use it in GitHub Desktop.
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
kubectl get job -o json | jq --arg DATE "$(date '+%s' -d '1 day ago')" '.items[] | select(.metadata.creationTimestamp | fromdateiso8601 < $DATE) | .metadata.labels."job-name" | select(.!=null) ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kubectl get job -o json | jq --arg DATE "$(date '+%s' -d '1 day ago')" '.items[] | select(.metadata.creationTimestamp | fromdateiso8601 <= $DATE) | .metadata.labels."job-name" | select(.!=null) ' | xargs kubectl delete job