nrr: Refactor r.List() to call only once.#226
Conversation
Previously, several child functions were calling "r.List()" duplicating work. This commit address the issue. Now we call it "r.List()" once in "reconcile()" parent functions. Signed-off-by: Sujal Shah <sujalshah28092004@gmail.com>
✅ Deploy Preview for node-readiness-controller canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sujalshah-bit The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @sujalshah-bit. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
|
|
||
| // Handle dry run | ||
| if rule.Spec.DryRun { | ||
| if err := r.Controller.processDryRun(ctx, rule); err != nil { |
There was a problem hiding this comment.
Thanks for your PR.
I wonder whether a void return is the right long-term API. if future changes add error-returning logic to these functions, the caller won't see it. Can we keep the signature as-is and make changes targeted only to the List related changes?
There was a problem hiding this comment.
+1 here, returning an error keeps the flexibility of retrying in case of errors
| rule.Status.DryRunResults = readinessv1alpha1.DryRunResults{} | ||
|
|
||
| // Process all applicable nodes for this rule | ||
| if err := r.Controller.processAllNodesForRule(ctx, rule); err != nil { |
ajaysundark
left a comment
There was a problem hiding this comment.
mostly looks good. will need followup to retain error handling
|
/ok-to-test |
Description
Previously, several child functions were calling
"r.List()" duplicating work. This commit address
the issue. Now we call it "r.List()" once
in "reconcile()" parent functions.
Related Issue
None
Type of Change
/kind cleanup
Testing
Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?
Doc #(issue)