1+ # ################################################
12# # TTL rule
2- # # goes throw all defined ttl.resources and tries to checks for ttl.annotation and/or ttl.label
3- # # if annotation/value is set, janitor will try to parse it and checks against the metadata.creationTimestamp
4- # # if expired, resource will be deleted
3+ # # goes throw all defined ttl.resources and tries to checks for ttl.annotation and/or ttl.label.
4+ # # if annotation/value is set, janitor will try to parse it and checks against the metadata.creationTimestamp.
5+ # # if expired, resource will be deleted.
56ttl :
67 # # checks all resources by annotation
78 annotation : janitor/ttl
2021 # this rule will match ALL resources, !BE CAREFUL!
2122 # - {group: "*", version: "*", kind: "*"}
2223
23- # # static rules (fixed TTLs without using ttl definition in labels/annotations)
24+ # ################################################
25+ # # static rules
26+ # # applies a fixed TTLs against resources metadata.creationTimestamp (or JMESpath timestampPath)
27+ # # doesn't use an annotation/ttl for TTL calculation.
28+ # # useful to remove resources which should only exists for a centrally defined time.
29+ # # if namespaceSelector is used only namespaced resources will be processed.
2430rules :
2531 # cleanup of completed/failed pods which are not yet removed by the Kubernetes control plane
2632 - id : CleanupCompletedPods
33+ # # ttl, calculated against terminated.finishedAt (in this example)
34+ ttl : 1h
2735 resources :
2836 - group : " "
2937 version : v1
@@ -42,14 +50,17 @@ rules:
4250 # # run on all namespaces
4351 namespaceSelector : {}
4452
45- # # ttl for rule (based on terminated.finishedAt, see timestampPath)
46- ttl : 1h
47-
4853 - id : example
54+ # resources expires 1 hour after creation
55+ ttl : 1h
4956 resources :
5057 - group : " "
5158 version : v1
5259 kind : configmaps
60+
61+ # JMESpath where to get the timestamp from, if empty the janitor uses metadata.creationTimestamp
62+ timestampPath : ~
63+
5364 # JMESpath for additional selector, should return true if resource should be used for TTL checks, optional
5465 filterPath : |-
5566 !(metadata.annotations."kubernetes.io/description")
7182 matchLabels :
7283 kubernetes.io/metadata.name : default
7384
74- ttl : 1h # resources expires 1 hour after creation
0 commit comments