-
Notifications
You must be signed in to change notification settings - Fork 51
feat(llm-request-router): add authority and SNI aware backend routing #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikeyrcamp
wants to merge
13
commits into
main
Choose a base branch
from
mcamp/feat/llm-router-per-pod-worker-access
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ee20415
feat(llm-request-router): add authority and SNI aware backend routing
mikeyrcamp 2fb91ae
feat(llm-request-router): enable backend routing with the LLM addon
mikeyrcamp 34529e0
fix(llm-request-router): validate certificate SANs against the PKI role
mikeyrcamp 7fa347a
fix(stargate): resolve image build labels
mikeyrcamp 2420ef4
fix(self-managed): bump llm request router chart
mikeyrcamp d664074
fix(self-managed): expose LLM worker gateway routes
mikeyrcamp 5c3461f
feat(ncp-local): expose LLM worker gateway listeners
mikeyrcamp 6813e1f
fix(self-managed): configure OpenBao for LLM PKI
mikeyrcamp ad665ec
fix(self-managed): preserve LLM migration flags
mikeyrcamp bba2398
fix(self-managed): pass LLM PKI domains to migrations
mikeyrcamp 998f491
fix(self-managed): allow api keys startup probe override
mikeyrcamp 8d3d43a
test(self-managed): support local LLM router chart
mikeyrcamp 2ea0f0c
test(self-managed): support local gateway routes chart
mikeyrcamp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
deploy/helm/gateway-routes/chart/templates/referencegrant-llm-worker.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| {{- if and .Values.nvcfGatewayRoutes.enabled .Values.nvcfGatewayRoutes.routes.llmWorker.enabled }} | ||
| {{- $backendNamespace := include "nvcf-gateway.llmWorkerBackendNamespace" . }} | ||
| apiVersion: gateway.networking.k8s.io/v1beta1 | ||
| kind: ReferenceGrant | ||
| metadata: | ||
| name: allow-llm-worker-routes | ||
| namespace: {{ $backendNamespace }} | ||
| labels: | ||
| {{- include "nvcf-gateway.labels" . | nindent 4 }} | ||
| spec: | ||
| from: | ||
| - group: gateway.networking.k8s.io | ||
| kind: TCPRoute | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmGrpc.namespace }} | ||
| - group: gateway.networking.k8s.io | ||
| kind: UDPRoute | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmQuic.namespace }} | ||
| to: | ||
| - group: "" | ||
| kind: Service | ||
| name: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.backend.name }} | ||
| {{- end }} |
28 changes: 28 additions & 0 deletions
28
deploy/helm/gateway-routes/chart/templates/tcproute-llm-worker.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| {{- if and .Values.nvcfGatewayRoutes.enabled .Values.nvcfGatewayRoutes.routes.llmWorker.enabled }} | ||
| {{- $backendNamespace := include "nvcf-gateway.llmWorkerBackendNamespace" . }} | ||
| apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
| kind: TCPRoute | ||
| metadata: | ||
| name: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.name }}-grpc | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmGrpc.namespace }} | ||
| labels: | ||
| {{- include "nvcf-gateway.labels" . | nindent 4 }} | ||
| app.kubernetes.io/component: llm-worker-grpc-route | ||
| {{- with .Values.nvcfGatewayRoutes.routes.llmWorker.routeAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| - name: {{ .Values.nvcfGatewayRoutes.gateways.llmGrpc.name }} | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmGrpc.namespace }} | ||
| sectionName: {{ .Values.nvcfGatewayRoutes.gateways.llmGrpc.listenerName }} | ||
| rules: | ||
| - backendRefs: | ||
| - name: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.backend.name }} | ||
| namespace: {{ $backendNamespace }} | ||
| port: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.backend.grpcPort }} | ||
| {{- end }} |
28 changes: 28 additions & 0 deletions
28
deploy/helm/gateway-routes/chart/templates/udproute-llm-worker.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| {{- if and .Values.nvcfGatewayRoutes.enabled .Values.nvcfGatewayRoutes.routes.llmWorker.enabled }} | ||
| {{- $backendNamespace := include "nvcf-gateway.llmWorkerBackendNamespace" . }} | ||
| apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
| kind: UDPRoute | ||
| metadata: | ||
| name: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.name }}-quic | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmQuic.namespace }} | ||
| labels: | ||
| {{- include "nvcf-gateway.labels" . | nindent 4 }} | ||
| app.kubernetes.io/component: llm-worker-quic-route | ||
| {{- with .Values.nvcfGatewayRoutes.routes.llmWorker.routeAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| - name: {{ .Values.nvcfGatewayRoutes.gateways.llmQuic.name }} | ||
| namespace: {{ .Values.nvcfGatewayRoutes.gateways.llmQuic.namespace }} | ||
| sectionName: {{ .Values.nvcfGatewayRoutes.gateways.llmQuic.listenerName }} | ||
| rules: | ||
| - backendRefs: | ||
| - name: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.backend.name }} | ||
| namespace: {{ $backendNamespace }} | ||
| port: {{ .Values.nvcfGatewayRoutes.routes.llmWorker.backend.quicPort }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
deploy/helm/gateway-routes/scripts/check-llm-worker-routes.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| chart_dir="${script_dir}/../chart" | ||
| rendered="$(mktemp)" | ||
| disabled="$(mktemp)" | ||
| trap 'rm -f "$rendered" "$disabled"' EXIT | ||
|
|
||
| helm template nvcf-gateway-routes "$chart_dir" \ | ||
| --namespace gateway \ | ||
| --set nvcfGatewayRoutes.routes.llmWorker.enabled=true \ | ||
| --set nvcfGatewayRoutes.gateways.llmGrpc.name=llm-grpc-gateway \ | ||
| --set nvcfGatewayRoutes.gateways.llmGrpc.namespace=gateway \ | ||
| --set nvcfGatewayRoutes.gateways.llmQuic.name=llm-quic-gateway \ | ||
| --set nvcfGatewayRoutes.gateways.llmQuic.namespace=gateway \ | ||
| --set nvcfGatewayRoutes.routes.llmWorker.backend.namespace=router-system \ | ||
| >"$rendered" | ||
|
|
||
| assert_contains() { | ||
| local pattern="$1" | ||
| local message="$2" | ||
| if ! grep -Fq -- "$pattern" "$rendered"; then | ||
| echo "FAIL: ${message}" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| assert_contains "kind: TCPRoute" \ | ||
| "LLM worker routing must expose gRPC registration over TCP" | ||
| assert_contains "kind: UDPRoute" \ | ||
| "LLM worker routing must expose reverse tunnels over UDP" | ||
| assert_contains "name: llm-request-router-backend-router" \ | ||
| "LLM worker routes must target the authority/SNI-aware backend router" | ||
| assert_contains "name: allow-llm-worker-routes" \ | ||
| "ReferenceGrant must permit cross-namespace LLM worker routes" | ||
| assert_contains "sectionName: llm-grpc" \ | ||
| "TCPRoute must attach to the configured LLM gRPC listener" | ||
| assert_contains "sectionName: llm-quic" \ | ||
| "UDPRoute must attach to the configured LLM QUIC listener" | ||
|
|
||
| reference_grant_service_name="$(awk ' | ||
| $0 == "kind: ReferenceGrant" { in_grant = 1; target_grant = 0; in_to = 0 } | ||
| in_grant && !target_grant && $1 == "name:" && $2 == "allow-llm-worker-routes" { target_grant = 1 } | ||
| target_grant && $0 == " to:" { in_to = 1 } | ||
| target_grant && in_to && $1 == "name:" { print $2; exit } | ||
| ' "$rendered")" | ||
| if [[ "$reference_grant_service_name" != "llm-request-router-backend-router" ]]; then | ||
| echo "FAIL: LLM worker ReferenceGrant must stay scoped to the configured backend Service" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| backend_namespace_references="$(grep -Fc -- "namespace: router-system" "$rendered")" | ||
| if [[ "$backend_namespace_references" != "3" ]]; then | ||
| echo "FAIL: LLM worker routes and ReferenceGrant must use the configured backend namespace" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if helm template nvcf-gateway-routes "$chart_dir" \ | ||
| --namespace gateway \ | ||
| --set nvcfGatewayRoutes.routes.llmWorker.enabled=true \ | ||
| --set-string nvcfGatewayRoutes.routes.llmWorker.backend.namespace= \ | ||
| >/dev/null 2>&1; then | ||
| echo "FAIL: enabled LLM worker routing must require an explicit backend namespace" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| helm template nvcf-gateway-routes "$chart_dir" \ | ||
| --namespace gateway \ | ||
| --set nvcfGatewayRoutes.routes.llmWorker.enabled=false \ | ||
| >"$disabled" | ||
|
|
||
| if grep -Eq '^ name: (llm-worker-(grpc|quic)|allow-llm-worker-routes)$' "$disabled"; then | ||
| echo "FAIL: disabled LLM worker routing must not render route resources" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "PASS: LLM worker Gateway routes render correctly" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
grep -Fcaborts the script before the diagnostic prints.grep -cexits with status 1 when the count is 0. Withset -e, the assignment on Line 56 then terminates the script, so the message on Line 58 never prints. A regression that drops the backend namespace fails with no explanation. Add|| true.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents