Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Update ApiVersion for CronJob. Support Kubernetes 13.5 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Here are 3 cleanups you can apply on your kubernetes cluster:
* Cleans up old replica sets, finished jobs and unrecycled evicted pods as a CronJob (`k8s-clean.yml`).
* Cleans up empty directory (not used anymore) in etcd as a CronJob (`etcd-empty-dir-cleanup.yml`).

You must have `batch/v2alpha1` enabled on your k8s API server runtime config in order to run the CronJob.
You must have `batch/v1beta1` enabled on your k8s API server runtime config in order to run the CronJob.

### Env vars
In the DaemonSet (`docker-clean.yml`) you can set `DOCKER_CLEAN_INTERVAL` to modify the interval when it cleans up exited containers and dangling images/volumes; defaults to 30min (1800s).
Expand Down
2 changes: 1 addition & 1 deletion etcd-empty-dir-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: batch/v2alpha1
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-empty-dir-cleanup
Expand Down
2 changes: 1 addition & 1 deletion k8s-clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for job in $finishedJobs; do
done

# Get unrecycled evicted pods older than 1h
evictedPods=$(kubectl get pods --all-namespaces -a | grep 'Evicted' | \
evictedPods=$(kubectl get pods --all-namespaces | grep 'Evicted' | \
awk 'IF $6 ~ /h|d/ {print $1 "|" $2}')

# Loop through evicted pods and delete them
Expand Down
2 changes: 1 addition & 1 deletion k8s-clean.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: batch/v2alpha1
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: k8s-cleanup
Expand Down