Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/istio/gateway/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@ spec:
allowedRoutes:
namespaces:
from: All
- name: a2a-passthrough
hostname: '*.a2a-passthrough.127-0-0-1.sslip.io'
port: 8083
protocol: HTTP
allowedRoutes:
namespaces:
from: All
6 changes: 6 additions & 0 deletions config/istio/gateway/nodeport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ spec:
port: 8082
protocol: TCP
targetPort: 8082
- appProtocol: http
name: a2a-passthrough
nodePort: 30085
port: 8083
protocol: TCP
targetPort: 8083
selector:
gateway.networking.k8s.io/gateway-name: mcp-gateway
sessionAffinity: None
Expand Down
3 changes: 3 additions & 0 deletions config/kind/cluster-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ nodes:
- containerPort: 30084 # resources-federation listener
hostPort: 8012
protocol: TCP
- containerPort: 30085 # a2a-passthrough listener
hostPort: 8013
protocol: TCP
3 changes: 3 additions & 0 deletions config/kind/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ nodes:
- containerPort: 30084 # resources-federation listener
hostPort: 8012
protocol: TCP
- containerPort: 30085 # a2a-passthrough listener
hostPort: 8013
protocol: TCP
19 changes: 16 additions & 3 deletions docs/guides/a2a-passthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ route lives in a different namespace from the gateway (as below — the route is
the gateway in `gateway-system`), that listener must permit the route's namespace via its
`allowedRoutes.namespaces`, otherwise the gateway will not accept the route.

The router lifts the metadata but does **not** rewrite the path — carrying the request to the
agent is your route's job. The `/a2a/{agent}` prefix exists so the router can derive the agent
identity, but the agent itself serves its A2A endpoint at its own path (commonly `/a2a`). Unless
the agent happens to serve at the full `/a2a/{agent}` path, add a `URLRewrite` filter that
replaces the `/a2a/{agent}` prefix with the agent's endpoint, so the backend receives the path it
expects:
Comment thread
coderabbitai[bot] marked this conversation as resolved.

```bash
kubectl apply -f - <<'EOF'
apiVersion: gateway.networking.k8s.io/v1
Expand All @@ -85,6 +92,12 @@ spec:
- path:
type: PathPrefix
value: /a2a/weather
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: /a2a
backendRefs:
- name: weather-agent
port: 9090
Expand All @@ -100,9 +113,9 @@ kubectl get httproute weather-agent-route -n mcp-test \
```

A `SendMessage` to `/a2a/weather` now traverses the router — which sets
`x-a2a-agent: weather` and `x-a2a-method: SendMessage` — before your route forwards it to
the `weather-agent` backend. You can confirm the headers reach the agent by inspecting what
the agent received, or the access log configured in Step 4.
`x-a2a-agent: weather` and `x-a2a-method: SendMessage` — before your route rewrites the prefix
and forwards it to the `weather-agent` backend at `/a2a`. You can confirm the headers reach the
agent by inspecting what the agent received, or the access log configured in Step 4.

## Step 3: Authorize per agent

Expand Down
Loading
Loading