← Back to Pull requests

DRA driver skeleton #788

Closed
unknown closed this pull request without merging on Sep 18, 2026 14:23 UTC
View on GitHub
unknown unknown commented on Sep 15, 2026 15:29 UTC
Author

Add a DRA driver skeleton to the resource manager

This PR adds DRA driver - registration, ResourceSlice publishing and the two claim entry points — and wires it into the resource manager behind a dra.enabled configuration option that defaults to off. No policy publishes devices yet, so with this PR alone an enabled driver registers and publishes an empty ResourceSlice. Policies get to say what they provide in the PRs that follow.

Why the driver belongs to the resource manager

The driver is node-scoped infrastructure: one plugin registration, one socket, one ResourceSlice publisher per node, all of which outlive any particular allocation decision. Device semantics — what a device is, which ones exist,
what allocating one means — belong to the active policy. So pkg/resmgr/dra knows how to be a DRA driver and nothing about CPUs, memory or cache; it never inspects a device's attributes. The package comment states that boundary, and the tests assert it.

What is here

  • pkg/resmgr/dra — the plugin: New, Start, an idempotent Stop, and PrepareResourceClaims/UnprepareResourceClaims. Built on k8s.io/dynamic-resource-allocation/kubeletplugin.

  • dra.enabled in the common resource manager configuration, exposed by all three policy CRDs. "Common" here means the resource manager reads the switch from one place because it owns the driver — each policy CRD still carries its own spec.dra.enabled, so DRA is enabled per policy (and per node group, via the usual config CR layering), not cluster-wide.

  • resource manager wiring: setupDRA/startDRA from start(), Stop() from shutdown.

  • Helm: the resource.k8s.io/resourceslices RBAC and the kubelet plugin and plugin-registry host mounts, in all three charts, gated on config.dra.enabled so a disabled deployment renders exactly as before.
  • Details worth a reviewer's attention

    The driver is named after the active policy — topology-aware.nri.io. The published devices are the policy's, so a node running a different policy publishes devices of a different kind, and a DeviceClass selecting on device.driver stays specific without further qualification. The cost is that switching a node's policy orphans the old driver's ResourceSlices until the node object goes away.

    The plugin takes the resource manager's lock directly. dra.Options has a sync.Locker, and the resource manager passes itself: it embeds sync.RWMutex already. Every kubelet request takes that lock, which serializes claim handling against NRI request handling.

    Stop() stops the plugin before taking the lock. Helper.Stop() drains the gRPC handlers in flight, and a handler arriving mid-drain blocks on the lock, so stopping the plugin under the lock deadlocks. There is a test for the ordering,
    not just a comment: it starts a real plugin against a fake clientset, holds the lock to stand in for a request being served, and waits for the plugin's socket to disappear.

    Turning DRA on or off at runtime is refused, with a message asking for a restart. Both directions have to happen with the lock released, and reconfiguration holds it.

    Missing cluster access degrades rather than fails. A plugin configured from a local file has no kubernetes client and no node name; enabling DRA there logs a warning and leaves DRA off instead of refusing to start.

    Testing

    go test ./... passes. Unit tests cover the plugin (registration, double start, idempotent stop, both claim entry points, and the boundary property that device attributes are never read), the configuration option across all three policy types, and the resource manager wiring including the shutdown ordering. helm template and helm lint verified on all three charts with DRA both enabled and disabled.

    An end-to-end test arrives with the policy-side implementation, and will skip cleanly on clusters without the required feature gates.

    Diff: 496 lines (+372 / -124) across 6 files Reviewer: bart0sh Review duration: 4253m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 496 lines diff across 6 files
    0.47
    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.371
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #788"
    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: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    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: 18.8% · Safe to merge
    18.8%