rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.5k stars 227 forks source link

Improve Content resources cleanup #2464

Closed weyfonk closed 1 month ago

weyfonk commented 4 months ago

This is a follow-up to #1980.

With finalizers in place for bundle deployments, we have one additional reconcile loop available to run cleanup tasks when a bundle deployment is deleted. This opportunity could be used to act on Content resources, preventing their batch deletion by our cleanup controller.

Possible approaches to baking this logic into the bundle deployment reconciler: A. When deleting a bundle deployment, check referenced Content resources and, for each Content resources, check how many bundle deployments reference it (might be expensive/cumbersome): if no other bundle deployment than the one we are deleting references it anymore, then the Content resource is safe to delete. We could increase timer for the content purge logic, or make it configurable, since garbage collection now happens as needed.

B. Add finalizers to Content resources, eg. one per bundle deployment referencing it? A given finalizer would be deleted when the bundle deployment it refers to is itself deleted. These finalizers could act as reference counts, enabling a Content resource to be deleted as soon as its finalizers have all been deleted.

manno commented 3 months ago

Moving to the next milestone, because of the ongoing code freezes.