gardener / etcd-druid

An etcd operator to configure, provision, reconcile and monitor etcd clusters.
Apache License 2.0
71 stars 49 forks source link

[Feature] Enable automatic cleanup of finished compaction jobs and make TTL configurable #556

Open unmarshall opened 1 year ago

unmarshall commented 1 year ago

Feature (What you would like to be added):

Druid creates compaction jobs for every etcd cluster based on crossing a defined threshold of accumulated events since the last compaction run. These jobs run to completion but are not automatically removed. An operator today has to manually delete these jobs.

Since k8s version 1.21 spec.ttlSecondsAfterFinished can be set to configure after how much time the job resource should be removed. Introduce a new flag that the consumer can pass onto druid to configure the value for the TTL. Assume a default value (> 0) of ttlSecondsAfterFinished and use it if none is explicitly passed by the consumer for all compaction jobs across all etcd clusters.

Motivation (Why is this needed?): To prevent additional work for an operator to manually remove completed jobs.

seshachalam-yv commented 1 year ago

/assign

renormalize commented 7 months ago

711 introduced functionality which deletes all compaction jobs - after they enter the Completed or Failed state.

https://github.com/gardener/etcd-druid/blob/fec5c099bed8e058a3ff34a6d07db9141ca68d93/controllers/compaction/reconciler.go#L140-L171

The controller reconciles whenever there is a job status change event, or when the snapshot lease gets updated. These events would make the controller:

Even for a job which fails when etcd-druid is down, the next snapshot lease update would cause the controller to reconcile, and delete the old job which it now sees to be in the Failed state.

Halting work on this for now, until further brainstorming reveals edge cases which might not be covered in #711.

shreyas-s-rao commented 4 months ago

We will need to relook at the compaction controller design and re-think garbage collection of completed compaction jobs.