← Back to Pull requests

image-configurator: no ImageConfig collected #24

Closed
unknown closed this pull request without merging on Aug 24, 2026 17:43 UTC
View on GitHub
unknown unknown commented on Jul 23, 2026 07:19 UTC
Author

Summary


Changed Reconcile to return reconcile.TerminalError and stop when collectImageConfigs cannot collect any valid ImageConfig matching the pod containers.

Also added two filters so that this driver only reacts to what it is responsible for:

  • Ignore allocation results from other drivers when detecting pending binding conditions.

  • Ignore configs that do not specify any Requests, because they cannot indicate which request they were intended for.
  • Why configs with empty Requests are skipped


    When an ImageConfig is authored without a requests field, it is impossible to tell which request the config was intended for. Such a config would be applied uniformly to every request, which easily leads to the error case of "multiple ImageConfigs targeting the same container with different images". For example, with the ResourceClaimTemplate below, the second config has no requests and would be applied together with the first one, producing two different images (ubuntu:latest and fedora:latest) for the same container app.

    <details>
    <summary>Example ResourceClaimTemplate</summary>

    apiVersion: resource.k8s.io/v1
    kind: ResourceClaimTemplate
    metadata:
      name: no-config.requests-2
    spec:
      spec:
        devices:
          requests:
            - name: device
              firstAvailable:
                - name: gpu
                  deviceClassName: gpu.example.com
                - name: cpu
                  deviceClassName: cpu.example.com
            - name: image-config
              exactly:
                deviceClassName: image-configurator.x-k8s.io
          config:
            - requests: ["device/gpu"]
              opaque:
                driver: image-configurator.x-k8s.io
                parameters:
                  apiVersion: image-configurator.x-k8s.io/v1alpha1
                  kind: ImageConfig
                  containerName: app
                  image: ubuntu:latest
            - opaque:
                driver: image-configurator.x-k8s.io
                parameters:
                  apiVersion: image-configurator.x-k8s.io/v1alpha1
                  kind: ImageConfig
                  containerName: app
                  image: fedora:latest
    

    </details>

    Changes


    _driver-image-configurator/internal/controller/pod_controller.go_
  • When imageConfigs is empty, return reconcile.TerminalError instead of returning nil and completing successfully.

  • Error message:
      no valid ImageConfig found in claims matching the pod containers <namespace/name>
      

  • Inside collectImageConfigs, skip entries in Status.Allocation.Devices.Config whose Requests field is empty.

  • Updated collectPendingBindingResults to skip results where result.Driver != DriverName, so results from other drivers are consistently ignored.
  • _dra-driver-image-configurator/internal/controller/pod_controller_test.go_

  • Added Requests fields and corresponding withResult(...) calls to existing test fixtures so they satisfy the new matching logic.

  • Unified driver names in test fixtures from "test-driver" to DriverName so they pass the driver filter.

  • In a previous PR (#11), two test names in TestReconcile were swapped by mistake relative to what the tests actually verified. This PR swaps the names back so they match the fixtures:

  • - "nothing happens if claim has no pending binding results"
    → "returns an error and reconcile stops in case of no image configs"
    (the fixture actually exercises the no-ImageConfig case; also updated to expect the new TerminalError behavior).
    - "nothing happens if claim has no ImageConfig"
    → "nothing happens if claim has no pending binding results"
    (the fixture actually exercises the no-pending-binding-results case).
  • Added a new test case "nothing happens if claims result has different driver" that verifies nothing happens when the claim only contains results for a different driver.

  • Added errMsg / wantRequeue fields to TestReconcile to enable assertions on the error path.
  • Diff: 501 lines (+375 / -126) across 6 files Reviewer: johnbelamaric Review duration: 46704m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.71) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.71 · 501 lines diff across 6 files
    0.71
    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.372
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.071
    Real PR Conversation Timeline
    1 comments
    "Review active on #24"
    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: 70.7% (HIGH) · Higher = larger blast radius
    70.7%
    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: 27.9% · Safe to merge
    27.9%