← Back to Pull requests

fix: validate taint value format with CEL #469

Closed
unknown closed this pull request without merging on Sep 16, 2026 02:19 UTC
View on GitHub
unknown unknown commented on Sep 13, 2026 11:59 UTC
Author

Description

The CEL validation rules on spec.taint validated the key format and capped value length at 63 characters, but did not validate the character set of value. Because the API server enforces label value syntax on node taints ((([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?), a rule with an invalid taint value (such as spaces or invalid punctuation) was admitted at CRD validation, but every subsequent node patch failed with Invalid from the API server, landing the node in status.failedNodes with EvaluationError. Because taint.value is immutable, the rule could not be repaired in-place and had to be deleted and recreated.

This adds a CEL validation rule on spec.taint matching the standard Kubernetes label value character set:

rule: '!has(self.value) || self.value.matches(''^(?:(?:[A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'')'

Empty or omitted values continue to be permitted as before.

Related Issue

Fixes #467

Type of Change

/kind bug

Testing

  • Added unit tests in internal/controller/nodereadinessrule_controller_test.go under CEL Validation for taint value format verifying rejection of invalid taint values and acceptance of valid/empty values.

  • Added e2e test case in test/e2e/taint_validation_test.go.

  • Verified make manifests, make test (exit 0, controller 86.3%), and make lint (0 issues).
  • This PR was written in part with the assistance of generative AI; the failure was reproduced against envtest and the change was reviewed and tested by hand.

    Checklist


  • make test passes

  • make lint passes
  • Does this PR introduce a user-facing change?

    ``release-note
    Reject NodeReadinessRules with invalid taint values at admission time rather than failing subsequent node patches with API server validation errors.
    ``

    Diff: 227 lines (+170 / -57) across 2 files Reviewer: Karthik-K-N Review duration: 3740m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 227 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.325
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #469"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.9% (MEDIUM) · Higher = larger blast radius
    36.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%