DRA claim handling #806
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
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.370
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #806"
general
weight: 0.35
bart0sh
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
AllocateClaimwithpolicy.ErrNoDRAClaims, so a claim naming this driver fails and the pod stayspending. 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>, sothe 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:
AllocateClaimis idempotent andReleaseClaimreleases the whole claim, so releasing here would take resources from a pod
already using them.
prepareClaimrolls back only while the claim has no spec.Claims are refused until the runtime synchronization has completed
stub.Start()returns once the runtime has answeredConfigure; the containersalready running only reach the policy with the
Synchronizethat follows — theone 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.Syncand would report a commit that never happened. Taking the lock inSynchronizeis not the fix, since committing a claim calls out to the runtimewith that lock held. Instead the plugin refuses claims until
SynchronizecallsAllowClaims(), and the kubelet retries. The flag is never cleared: losing theruntime 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.ShareIDandDeviceRequestAllocationResult.ConsumedCapacityneed, the two fields a claimagainst a device with consumable capacity is answered with. The plugin interface
grew
WatchHealthStatus, which we decline: our devices are the node's own CPUsand memory. Importing CDI is also the first thing in the tree to pull in
runtime-tools, whosereplacepin — inherited, with no importer ever since —does not compile against the
runtime-specalready here, so it goes.Testing
go test ./...andgo test -race ./pkg/resmgr/...pass, and each commit buildsand tests green on its own with
go.modtidy. The spec store and both handlersare 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
Synchronizeline that opens it. Every assertion written for theordering and the gates was checked against the mutation it exists to catch.