crossplane-runtime
crossplane-runtime copied to clipboard
controller/engine: add queueing index method to NamedController
Description of your changes
Using GetCache()'s IndexField method will use the passed context for the life-cycle of informers started at that moment. This is usually not what is desired, but the life-cycle of the cache should match the life-cycle of the controller, and this applies to all informers of course.
This PR adds a IndexField method to queue up index creation until the controller has been started.
Note that the GetCache() method is still useful to e.g. wire it up into other components that want to read from the cache later.
I have:
- [x] Read and followed Crossplane's contribution process.
- [x] Run
make reviewable testto ensure this PR is ready for review.
How has this code been tested
Tested in Crossplane fixing realtime composition issues.