matchilling / k8s-janitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

K8S Janitor

K8S Janitor 🧹

The janitor does what the janitor has to do.

Usage

Deploy as a CRON job on K8S

  1. Create a deployment.yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: k8s-janitor
spec:
  schedule: "0 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: MY_SERVICE_ACCOUNT_NAME
          containers:
            - name: k8s-janitor
              image: matchilling/k8s-janitor
              args:
                - /bin/sh
                - /opt/k8s-janitor/script/remove_completed_jobs.sh
              env:
                - name: MATTERMOST_URL
                  value: MY_MATTERMOST_URL
          restartPolicy: OnFailure
  1. Create the resource
$ kubectl create -f deployment.yaml

Usage for development purposes

# Run locally using an interactive session
$ make run-local

# Run on K8S an interactive session
$ SERVICE_ACCOUNT=my-service-account \
  NAMESPACE=my-namespace \
  MATTERMOST_URL \
  make run-k8s

Support & Contact

Having trouble with this repository? Check out the documentation at the repository's site or contact m@matchilling.com and we'll help you sort it out.

Happy Coding

✌️

About

License:MIT License


Languages

Language:Makefile 39.9%Language:Shell 39.1%Language:Dockerfile 21.0%