pkg icon indicating copy to clipboard operation
pkg copied to clipboard

FilterFunc in the informer is not working on the first run of reconciler

Open danyinggu opened this issue 5 years ago • 6 comments

/kind bug

Expected Behavior

The informer should always successfully filter objects based on filterFunc defined the informer

Actual Behavior

In the first run of the reconcile, it lists all objects and objects are not filtered by filterFunc in the informer

Steps to Reproduce the Problem

  1. Given a controller with an informer that has a filterFunc
  2. Deploy the controller
  3. In the first run of the reconciler, it reconciles all the objects but not only the objects should pass the filterFunc

Additional Info

We did some investigation, in the genreconciler: https://github.com/google/knative-gcp/blob/3707bd3ca3d010532b334201dc7da6c9bc382959/pkg/client/injection/reconciler/broker/v1beta1/broker/controller.go#L73-L81 When a controller starts, a new leader is promoted with a listAll operation and there is no informer resync.

danyinggu avatar Oct 01 '20 18:10 danyinggu

@mattmoor @n3wscott @grantr

danyinggu avatar Oct 01 '20 18:10 danyinggu

Yup, there's no filter passed to genreconciler currently, but you could plumb one through in the controller options.

mattmoor avatar Oct 01 '20 20:10 mattmoor

@mattmoor can you point to an example of plumbing through? Looks like the code directly enqueues every object in the lister, skipping any informer FilterFunc.

grantr avatar Oct 01 '20 20:10 grantr

By "plumbing through" I mean adding a field and calling it from that logic in genreconciler itself, there is no field today.

mattmoor avatar Oct 01 '20 20:10 mattmoor

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Dec 31 '20 02:12 github-actions[bot]

/lifecycle frozen

mattmoor avatar Jan 04 '21 16:01 mattmoor