Skip to content

Commit 487036b

Browse files
committed
feat(helm): support agentgateway proxy in standalone service mode
Signed-off-by: satyamg1620 <Satyam.Gupta.3@ibm.com>
1 parent 04cc371 commit 487036b

5 files changed

Lines changed: 61 additions & 18 deletions

File tree

config/charts/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ helm install my-standalone-router ./config/charts/llm-d-router-standalone \
5252
--set router.proxy.mode=service \
5353
--set router.proxy.replicas=3
5454
```
55+
56+
Service mode works with `proxyType=agentgateway` too; add `--set router.proxy.mode=service` to the agentgateway install below to run the agentgateway proxy as its own service.
57+
5558
---
5659

5760
### 2. Gateway Mode (`llm-d-router-gateway`)
@@ -513,17 +516,17 @@ httpRoute:
513516

514517
### Standalone Mode Configuration
515518

516-
Configures EPP to run with a proxy (Envoy proxy or Agentgateway proxy) that intercepts and routes client traffic directly to model servers (exclusive to `llm-d-router-standalone`). The proxy runs as a sidecar in the EPP pod by default, or as a separate horizontally scalable service when `router.proxy.mode=service` (Envoy only).
519+
Configures EPP to run with a proxy (Envoy proxy or Agentgateway proxy) that intercepts and routes client traffic directly to model servers (exclusive to `llm-d-router-standalone`). The proxy runs as a sidecar in the EPP pod by default, or as a separate horizontally scalable service when `router.proxy.mode=service`.
517520

518521
#### Proxy Sidecar Parameters
519522

520523
| **Parameter Name** | **Description** | **Default** |
521524
| :--- | :--- | :--- |
522525
| `router.proxy.enabled` | Enable the proxy (Envoy or Agentgateway) in front of EPP. | `false` |
523526
| `router.proxy.proxyType` | Type of proxy. Options: `[envoy, agentgateway]`. | `envoy` |
524-
| `router.proxy.mode` | Proxy deployment mode. `sidecar` runs the proxy in the EPP pod; `service` runs it as its own horizontally scalable Deployment and Service reaching EPP over the EPP Service (Envoy only). | `sidecar` |
527+
| `router.proxy.mode` | Proxy deployment mode. `sidecar` runs the proxy in the EPP pod; `service` runs it as its own horizontally scalable Deployment and Service reaching EPP over the EPP Service. Supported for both Envoy and Agentgateway. | `sidecar` |
525528
| `router.proxy.replicas` | Replica count for the proxy Deployment when `mode=service`. | `2` |
526-
| `router.proxy.failOpen` | Whether the proxy passes traffic through (fail-open) when EPP is unreachable. | `true` |
529+
| `router.proxy.failOpen` | Whether the proxy passes traffic through (fail-open) when EPP is unreachable. Applies to `proxyType=envoy` only; Agentgateway exposes no fail-open setting and rejects requests (fails closed) when EPP is unreachable. | `true` |
527530
| `router.proxy.name` | Name of the sidecar container. | `""` |
528531
| `router.proxy.image` | Sidecar container image. | `""` |
529532
| `router.proxy.imagePullPolicy` | Sidecar container image pull policy. | `IfNotPresent` |

config/charts/llm-d-router-standalone/templates/_validations.tpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ standalone validations
3333
{{- if not $proxy.enabled -}}
3434
{{- fail ".Values.router.proxy.enabled must be true when .Values.router.proxy.mode=service" -}}
3535
{{- end -}}
36-
{{- $proxyType := default "envoy" ($proxy.proxyType | default "envoy") | lower -}}
37-
{{- if ne $proxyType "envoy" -}}
38-
{{- fail (printf ".Values.router.proxy.mode=service currently supports only proxyType=envoy, got %q" $proxyType) -}}
39-
{{- end -}}
4036
{{- $hasHTTP := false -}}
4137
{{- range $servicePort := (.Values.router.extraServicePorts | default (list)) -}}
4238
{{- if eq (toString (index $servicePort "name")) "http" -}}
@@ -62,7 +58,7 @@ standalone validations
6258
{{- $listenerPort := include "llm-d-router.standaloneProxyListenerPort" . -}}
6359
{{- $flags := .Values.router.epp.flags | default dict -}}
6460
{{- if and (hasKey $flags "secure-serving") (ne (toString (index $flags "secure-serving")) "false") -}}
65-
{{- fail ".Values.router.epp.flags.secure-serving must be false when proxyType=agentgateway; standalone agentgateway uses plaintext gRPC to EPP over localhost" -}}
61+
{{- fail ".Values.router.epp.flags.secure-serving must be false when proxyType=agentgateway; standalone agentgateway uses plaintext gRPC to EPP (over loopback in sidecar mode, or the EPP Service in service mode)" -}}
6662
{{- end -}}
6763
{{- end -}}
6864
{{- end -}}

config/charts/routerlib/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ binds:
415415
policies:
416416
inferenceRouting:
417417
endpointPicker:
418-
host: {{ printf "127.0.0.1:%v" (.Values.router.epp.extProcPort | default 9002) | quote }}
418+
host: {{ printf "%s:%v" (include "llm-d-router.proxy.extProcHost" .) (.Values.router.epp.extProcPort | default 9002) | quote }}
419419
destinationMode: passthrough
420420
services:
421421
- name: {{ $serviceName | quote }}

config/charts/routerlib/templates/_proxy-deployment.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{- define "llm-d-epp.proxy-deployment" -}}
22
{{- $proxy := include "llm-d-router.proxy" . | fromYaml | default dict -}}
3+
{{- $proxyType := include "llm-d-router.proxyType" . | trim -}}
4+
{{- $proxyConfigMap := index $proxy "configMap" | default dict -}}
5+
{{- $proxyConfigMapName := index $proxyConfigMap "name" | default "" -}}
36
{{- if and $proxy.enabled (eq (include "llm-d-router.proxyMode" .) "service") -}}
47
apiVersion: apps/v1
58
kind: Deployment
@@ -62,14 +65,31 @@ spec:
6265
resources:
6366
{{- toYaml . | nindent 12 }}
6467
{{- end }}
65-
{{- with $proxy.volumeMounts }}
68+
{{- if or (and (eq $proxyType "agentgateway") $proxyConfigMapName) $proxy.volumeMounts }}
6669
volumeMounts:
70+
{{- if and (eq $proxyType "agentgateway") $proxyConfigMapName }}
71+
- name: agentgateway-config-template
72+
mountPath: /config
73+
readOnly: true
74+
{{- end }}
75+
{{- with $proxy.volumeMounts }}
6776
{{- toYaml . | nindent 12 }}
77+
{{- end }}
6878
{{- end }}
69-
{{- with $proxy.volumes }}
79+
{{- if or (and (eq $proxyType "agentgateway") $proxyConfigMapName) $proxy.volumes }}
7080
volumes:
81+
{{- if and (eq $proxyType "agentgateway") $proxyConfigMapName }}
82+
- name: agentgateway-config-template
83+
configMap:
84+
name: {{ $proxyConfigMapName }}
85+
items:
86+
- key: config.yaml
87+
path: config.yaml
88+
{{- end }}
89+
{{- with $proxy.volumes }}
7190
{{- tpl (toYaml .) $ | nindent 8 }}
7291
{{- end }}
92+
{{- end }}
7393
---
7494
{{- end -}}
7595
{{- end -}}

hack/verify-helm.sh

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ test_cases_llm_d_router_standalone["latency-predictor"]="--set router.latencyPre
116116
test_cases_llm_d_router_standalone["llm-d-router-gateway"]="--set router.inferencePool.create=true --set router.modelServers.matchLabels.app=llm-instance-gateway"
117117
test_cases_llm_d_router_standalone["agentgateway"]="--set router.proxy.proxyType=agentgateway --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set 'router.modelServers.targetPorts[0].number=8000'"
118118
test_cases_llm_d_router_standalone["proxy-service"]="--set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set router.proxy.mode=service --set router.proxy.replicas=3"
119+
test_cases_llm_d_router_standalone["agentgateway-service"]="--set router.proxy.proxyType=agentgateway --set router.proxy.mode=service --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set 'router.modelServers.targetPorts[0].number=8000'"
119120
test_cases_llm_d_router_standalone["triton"]="--set router.modelServers.type=triton --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false"
120121

121122

@@ -190,13 +191,6 @@ if eval "${mismatched_agentgateway_listener_target_port_command}"; then
190191
exit 1
191192
fi
192193

193-
unsupported_proxy_service_agentgateway_command="${HELM} template ${SCRIPT_ROOT}/config/charts/llm-d-router-standalone --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set router.proxy.mode=service --set router.proxy.proxyType=agentgateway --set router.proxy.agentgateway.service.name=llm-instance-gateway --set 'router.proxy.agentgateway.service.ports[0]=8000' --set 'router.modelServers.targetPorts[0].number=8000' >/dev/null"
194-
echo "Executing: ${unsupported_proxy_service_agentgateway_command}"
195-
if eval "${unsupported_proxy_service_agentgateway_command}"; then
196-
echo "Helm template unexpectedly succeeded for proxy mode=service with proxyType=agentgateway"
197-
exit 1
198-
fi
199-
200194
invalid_failopen_command="${HELM} template ${SCRIPT_ROOT}/config/charts/llm-d-router-standalone --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set router.proxy.failOpen=notabool >/dev/null"
201195
echo "Executing: ${invalid_failopen_command}"
202196
if eval "${invalid_failopen_command}"; then
@@ -294,3 +288,33 @@ if ! grep -q -- 'llm-d-router-proxy: proxy-svc-proxy' "${proxy_service_render_ou
294288
echo "Proxy service mode did not render the dedicated proxy selector label"
295289
exit 1
296290
fi
291+
292+
echo "Verifying llm-d-router-standalone agentgateway in service mode reaches EPP over the Service..."
293+
agentgateway_service_mode_output="${TEMP_DIR}/llm-d-router-standalone-agentgateway-service-render.yaml"
294+
agentgateway_service_mode_command="${HELM} template ag-svc ${SCRIPT_ROOT}/config/charts/llm-d-router-standalone --namespace ag-ns --set router.proxy.proxyType=agentgateway --set router.proxy.mode=service --set router.modelServers.matchLabels.app=llm-instance-gateway --set router.inferencePool.create=false --set 'router.modelServers.targetPorts[0].number=8000' > ${agentgateway_service_mode_output}"
295+
echo "Executing: ${agentgateway_service_mode_command}"
296+
eval "${agentgateway_service_mode_command}"
297+
if ! grep -q -- 'name: ag-svc-proxy' "${agentgateway_service_mode_output}"; then
298+
echo "Agentgateway service mode did not render the separate proxy Deployment/Service named ag-svc-proxy"
299+
exit 1
300+
fi
301+
# The agentgateway container lives only in the standalone proxy Deployment, not the EPP pod.
302+
agentgateway_container_count=$(grep -c -- '- name: agentgateway-proxy$' "${agentgateway_service_mode_output}")
303+
if [ "${agentgateway_container_count}" -ne 1 ]; then
304+
echo "Agentgateway service mode rendered ${agentgateway_container_count} agentgateway-proxy containers, expected exactly 1 (in the proxy Deployment)"
305+
exit 1
306+
fi
307+
# endpointPicker must target the EPP Service FQDN, not loopback.
308+
if ! grep -q -- 'host: "ag-svc-epp.ag-ns.svc.cluster.local:9002"' "${agentgateway_service_mode_output}"; then
309+
echo "Agentgateway service mode did not point endpointPicker.host at the EPP Service FQDN"
310+
exit 1
311+
fi
312+
if grep -q -- 'host: "127.0.0.1:9002"' "${agentgateway_service_mode_output}"; then
313+
echo "Agentgateway service mode still points endpointPicker.host at loopback"
314+
exit 1
315+
fi
316+
# The agentgateway config must be mounted in the proxy Deployment.
317+
if ! grep -q -- 'agentgateway-config-template' "${agentgateway_service_mode_output}"; then
318+
echo "Agentgateway service mode did not mount the agentgateway config in the proxy Deployment"
319+
exit 1
320+
fi

0 commit comments

Comments
 (0)