← Back to Pull requests

Add namespace-scoped ResourceOverride support to admission webhook #111

Closed
unknown closed this pull request without merging on Jul 28, 2026 03:33 UTC
View on GitHub
unknown unknown commented on Jul 21, 2026 18:10 UTC
Author

Implements the operand side of RFE-9093: namespaced ResourceOverride objects with podSelector-based targeting, resolved ahead of ClusterResourceOverride at pod admission (AUTOSCALE-867, 868, 869).

  • Add a dynamic informer/lister for ResourceOverride (resourceoverride_store.go). Soft-fails to nil with a bounded sync timeout if the CRD is missing, so a missing CRD can never block webhook startup; malformed cache entries are skipped via a panic-recovering decode wrapper instead of crashing the process.

  • Add OverrideResolver (resolver.go): resolves the effective override config per pod by listing ResourceOverride objects in the pod's namespace, filtering by podSelector (empty selector matches all pods), and picking the lexicographically-first name on multiple matches. Falls back to ClusterResourceOverride when there's no lister, no candidates, or no selector match. Multiple matches emit a Warning Event (reason OverrideConflict) on each losing ResourceOverride referencing the pod and the winner, without ever blocking admission.

  • Wire the lister and resolver into NewAdmission()/Admit() in admission.go; existing Namespace and LimitRange informers are unchanged.

  • Reuse IsNamespaceExempt() to skip ResourceOverride objects in exempt namespaces during lookup (defense in depth alongside operator-side validation).
  • Unit tests cover: podSelector matching (empty/nil/matchLabels/ matchExpressions), lexicographic tie-break and conflict events, exempt namespace filtering, nil-lister/store-error/no-match fallback paths, missing CRD not blocking startup, and unstructured decode edge cases (malformed, partial, non-unstructured cache items).

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Admission now uses per-namespace/per-pod effective settings resolved from matching resource overrides.
    Empty selectors now match all pods, and when multiple overrides match, selection is deterministic.
    When multiple overrides match, warning events are emitted for the non-selected overrides; behavior falls back to cluster-level settings when no match is found (or overrides can’t be resolved).
    Bug Fixes
    Malformed pod input is rejected with an HTTP 400 response.
    Tests
    Expanded unit test coverage for override resolution, exemption logic, selector matching, and admission mutation/patching (including LimitRange and CPU/request scenarios).
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 321 lines (+240 / -81) across 4 files Reviewer: joelsmith Review duration: 9202m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 321 lines diff across 4 files
    0.42
    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.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #111"
    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: 41.9% (MEDIUM) · Higher = larger blast radius
    41.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: 16.6% · Safe to merge
    16.6%