knative / knative/pkg

Reconciler needs to provide a filter function for leader election

Open
#1,891 9 comments 0 reactions 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

Expected Behavior

Tekton has created a new custom resource called Run for running custom tasks. Each custom task implementer will provide a reconciler that watches for and processes Run objects that refer to its kind of custom task, through the use of the filter function given to the run informer.

Actual Behavior

We've found a case where a reconciler is given all Run objects, not just the ones it has requested through the filter function given to the run informer. This happens during leader election in this code:

https://github.com/tektoncd/pipeline/blob/master/pkg/client/injection/reconciler/pipeline/v1alpha1/run/controller.go#L72

A custom task implementer will not want to be given Run objects that it isn't written to handle. It needs to be able to pass a filter function to filter the objects on this path.

Steps to Reproduce the Problem

Any controller using leader election goes through this path. Run objects may be the first case though where there may be multiple independent controllers that are only interested in distinct subsets of the objects.

Additional Info

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 at pkg/client/injection/reconciler/pipeline/v1alpha1/run/controller.go around line 72 and trace the leader-election path and the filter function passed to the Run informer. Done means controllers using leader election preserve the requested filter so custom-task reconcilers receive only the Run objects they handle; verify against the reproduction described in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.