Skip to content

[BUG] Orphaned readiness taint remains when a node's labels no longer match a rule's selector #342

Description

@bhuvan-somisetty

What happened?

Split out of #338 per @ajaysundark's review comment: when a node's labels change so it no longer matches a NodeReadinessRule's spec.nodeSelector, NodeReconciler simply stops seeing the rule as applicable via getApplicableRulesForNode and moves on. Any taint that rule previously applied to the node is never removed, and the node's stale entries in rule.Status.NodeEvaluations/AppliedNodes/FailedNodes are never cleaned up.

Steps to Reproduce

  1. Create a rule with nodeSelector: {tier: frontend} and taint readiness.k8s.io/frontend-ready:NoSchedule.
  2. Label a node tier=frontend; once a required condition is False, the controller applies the taint.
  3. Relabel the node: kubectl label node worker-1 tier=backend --overwrite.
  4. Inspect worker-1.spec.taintsreadiness.k8s.io/frontend-ready is still present even though the node no longer matches tier: frontend.

Expected Behavior

Ideally the taint gets removed and the node drops out of the rule's status once it stops matching. In practice this needs a reliable way for NodeReconciler to detect "used to match, no longer does" without depending on rule.Status as the signal for what to act on, since the controller's own previously-written status isn't a trustworthy basis for deciding what action to take next (a first attempt at this in #339 did exactly that, and @ajaysundark flagged it as fragile in review).

Controller Version / Image Tag

main (commit 43bff46)

Kubernetes Version

Not version-specific.

Additional Environment Details

Carried over from review discussion on #338/#339:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions