Skip to content

fix: return empty result on rule reconcile errors - #472

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
DsThakurRawat:fix-rule-reconciler-requeue-after
Sep 19, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
DsThakurRawat:fix-rule-reconciler-requeue-after

Conversation

@DsThakurRawat

Copy link
Copy Markdown
Contributor

Description

In RuleReconciler.Reconcile, five return sites returned ctrl.Result{RequeueAfter: time.Minute}, err on errors. When err != nil, controller-runtime always ignores RequeueAfter and logs:
Warning: Reconciler returned both a result with either RequeueAfter or Requeue set and a non-nil error. RequeueAfter and Requeue will always be ignored if the error is non-nil.

This change updates those sites to return ctrl.Result{}, err, matching the pattern used in NodeReconciler.Reconcile (internal/controller/node_controller.go:107), and adds a unit test in nodereadinessrule_controller_test.go verifying the result on reconcile failure.

Related Issue

Fixes #468

Type of Change

/kind bug

Testing

Ran unit tests and linters locally:

  • make test: all controller tests passing, 86.9% statement coverage in internal/controller.
  • make lint: clean run, 0 issues across active linters.

Checklist

  • make test passes
  • make lint passes

Does this PR introduce a user-facing change?

NONE

Doc #(issue)

Generative AI Usage Disclosure

  • No AI tools were used
  • AI tools were used (complete below)

How they were used:
Used an AI assistant to edit the five return statements in nodereadinessrule_controller.go and add a unit test in nodereadinessrule_controller_test.go. Verified all changes through local code review, make test, and make lint.

In RuleReconciler.Reconcile, five error return sites returned ctrl.Result{RequeueAfter: time.Minute} alongside a non-nil error. controller-runtime unconditionally discards RequeueAfter when err != nil, routes the reconcile to exponential backoff, and logs a warning on each attempt.

Align RuleReconciler error returns with NodeReconciler by returning ctrl.Result{}, err so backoff applies without warnings, and add a unit test verifying the return result.

Signed-off-by: Divyansh Rawat <divyanshrawatofficial@gmail.com>
@kubernetes-prow kubernetes-prow Bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 16, 2026
@netlify

netlify Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit a2445a4
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/6aaadf5c97879b00089c50c6

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 16, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @DsThakurRawat. 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.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

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.

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 16, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor
When err != nil, controller-runtime always ignores RequeueAfter

Thanks for the PR. It was intended that we retry after a cool-off. I wasn't aware of this behavior.

/cc @Karthik-K-N
Could you please take a look at this?

@Karthik-K-N Karthik-K-N left a comment

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 the cleanup

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 17, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

/approve

Thanks

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ajaysundark, DsThakurRawat

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

The pull request process is described 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

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit d601b13 into kubernetes-sigs:main Sep 19, 2026
12 checks passed
@rawadhossain rawadhossain mentioned this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it 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.

RuleReconciler returns RequeueAfter together with an error, which controller-runtime ignores and warns about

3 participants