knative / knative/pkg

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

Open
#1,764 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

lifecycle/frozen
Dominant language
Go
Stars
276
Forks
344
Avg merge
1d 1h
Merged PRs (30d)
1

Description

/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked pkg/client/injection/reconciler/broker/v1beta1/broker/controller.go lines 73-81 and trace the informer startup and first reconcile path. Reproduce a controller with a filterFunc, then verify that the initial reconcile processes only objects accepted by the filter rather than all listed objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.