-
Notifications
You must be signed in to change notification settings - Fork 192
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
OCPBUGS-4054: configurable-route: Don't use NewKindWithCache #860
OCPBUGS-4054: configurable-route: Don't use NewKindWithCache #860
Conversation
Replace source.NewKindWithCache(&foo{}, mgr.GetCache()) with &source.Kind{Type: &foo{}} in the configurable-route controller. Using source.NewKindWithCache() is needlessly complicated since this controller uses the default cache anyway. Moreover, using source.NewKindWithCache() causes controller-runtime's logging to be more noisy. Before this commit, the operator emitted log messages like the following on startup: 2022-11-23T08:47:35.646-0600 INFO operator.init controller/controller.go:241 Starting EventSource {"controller": "configurable_route_controller", "source": "&{{%!s(*v1.Role=&{{ } { 0 {{0 0 <nil>}} <nil> <nil> map[] map[] [] [] []} []}) %!s(*cache.multiNamespaceCache=&{map[openshift-config:0xc000712110 openshift-config-managed:0xc000712108 openshift-ingress:0xc0007120f8 openshift-ingress-canary:0xc000712100 openshift-ingress-operator:0xc0007120e8] 0xc000261ea0 0xc00010e190 0xc0007120e0}) %!s(chan error=<nil>) %!s(func()=<nil>)}}"} 2022-11-23T08:47:35.646-0600 INFO operator.init controller/controller.go:241 Starting EventSource {"controller": "configurable_route_controller", "source": "&{{%!s(*v1.RoleBinding=&{{ } { 0 {{0 0 <nil>}} <nil> <nil> map[] map[] [] [] []} [] { }}) %!s(*cache.multiNamespaceCache=&{map[openshift-config:0xc000712110 openshift-config-managed:0xc000712108 openshift-ingress:0xc0007120f8 openshift-ingress-canary:0xc000712100 openshift-ingress-operator:0xc0007120e8] 0xc000261ea0 0xc00010e190 0xc0007120e0}) %!s(chan error=<nil>) %!s(func()=<nil>)}}"} 2022-11-23T08:47:35.646-0600 INFO operator.init controller/controller.go:241 Starting Controller {"controller": "configurable_route_controller"} After this commit, the operator instead emits log messages like the following: 2022-11-23T08:48:43.076-0600 INFO operator.init controller/controller.go:241 Starting EventSource {"controller": "configurable_route_controller", "source": "kind source: *v1.Role"} 2022-11-23T08:48:43.078-0600 INFO operator.init controller/controller.go:241 Starting EventSource {"controller": "configurable_route_controller", "source": "kind source: *v1.RoleBinding"} 2022-11-23T08:48:43.078-0600 INFO operator.init controller/controller.go:241 Starting Controller {"controller": "configurable_route_controller"} Follow-up to commit baf2d3e. This commit fixes OCPBUGS-4054. https://issues.redhat.com/browse/OCPBUGS-4054 * pkg/operator/controller/configurable-route/controller.go (New): Replace source.NewKindWithCache() with source.Kind{}.
@Miciah: This pull request references Jira Issue OCPBUGS-4054, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest-required |
/assign @rfredette |
Failures don't seem related to this PR. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rfredette The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/jira refresh The requirements for Jira bugs have changed (Jira issues linked to PRs on main branch need to target OCP 4.12), recalculating validity. |
/bugzilla refresh The requirements for Bugzilla bugs have changed (BZs linked to PRs on main branch need to target OCP 4.12), recalculating validity. |
@openshift-bot: This pull request references Jira Issue OCPBUGS-4054, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@openshift-bot: No Bugzilla bug is referenced in the title of this pull request. Retaining the bugzilla/valid-bug label as it was manually added. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest-required |
/hold Revision 25eee8e was retested 3 times: holding |
/hold cancel |
/retest-required |
/hold Revision 25eee8e was retested 3 times: holding |
/retest-required |
/hold cancel |
/hold Revision 25eee8e was retested 3 times: holding |
@Miciah: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/hold cancel |
@Miciah: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-4054 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Replace
source.NewKindWithCache(&foo{}, mgr.GetCache())
with&source.Kind{Type: &foo{}}
in the configurable-route controller.Using
source.NewKindWithCache()
is needlessly complicated since this controller uses the default cache anyway. Moreover, usingsource.NewKindWithCache()
causes controller-runtime's logging to be more noisy (see kubernetes-sigs/controller-runtime#2057). Before this PR, the operator emitted log messages like the following on startup:With the change in this PR, the operator instead emits log messages like the following:
Follow-up to #552.
pkg/operator/controller/configurable-route/controller.go
(New
): Replacesource.NewKindWithCache()
withsource.Kind{}
.