Skip to content

nrr: Refactor r.List() to call only once.#226

Open
sujalshah-bit wants to merge 1 commit into
kubernetes-sigs:mainfrom
sujalshah-bit:refactor/list_call
Open

nrr: Refactor r.List() to call only once.#226
sujalshah-bit wants to merge 1 commit into
kubernetes-sigs:mainfrom
sujalshah-bit:refactor/list_call

Conversation

@sujalshah-bit
Copy link
Copy Markdown

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 test passes
  • make lint passes

Does this PR introduce a user-facing change?

NONE

Doc #(issue)

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>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels May 7, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit b1631c2
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/69fc8fe4ea544600084e35cb

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sujalshah-bit
Once this PR has been reviewed and has the lgtm label, please assign sergeykanzhelev for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 7, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 7, 2026
@sujalshah-bit sujalshah-bit marked this pull request as ready for review May 7, 2026 13:14
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 7, 2026
@ajaysundark ajaysundark self-requested a review May 7, 2026 21:42

// Handle dry run
if rule.Spec.DryRun {
if err := r.Controller.processDryRun(ctx, rule); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAA

Copy link
Copy Markdown
Contributor

@ajaysundark ajaysundark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly looks good. will need followup to retain error handling

@ajaysundark
Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants