Skip to content
Snippets Groups Projects
Commit b5f3f48b authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

Update kubedb.md

parent 77c7c7f4
No related branches found
No related tags found
No related merge requests found
...@@ -7,5 +7,8 @@ kubectl get snapshots.kubedb.com -o go-template --template '{{range .items}}{{.m ...@@ -7,5 +7,8 @@ kubectl get snapshots.kubedb.com -o go-template --template '{{range .items}}{{.m
Clean snapshots older than 2 months in all namespaces: Clean snapshots older than 2 months in all namespaces:
``` ```
kubectl get snapshots.kubedb.com -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}} {{.metadata.creationTimestamp}}{{"\n"}}{{end}}' -A | awk '$3 <= "'$(date -d '2 month ago' -Ins --utc | sed 's/+0000/Z/')'" { print $1 " " $2}' | xargs --no-run-if-empty kubectl delete snapshots.kubedb.com -n for ns in `kubectl get snapshots.kubedb.com -o go-template --template '{{range .items}}{{.metadata.namespace}}{{"\n"}}{{end}}' -A | uniq`; do
kubens $ns
kubectl get snapshots.kubedb.com -o go-template --template '{{range .items}}{{.metadata.name}} {{.metadata.creationTimestamp}}{{"\n"}}{{end}}' | awk '$2 <= "'$(date -d '2 month ago' -Ins --utc | sed 's/+0000/Z/')'" { print $1 }' | xargs --no-run-if-empty kubectl delete snapshots.kubedb.com;
done
``` ```
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment