hjacobs / kube-janitor

Clean up (delete) Kubernetes resources after a configured TTL (time to live)
GNU General Public License v3.0
473 stars 40 forks source link

Emit event on resource deletion #9

Closed hjacobs closed 5 years ago

hjacobs commented 5 years ago

Emit TimeToLiveExpired events on resource deletion.

Fixes #4.

Sample events:

2m          2m           1         kube-janitor-qctbm                                  Deployment                                 Normal    TimeToLiveExpired   kube-janitor            Deployment nginx3 with 1s TTL is 2m13s old and will be deleted (reason: annotation)
2m          2m           1         kube-janitor-qdt4s                                  ReplicaSet                                 Normal    TimeToLiveExpired   kube-janitor            ReplicaSet nginx3-589c484759 with 1s TTL is 2m14s old and will be deleted (reason: annotation)
hjacobs commented 5 years ago

Another example with rule matching:


44s         Normal    TimeToLiveExpired   Namespace    Namespace pr-123 with 2m TTL is 9m9s old and will be deleted (rule temporary-pr-namespaces matches)