fix(controller): emit Warning events on failure paths for taint operations and reconciler errors - #363
Conversation
…tions and node evaluations Signed-off-by: Sreejesh <sreejesh25122006@gmail.com>
✅ Deploy Preview for node-readiness-controller canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Sreejesh06 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 |
|
Welcome @Sreejesh06! |
|
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 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. |
…riately Signed-off-by: Sreejesh <sreejesh25122006@gmail.com>
71610f5 to
7eda9b0
Compare
Description
This PR adds
Warningevent 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:
AddTaintError,RemoveTaintError): Emitted only on the affectedNodeobject, referencing the rule as therelatedObject.ListNodesError,StatusUpdateError,FinalizerError): Emitted on theNodeReadinessRuleobject itself.This ensures running
kubectl describe nodeproperly surfaces scheduling or taint application issues on the node, whilekubectl describe nodereadinessruletracks rule-wide reconciler failures, without flooding the rule object.Key updates:
nodereadinessrule_controller.go: EmitWarningevents on the Node for taint errors inevaluateRuleForNodeandcleanupTaintsForRule. EmitWarningevents on the NodeReadinessRule for reconciler-level failures (finalizer, listing nodes, status patching, dry run, and deletion cleanup).node_controller.go: Removed duplicate genericEvaluationErrorevent 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
make test: All controller unit tests and verification suites pass.warning_events_test.goandnodereadinessrule_controller_test.go.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?