Skip to content

Instantly share code, notes, and snippets.

@yudppp yudppp/Dockerfile
Last active Aug 17, 2017

What would you like to do?
kube job remover
FROM alpine
ADD${KUBECTL_VERSION}/bin/linux/amd64/kubectl /bin/kubectl
RUN chmod +x /bin/kubectl
# Delete successed job after 2 hours ago
CMD while true; do kubectl get job | awk '{ if(match($4, /^([2-9]h|[1-2][0-9]h|[0-9]+d)$/) && ($3==1)) print $1}' | xargs -n 1 --no-run-if-empty kubectl delete job; sleep 600s; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.