crossplane-runtime icon indicating copy to clipboard operation
crossplane-runtime copied to clipboard

controller/engine: add queueing index method to NamedController

Open sttts opened this issue 1 year ago • 0 comments

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 test to ensure this PR is ready for review.

How has this code been tested

Tested in Crossplane fixing realtime composition issues.

sttts avatar Feb 22 '24 16:02 sttts