-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow global resync & reconcilerImpl informers to be filtered #2176
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: benmoss The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
options := {{.controllerControllerOptions|raw}}{ | ||
Logger: logger, | ||
WorkQueueName: ctrTypeName, | ||
GlobalResyncFilterFunc: func(o interface{}) bool { filterFunc(o) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a hacky trick here, wrapping the filterFunc
in another function closes over the value so we can mutate it down below, passing filterFunc
directly would pass by value: https://play.golang.org/p/lfNHOKu_yPZ
8973f78
to
3ec10ea
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Users can just set the impl FilterFunc option and it will percolate down to the controller.ControllerOptions GlobalResyncFilterFunc as well.
3ec10ea
to
f4bed1c
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Codecov Report
@@ Coverage Diff @@
## main #2176 +/- ##
==========================================
- Coverage 66.05% 66.00% -0.05%
==========================================
Files 224 224
Lines 9426 9437 +11
==========================================
+ Hits 6226 6229 +3
- Misses 2920 2928 +8
Partials 280 280
Continue to review full report at Codecov.
|
@@ -225,11 +234,12 @@ func NewImpl(ctx {{.contextContext|raw}}, r Interface{{if .hasClass}}, classValu | |||
return err | |||
} | |||
for _, elt := range all { | |||
// TODO: Consider letting users specify a filter in options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love it when we find a need for the TODO and then implement the TODO 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, can I ask you to add a small note in the docs for it so someone reading the docs might realize they can use this option: https://github.com/knative/pkg/blob/main/injection/README.md
/lgtm
/hold |
Opened #2180 instead |
Changes
A revised implementation of #2170 and #1909, updated and now using options as per @mattmoor's ancient code review.
Also switched our reconcilers to use
controller.NewImplFull
sinceNewImpl
is deprecated, and this makes setting theGlobalResyncFilterFunc
easier too.This came up again because of knative/eventing#5543, so looking to reintroduce @lberk's changes.
/cc @markusthoemmes