feat(gateway-api): add ReferenceGrant CRD and cross-namespace authorization #9953
All Vouch review confidence checks passed
Residual risk 0.40 = Change Risk (0.69) × (1 − Review Confidence (0.41)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 464 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 78% · 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.367
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #9953"
general
weight: 0.35
claude[bot]
Stacked on #9950
Description
Problem
Phase 1 of
smg-gateway-apirejected all cross-namespacebackendRefsandcertificateRefsunconditionally (RefNotPermitted). Real multi-tenant Kubernetes deployments requireReferenceGrant(gateway.networking.k8s.io/v1beta1) so target namespaces can explicitly authorize cross-namespace references fromGatewaytoSecret(listener certificates and GEP-3155 backend client certificates) and fromHTTPRoutetoServiceorInferencePool, while remaining fail-closed whenever no matching grant exists.Solution
ReferenceGrant(gateway.networking.k8s.io/v1beta1) custom resource definitions undercrates/gateway_api/src/crds/reference_grant.rs.ReferenceGrantIndexundercrates/gateway_api/src/compiler/reference_grants.rsand wire it intoGatewaylistener/client Secret resolution andHTTPRoutebackend resolution (ServiceandInferencePool).ResolvedRefs: False / RefNotPermitted) unless aReferenceGrantin the target namespace matches both(from.group, from.kind, from.namespace)and(to.group, to.kind, to.name)(empty/omittedto.namematching any object of(group, kind)in that namespace).ReferenceGrantreflector watch toGatewayController(included in the initialInitDonebarrier) and hashReferenceGrantspecs ininputs_fingerprintso spec changes trigger recompilation even though Kubernetes does not bumpmetadata.generationon status-less CRDs.Refs: #8616
Changes
crates/gateway_api/src/crds/reference_grant.rs,mod.rs,tests.rs:ReferenceGrant,ReferenceGrantSpec,ReferenceGrantFrom,ReferenceGrantTo+ deserialization and CRD schema tests.crates/gateway_api/src/compiler/reference_grants.rs:ReferenceGrantIndex.crates/gateway_api/src/compiler/{mod.rs, listeners.rs, routes.rs, tests.rs}: wireReferenceGrantintoGatewayInputsand cross-namespace Secret / Service / InferencePool authorization with fail-closed and allowed unit tests.crates/gateway_api/src/controller.rs:ReferenceGrantreflector watch,InitDonebarrier inclusion, and spec-basedinputs_fingerprinthashing + unit test.crates/gateway_api/src/matcher/{backend.rs, mod.rs}: update doc comments for ReferenceGrant-authorized cross-namespace namespaces.Test Plan
Ran on branch
feat/gateway-api-reference-grant(f15332376327b29c596ad6d0f9078aaf83e77651):Release note
none (internal foundation crate for Gateway API support, not yet wired into the
smgbinary)<details>
<summary>Checklist</summary>
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspasses</details>