← Back to Pull requests

image-configurator: implement ValidatingAdmissionWebhook for ImageConfig #27

Closed
unknown closed this pull request without merging on Sep 03, 2026 17:02 UTC
View on GitHub
unknown unknown commented on Aug 26, 2026 10:35 UTC
Author

Summary

Implement a ValidatingAdmissionWebhook (VAW) for validating ImageConfig settings in ResourceClaim and ResourceClaimTemplate resources.

Motivation

As discussed in the following PR https://github.com/gke-labs/dra-drivers/pull/8#discussion_r3394231161, BindingConditions currently does not provide a way to tell the scheduler to give up the scheduling when a permanent error occurs, such as a user configuration mistake.

Therefore, configurations should be validated as early as possible during admission to prevent permanent errors during the binding process. This PR implements a VAW for that purpose.

Changes

  • Add a VAW for ResourceClaim and ResourceClaimTemplate to validate ImageConfig parameters during admission.

  • Add webhook.yaml, allowing users to opt in to running the VAW by deploying the webhook with TLS and cert-manager integration.

  • Build and deploy the controller and webhook from the same container image.

  • Add validation tests and update the deployment documentation.

  • Move the shared decoding and validation logic used by the controller and webhook into validation.go, and extract common test helpers into the testutil package.
  • Rejected ImageConfig Examples

    The webhook rejects configurations such as:

    1. An ImageConfig without ContainerName

       apiVersion: image-configurator.x-k8s.io/v1alpha1
       kind: ImageConfig
       containerName: ""
       image: nginx:latest
       

    2. An ImageConfig with an invalid container image reference

       apiVersion: image-configurator.x-k8s.io/v1alpha1
       kind: ImageConfig
       containerName: app
       image: "not a valid image reference"
       

    3. Opaque parameters with an unsupported kind

       apiVersion: image-configurator.x-k8s.io/v1alpha1
       kind: InvalidConfig
       containerName: app
       image: nginx:latest
       

    cc @johnbelamaric

    Diff: 240 lines (+180 / -60) across 3 files Reviewer: johnbelamaric Review duration: 11906m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.62) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 240 lines diff across 3 files
    0.62
    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.328
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #27"
    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: 61.9% (MEDIUM) · Higher = larger blast radius
    61.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: 24.4% · Safe to merge
    24.4%