Skip to content

fix(controller): emit Warning events on failure paths for taint operations and reconciler errors - #363

Open
Sreejesh06 wants to merge 2 commits into
kubernetes-sigs:mainfrom
Sreejesh06:fix/warning-events-on-taint-failures
Open

fix(controller): emit Warning events on failure paths for taint operations and reconciler errors#363
Sreejesh06 wants to merge 2 commits into
kubernetes-sigs:mainfrom
Sreejesh06:fix/warning-events-on-taint-failures

Conversation

@Sreejesh06

@Sreejesh06 Sreejesh06 commented Aug 6, 2026

Copy link
Copy Markdown

Description

This PR adds Warning event emissions across operational failure paths for taint additions/removals and rule reconciliation errors, ensuring failures are surfaced to operators via standard Kubernetes events.

To align with the observability design in #344 and prevent event flooding on the rule custom resource:

  • Node-Scoped Failures (e.g. AddTaintError, RemoveTaintError): Emitted only on the affected Node object, referencing the rule as the relatedObject.
  • Rule-Scoped Failures (e.g. ListNodesError, StatusUpdateError, FinalizerError): Emitted on the NodeReadinessRule object itself.

This ensures running kubectl describe node properly surfaces scheduling or taint application issues on the node, while kubectl describe nodereadinessrule tracks rule-wide reconciler failures, without flooding the rule object.

Key updates:

  • nodereadinessrule_controller.go: Emit Warning events on the Node for taint errors in evaluateRuleForNode and cleanupTaintsForRule. Emit Warning events on the NodeReadinessRule for reconciler-level failures (finalizer, listing nodes, status patching, dry run, and deletion cleanup).
  • node_controller.go: Removed duplicate generic EvaluationError event calls to prevent redundant warning events on the node.
  • warning_events_test.go: Added clean unit tests (TestWarningEventsEmittedOnFailures, TestReconcile_ListError, TestReconcile_StatusPatchError) asserting correct targeting scopes and verifying exactly 1 event is emitted on node failures.

Related Issue

Fixes #362

Type of Change

/kind bug

Testing

  • Ran make test: All controller unit tests and verification suites pass.
  • Updated warning_events_test.go and nodereadinessrule_controller_test.go.

Checklist

  • make test passes
  • make lint passes

Does this PR introduce a user-facing change?

Emit Warning Kubernetes events on NodeReadinessRule for rule-level failures, and Node objects when taint operations fail.

…tions and node evaluations

Signed-off-by: Sreejesh <sreejesh25122006@gmail.com>
@kubernetes-prow kubernetes-prow Bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 6, 2026
@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

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

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sreejesh06
Once this PR has been reviewed and has the lgtm label, please assign dchen1107 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

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 6, 2026
@kubernetes-prow

Copy link
Copy Markdown

Welcome @Sreejesh06!

It looks like this is your first PR to kubernetes-sigs/node-readiness-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/node-readiness-controller has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 6, 2026
@kubernetes-prow

Copy link
Copy Markdown

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

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 6, 2026
@ajaysundark
ajaysundark self-requested a review August 9, 2026 06:42
…riately

Signed-off-by: Sreejesh <sreejesh25122006@gmail.com>
@Sreejesh06
Sreejesh06 force-pushed the fix/warning-events-on-taint-failures branch from 71610f5 to 7eda9b0 Compare August 9, 2026 11:14
@Sreejesh06 Sreejesh06 changed the title fix(controller): emit Warning events on failure paths for taint opera… fix(controller): emit Warning events on failure paths for taint operations and reconciler errors Aug 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/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Controller emits zero Warning events on NodeReadinessRule or Node objects when taint operations fail

1 participant