Use indexes to lookup related resources more efficiently
I notice that trivy-operator has quite a few internal use cases for looking up related resources, where owners/dependents as the most common one. I suggest to use controller-runtime indexes to make these lookups more efficient and precise. That should also some existing TODOs in the code base. Example: https://github.com/aquasecurity/trivy-operator/blob/6916d7b1476cc50638a7d3f66822cfa96ad92b4e/pkg/vulnerabilityreport/controller.go#L214
An example for how this might look like code-wise: https://book.kubebuilder.io/cronjob-tutorial/controller-implementation.html#setup
This suggestion makes a lot of sense. I can help review if needed. Thanks for looking into this!
This issue is stale because it has been labeled with inactivity.