wave-k8s / wave

Kubernetes configuration tracking controller
Apache License 2.0
681 stars 81 forks source link

Getting rid of ownerReferences and finalizers #153

Closed jabdoa2 closed 7 months ago

jabdoa2 commented 7 months ago

Wave currently sets owner references for all secrets/configmaps. That causes a lot of API requests and events on those objects causing further api requests by other controllers. It also causes edge-case bugs such as #79. To prevent that we have to use a finalizer which causes further API requests and delays deletion.

I propose to get rid of all ownerReferences and finalizers. Instead I propose to build up a watch list for all secrets and configmaps during reconcile. We already watch all configmaps and secrets anyway. All we would have to change is that we would look up the namespaced name of the secret/configmap in our watch list and queue a reconcile request for all mapped deployments/statefulsets/daemonsets.

As a migration for current users we would delete all ownerReferences created by wave on startup.

Advantages:

Disadvantages:

I implemented a proof of concept to confirm that this is feasible. It passes our tests and I dont see any other downsides.

Open questions:

Are there any concerns or opinions on that topic? If not I would create a PR to change this.