Created
August 23, 2019 09:17
-
-
Save dehypnosis/45707b5b3176e22971da9a62e32d59eb to your computer and use it in GitHub Desktop.
kubernetes remove old telepresence deployments
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 | |
kubectl get deploy --all-namespaces \ | |
-l telepresence \ | |
-o custom-columns=namespace:.metadata.namespace,name:.metadata.name,age:.metadata.creationTimestamp \ | |
| awk -v yesterday=`date -u -v -1d +%FT%TZ` \ | |
'{if ($3 < yesterday) system("kubectl delete deploy --grace-period=0 -n " $1 " " $2) }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modify below
-1d
to adjust age of deployments to remove.