DRA driver skeleton #788
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
bart0sh
Add a DRA driver skeleton to the resource manager
This PR adds DRA driver - registration,
ResourceSlicepublishing and the two claim entry points — and wires it into the resource manager behind adra.enabledconfiguration option that defaults to off. No policy publishes devices yet, so with this PR alone an enabled driver registers and publishes an emptyResourceSlice. 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
ResourceSlicepublisher 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/draknows 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 idempotentStop, andPrepareResourceClaims/UnprepareResourceClaims. Built onk8s.io/dynamic-resource-allocation/kubeletplugin.dra.enabledin 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 ownspec.dra.enabled, so DRA is enabled per policy (and per node group, via the usual config CR layering), not cluster-wide.setupDRA/startDRAfromstart(),Stop()from shutdown.resource.k8s.io/resourceslicesRBAC and the kubelet plugin and plugin-registry host mounts, in all three charts, gated onconfig.dra.enabledso 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 aDeviceClassselecting ondevice.driverstays specific without further qualification. The cost is that switching a node's policy orphans the old driver'sResourceSlicesuntil the node object goes away.The plugin takes the resource manager's lock directly.
dra.Optionshas async.Locker, and the resource manager passes itself: it embedssync.RWMutexalready. 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 templateandhelm lintverified 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.