← Back to Pull requests

feat: migrate bootstrap-only validations to CEL #451

Closed
unknown closed this pull request without merging on Aug 30, 2026 17:04 UTC
View on GitHub
unknown unknown commented on Aug 24, 2026 16:47 UTC
Author

<!-- Thanks for sending a pull request! Here are some tips for you:

  • If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide

  • If you want faster PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews

  • If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests

  • -->

    Description


    This PR completes the migration of the remaining bootstrap-only enforcement validations from the admission webhook to native CEL XValidation markers on the NodeReadinessRuleSpec.

    Specifically, it blocks two invalid configurations directly at the API level:
    1. enforcementMode: bootstrap-only combined with defaultStatus
    2. enforcementMode: bootstrap-only combined with conditionPolicy: anyOf

    This aligns with the clean hybrid approach established in PR #418, ensuring standard user templates using allOf continue to work while safely short-circuiting unsupported bootstrap-only configurations without the need for a webhook round-trip.

    Changes include:

  • Addition of two CEL XValidation markers to nodereadinessrule_types.go

  • Regeneration of the CRD schema

  • Removal of the legacy Go validation logic and associated unit tests from nodereadinessgaterule_webhook.go

  • Addition of mirroring CEL controller envtest test cases

  • Minor documentation update reflecting that the API server (not the webhook) now handles these rejections.
  • Related Issue


    Fixes #449

    Type of Change


    /kind feature
    /kind api-change
    /kind cleanup

    Testing


  • Automated envtest cases were added to nodereadinessrule_controller_test.go to explicitly verify that the API server rejects these invalid manifests during creation.

  • Webhook unit tests were cleaned up and verified to pass.

  • Manual verification of the generated CRD schema confirmed the CEL markers propagated correctly.
  • Checklist


  • make test passes

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

    ``release-note
    Migrated the remaining
    bootstrap-only` validation logic from the admission webhook to native CRD CEL validations, improving API server efficiency when creating or updating NodeReadinessRules.

    Diff: 310 lines (+232 / -78) across 3 files Reviewer: ajaysundark Review duration: 8656m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 310 lines diff across 3 files
    0.63
    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.343
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #451"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 63.4% (MEDIUM) · Higher = larger blast radius
    63.4%
    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: 25.1% · Safe to merge
    25.1%