Clear FailedNodes on successful node reconciliation - #381
Conversation
✅ Deploy Preview for node-readiness-controller ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @Ayush4958. 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. |
|
@ajaysundark @Karthik-K-N thanks ... |
|
@Ayush4958 I think the Fixes 379 reference is incorrect here. It seems unrelated to the PR you raised. |
yh, my bad, pressed wrong number key |
|
Ran this branch against the repro from #376. The fix in One quick heads-up on the unit test in That happens because The API server assertion at line 1220 ( |
|
thanks for it and u were right about memory pointer and |
| errs = append(errs, err) | ||
| metrics.Failures.WithLabelValues(rule.Name, string(metrics.FailureReasonEvaluationError)).Inc() | ||
| } else { | ||
| // Clear any stale failures from previous reconciliation attempts. |
There was a problem hiding this comment.
Can you extract clearNodeFailure as a helper instead? ref #333.
There was a problem hiding this comment.
It'd be good to give credits to previous authors with "Co-authored-by"
There was a problem hiding this comment.
Can you extract clearNodeFailure as a helper instead? ref #333.
Done! I had extracted clearNodeFailure into a helper & also included the co-authored-by
|
/ok-to-test |
Co-authored-by: bhuvan-somisetty <bhuvan-somisetty@users.noreply.github.com>
873d145 to
d2f37c3
Compare
|
Thanks for the patch! /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ajaysundark, Ayush4958 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
This fixes a state leak in the NodeReconciler where transient evaluation errors permanently leaked into
rule.Status.FailedNodes.When a transient error resolves and the node successfully evaluates on the next retry, the controller was forgetting to clear the old failure from the cached rule object. As a result, the status patch actively re-merged the stale error back into the API server
This fix adds the missing
elseblock toprocessNodeAgainstAllRulesto clear the failure upon success, matching the correct logic already present in the RuleReconciler'sprocessAllNodesForRule. It also adds a unit test to prevent future regressions.Related Issue
Fixes #376
Type of Change
/kind bug
Testing
Added a regression test in
node_controller_test.go("should clear FailedNodes entry when node evaluation succeeds after a prior transient failure") which simulates a transient failure followed by a successful evaluation, asserting thatFailedNodesdrops to empty.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?