← Back to Pull requests

DRA claim handling #806

Closed
unknown closed this pull request without merging on Oct 02, 2026 07:19 UTC
View on GitHub
unknown unknown commented on Sep 21, 2026 15:59 UTC
Author

DRA claim handling

Prepare and unprepare claims, and grant them with CDI

Third PR of the DRA series, on top of #803. It fills in the two kubelet handlers
the skeleton left as no-ops: a claim is allocated by the active policy through
the interface #803 added, and what it got is granted to the containers using it
by a CDI spec of its own.

Still inert on a cluster — every backend answers AllocateClaim with
policy.ErrNoDRAClaims, so a claim naming this driver fails and the pod stays
pending. The next PR brings the first policy that really allocates, and with it
the first look at this path outside its tests.

Three commits, in order: the library bump to Kubernetes v0.37 and the one
source change it forces; the CDI spec store — file mechanics and device
naming, where the device for result i of claim uid is claim-<uid>-<i>, so
the positional correspondence #803 defined survives into the CDI IDs; then
claim dispatch.

The ordering is the design

Prepare is: allocate through the policy, commit, write the spec. Unprepare
is: release, commit, remove the spec. Committing is a cache save plus the NRI
container updates the policy made, which is what lets an allocation outlive us
and reach the containers that give resources up for it.

Spec last is what keeps the accounting honest across a crash: the worst case is a
spec no claim accounts for, never resources granted to a container and accounted
to nobody. Two things follow from it.

A spec proves a prepare completed, so a failure partway through a
re-prepare must not roll back: AllocateClaim is idempotent and ReleaseClaim
releases the whole claim, so releasing here would take resources from a pod
already using them. prepareClaim rolls back only while the claim has no spec.

Claims are refused until the runtime synchronization has completed

stub.Start() returns once the runtime has answered Configure; the containers
already running only reach the policy with the Synchronize that follows — the
one NRI handler that runs without the resource manager's lock and with cache
saves blocked. A claim served in that window would be allocated beside
policy.Sync and would report a commit that never happened. Taking the lock in
Synchronize is not the fix, since committing a claim calls out to the runtime
with that lock held. Instead the plugin refuses claims until Synchronize calls
AllowClaims(), and the kubelet retries. The flag is never cleared: losing the
runtime connection exits the process.

Those refusals are per request, not per claim — nothing is wrong with the
individual claims, and a request with no answer is what the kubelet retries.
Everything else is answered per claim, because the kubelet records the answers
per claim and retries only the ones that failed.

The library bump

v0.37 is what Device.ShareID and
DeviceRequestAllocationResult.ConsumedCapacity need, the two fields a claim
against a device with consumable capacity is answered with. The plugin interface
grew WatchHealthStatus, which we decline: our devices are the node's own CPUs
and memory. Importing CDI is also the first thing in the tree to pull in
runtime-tools, whose replace pin — inherited, with no importer ever since —
does not compile against the runtime-spec already here, so it goes.

Testing

go test ./... and go test -race ./pkg/resmgr/... pass, and each commit builds
and tests green on its own with go.mod tidy. The spec store and both handlers
are covered: the devices a claim is answered with, other drivers' results left
alone, per-claim isolation, rollback at each failure point, a re-prepare and a
failed re-prepare, both commit-failure paths, and the gate in both directions
including the Synchronize line that opens it. Every assertion written for the
ordering and the gates was checked against the mutation it exists to catch.

Diff: 488 lines (+366 / -122) across 6 files Reviewer: bart0sh Review duration: 15320m
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 · 488 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.370
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #806"
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.4% (MEDIUM) · Higher = larger blast radius
47.4%
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.7% · Safe to merge
18.7%