← Back to Pull requests

Match all served resource.k8s.io versions in the ResourceSlice policy #35

Closed
unknown closed this pull request without merging on Aug 28, 2026 23:36 UTC
View on GitHub
unknown unknown commented on Aug 17, 2026 18:23 UTC
Author

What type of PR is this?

/kind bug

What this PR does / why we need it:

The ValidatingAdmissionPolicy that restricts ResourceSlice writes to the owning node listed only the beta API versions (v1beta1 and v1beta2). On clusters serving resource.k8s.io/v1, the default since 1.34, the policy therefore matched nothing, and the driver ServiceAccount could create or delete ResourceSlices belonging to any node.

This adds v1 to apiVersions, and adds bats coverage in tests/vap-node-restriction.bats. Those cases run as part of make test-e2e (and the existing e2e GitHub Action). They impersonate the driver ServiceAccount and assert that writes for its own node are allowed, while writes for another node and writes from an identity with no node association are denied. The README sample and the multi TPU demo spec are also moved to resource.k8s.io/v1.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

It is part of an experiment in bringing the three DRA drivers (dra-example-driver, dra-driver-nvidia-gpu and dra-driver-google-tpu) closer to feature parity, along with a few bugs found along the way.

How it was produced: the implementation was written largely by autonomous coding agents working under my direction, one per feature, each in its own branch.

Verified: go build, go vet, unit tests, helm lint --strict, the policy rendering all three versions, and make test-e2e on kind v1.35. The VAP cases pass: create and delete for its own node allowed; create and delete for another node denied; an identity with no node association denied. The regression was also demonstrated live: pinning the policy back to ["v1beta1"] let a cross node v1 write from the driver ServiceAccount succeed. An automated code review pass ran on top of this, and its findings were applied and retested. I have now read the full diff; the policy match, the e2e, and the README/demo move from the v1beta1 basic device wrapper to flattened v1 attributes all look correct.

AI usage - AI was used during testing and updating the code comments.

Does this PR introduce a user-facing change?

``release-note
Fixed the ResourceSlice ValidatingAdmissionPolicy so that it applies on clusters serving resource.k8s.io/v1, where it previously matched no requests.
``

Diff: 291 lines (+218 / -73) across 3 files Reviewer: troychiu Review duration: 16152m
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 291 lines diff across 3 files
0.63
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.340
Shallow Review Depth shallow_review_depth
0.289
Sensitive Paths sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #35"
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: 63.1% (MEDIUM) · Higher = larger blast radius
63.1%
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: 24.9% · Safe to merge
24.9%