all repos — janny @ 4f685e1161bc6eb5e47c4922d15d620d28bccd0f

clean up Kubernetes resources after a set TTL

readme (view raw)

 1JANNY
 2
 3A work-in-progress Kubernetes application to clean up Kubernetes
 4resources after a set TTL.
 5
 6
 7ROADMAP
 8
 9[x] Implement basic resource cleaning
10[x] Black/whitelist resources (--included-resources flag)
11[ ] Expiry timestamp
12[ ] Helm chart
13
14USAGE
15
16Two ways to deploy janny: plain Kubernetes manifests or via a Helm
17chart.
18
19Kubernetes manifests
20--------------------
21
221. Modify deploy/deployment.yaml: specify included resources, and
23namespaces for janny to operate on.
24
252. Create a service account
26
27    $ kubectl create sa janny
28
293. Modify deploy/clusterrole.yaml to limit janny's access to resources.
30   Ensure that janny has access to the resources you specified in the
31   deployment.yaml!
32
334. Deploy janny:
34
35    $ kubectl apply -f deploy/
36
37
38Helm chart
39----------
40
41TODO
42
43Once deployed, janny will look for resources having the 'janny.ttl'
44annotation. Something like:
45
46    janny.ttl: 15m
47    janny.ttl: 1d14h
48    janny.ttl: 6h45m
49
50
51DEVELOPING
52
53Setup a local minikube cluster[1]. Then, clone this repo and install
54dependencies:
55
56    $ poetry shell
57    $ poetry install
58
59Build a docker image (gets stored in minikube's registry):
60
61    $ eval $(minikube env-docker)
62    $ docker build -t janny:latest .
63
64Finally, deploy to your cluster:
65
66    $ kubectl create sa janny
67    $ kubectl apply -f deploy/
68
69
70PRIOR ART
71
72https://codeberg.org/hjacobs/kube-janitor: While kube-janitor already
73does the same thing, it's written using pykube, which has been
74undeveloped since 2017.
75
76
77[1]: https://minikube.sigs.k8s.io/docs/