48 Commits

Author SHA1 Message Date
John Howard
4cf848a9e9
api: documented that backend MCP auth is deprecated (#1437)
The removals are deadcode, not API changes.
2026-04-07 16:28:07 -07:00
Ákos Tóth
0418247e7e
feat: add cacheMessageOffset to PromptCachingConfig (#1412)
Add `cacheMessageOffset` field to `PromptCachingConfig`. When set,
shifts the Bedrock message cache point further back from the default
second-to-last position.

- `cacheMessageOffset: 0` (default): no change in behavior
- `cacheMessageOffset: N`: cache point moves N additional messages
toward the start, clamped to bounds

This gives callers control over which portion of the conversation is
covered by the cache prefix — useful for agentic workloads where
mid-conversation compaction may mutate recent messages.

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-04-07 16:25:36 -07:00
John Howard
8b96e4da5c
controller: faster deployer tests (#1469)
With -race, this took 53s on my fast machine before. now it takes 3.

The problem was we parsed all CRDs each time, now we do it once (and
ruse more code)
2026-04-07 10:46:48 -07:00
Nina Polshakova
fff0ec3e85
Use agentgateway.dev annotations (#1439)
Clean up to remove kgateway.dev annotations, but keep backwards
compatibility.

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-04-02 12:37:23 -04:00
John Howard
8a08a7e431
api: do not allow invalid MCP policies (#1374)
This must be applied per virtual MCP group, not per individual target.
If set, today, these do absolutely nothing.
2026-04-01 08:17:06 -07:00
John Howard
f35f0f8f35
mcp authentication: move to route level (#1357)
Currently, mcpAuthentication is a backend level policy. This sort of
made sense at the time, as its only applicable for MCP, and "is MCP" is
a property of the backend. However, in practice this causes issues.

McpAuth is a glorified JWT validator with some additional special path
handling. One of the things you might want to use JWT/MCPAuth for is
apply other policies based on the claims. Authorization, rate limit,
transformations, etc
all based on the jwt claims are quite handy and common.

The alternative to this is to start copying every single policy to an
mcpXYZ policy which sucks.

----

This would be the first time the project faces a serious "deprecating an
API" so warrants some thinking. In this case I propose:
* The old backend policy is kept around in Kubernetes and marked as
deprecated. We can keep the field around for a very long time (forever?)
without too much burden on the project as its pretty much the same
translation regardless of where it is
* Standalone is not impacted; we already had users set it in the route
level and just translated it down to a backend policy.
* If a user sets both, we reject the backend one (TODO: this is not done
in this PR)
* If a user sets JWT and MCP auth, we prefer whichever is more precise.
(TODO: this is not done in this PR)

Fixes https://github.com/agentgateway/agentgateway/issues/870
2026-03-30 09:49:13 -07:00
John Howard
6081e848f3
mcp: allow explicit list of service refs (#1381)
Fixes https://github.com/agentgateway/agentgateway/issues/1222
2026-03-30 09:46:25 -07:00
John Howard
b440fb4d5e
Controller: refactor dead code and weird packages (#1375)
Lots of cruft cleanup from the old kgw integration.

fixes https://github.com/agentgateway/agentgateway/issues/1288
2026-03-27 13:16:29 -07:00
John Howard
4b673f7072
control: add failure mode to ext authz and remote Rl (#1270) 2026-03-26 15:07:52 -07:00
John Howard
b066230bd0
Add network authorization policy (#1363)
This policy is equivalent to the HTTP authorization policy but runs at
the L4 level. This means you can use it for non-HTTP traffic, and you
can layer it on top of HTTP traffic to have L4+L7 rules. For example,
you might deny banned CIDR ranges at L4 and then have L7 rules on top of
that.

These are independant rule sets, so an allow in L4 does not allow at L7.

The policy runs _after_ TLS handshake and de-tunneling. This ensures the
properties of the handshakes can be used in policy decision making. In
theory, you may want to block users earlier to avoid the cost of a TLS
handshake, but IMO this is the wrong tradeoff here; if you are trying to
prevent things like a DOS you want something at L3 in front of the
gateway that prevents the cost of the TCP handshake too.
2026-03-26 14:05:36 -07:00
Markus Kobler
3180560484
Add k8 support for setting a llm provider path prefix (#1365) 2026-03-26 14:58:44 -05:00
John Howard
e583eb5eba
authorization: add new Require mode (#1223)
`Deny` mode is a bad API with a useful goal: to ensure that policies
MUST match the rule, essentialy adding AND semantics on top of the ALLOW
policies OR semantics.

Deny is trick, because you often end up having double negatives.

For example `deny: !(port in [443, 8443])`. Or worse, somethign like
`deny: jwt.group != 'eng'`; if the jwt doesn't have a `group` this rule
will not deny.

Instead, this proposes adding a new Require mode which is like deny but
inverted.

The above rules would be `require: port in [443, 8443]` or `require:
jwt.group == 'eng'`.

These are useful for admin level rules that apply on top of user level
rules like `require: source.address not in [banned country cidr ranges]`
etc
2026-03-26 09:15:39 -07:00
John Howard
7d49605816
controller: better CRD documentation formatting (#1354)
Mostly putting things in proper code brackets
2026-03-25 14:38:22 -07:00
Rajat Vig
187abe26cf
feat(vertex): make region optional with global default (#1330)
- Handle 'global' region explicitly in get_host(), returning
aiplatform.googleapis.com instead of global-aiplatform.googleapis.com
- Make VertexAI Region field optional with default 'global' in CRD
- Add unit tests for get_host() covering all region cases

---------

Signed-off-by: Rajat Vig <rvig@etsy.com>
2026-03-24 16:57:01 +00:00
John Howard
f39623667f
cache validator in tests (#1290)
This makes tests drop from 3s to 1s in my env
2026-03-20 09:29:18 -07:00
apexlnc
5798b5acaf
mcp: harden fail-open degraded mode (#1232)
This hardens MCP degraded-mode behavior so multiplexed backends can keep
serving healthy targets without hanging, looping, or corrupting
resumable session state.

The original `failureMode` work was meant to cover three concrete
failure cases:
- `#1162`: zero-target MCP backends should not trap clients in a
reconnect loop
- `#1029`: `failOpen` should skip bad targets, but still fail if every
configured target is unusable
- `#962`: one bad upstream should not take down the rest of a
multiplexed MCP session

This change makes that behavior consistent across init, runtime fanout,
and session resume.

At init time, `failOpen` now allows partial success but still returns
`NoBackends` when all configured targets fail. Zero configured targets
remain a special case so we do not regress the zero-target handling
behind `#1162`. The `failureMode` setting is also threaded through the
controller, local config, schema, and MCP runtime so the configured
behavior is preserved end to end.

At runtime, multiplexed fanout now degrades correctly when individual
upstreams fail. That includes the legacy SSE path, which was the sharp
edge here: a dead legacy SSE transport could leave pending requests
orphaned and hang the whole downstream request. This change makes
wrapped transports fail pending work, fail fast once dead, and treat
dead legacy SSE upstreams as unavailable for the rest of that downstream
session instead of trying to silently rejoin mid-session. That keeps
healthy stdio, SSE, and streamable HTTP targets serving without
introducing questionable session semantics for non-resumable transports.

For resumable streamable HTTP MCP sessions, persisted upstream session
state is now keyed by target name. New session handles include an
optional target field, and resume restores by target identity instead of
positional zip. Old handles without target names still use the legacy
positional path, so existing session IDs remain readable. This avoids
misbinding persisted sessions when `failOpen` changes the initialized
target set.

Most of the diff is test coverage plus generated/schema updates from
wiring the config surface through. The behavior changes themselves are
concentrated in the MCP relay, upstream transport wrappers, and resume
logic.

Fixes #1162
Fixes #1029
Fixes #962

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-03-16 15:57:45 -07:00
Nina Polshakova
ab95c0233d
Add OTel access log config and fix initialization (#1182)
`SdkLoggerProvider` was getting created on every request then dropped.
This change stores it in AccessLogPolicy like we do with tracing and
reuses it.

Fixes logging dropping after each request:
```
2026-03-10T17:29:04.939310Z     info    opentelemetry_sdk               name="LoggerProvider.Drop""Last reference of LoggerProvider dropped, initiating shutdown."
```

Also adds controller api for OTel access logging, you can configure it
with a frontend AgentgatewayPolicy like this:
```
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
  name: agw-accesslog
  namespace: agentgateway-base
spec:
  targetRefs:
    - kind: Gateway
      name: gateway
      group: gateway.networking.k8s.io
  frontend:
    accessLog:
      otlp:
        backendRef:
          name: opentelemetry-collector
          namespace: default
          port: 4317
        protocol: GRPC
```

Updates the tracing e2e test to be shared with a new access log e2e test
under "otel". The new access log test exports to otel:
```
Attributes:
     -> gateway: Str(agentgateway-base/gateway)
     -> listener: Str(http)
     -> route: Str(agentgateway-base/httpbin-route-accesslog)
     -> endpoint: Str(10.244.0.8:80)
     -> src.addr: Str(127.0.0.1:38924)
     -> http.method: Str(GET)
     -> http.host: Str(www.example.com)
     -> http.path: Str(/status/200)
     -> http.version: Str(HTTP/1.1)
     -> http.status: Int(200)
     -> protocol: Str(http)
     -> duration: Str(0ms)
Trace ID:
Span ID:
Flags: 0
    {"resource": {"service.instance.id": "84b087fa-a32c-4986-8b7e-dc213d07451b", "service.name": "otelcol-contrib", "serv
ice.version": "0.143.0"}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs"
}
2026-03-11T17:49:58.623Z    info    Logs    {"resource": {"service.instance.id": "84b087fa-a32c-4986-8b7e-dc213d07451b",
"service.name": "otelcol-contrib", "service.version": "0.143.0"}, "otelcol.component.id": "debug", "otelcol.component.kin
d": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2026-03-11T17:49:58.623Z    info    ResourceLog #0
Resource SchemaURL:
Resource attributes:
     -> service.instance.id: Str(agentgateway~10.244.0.17~gateway-59dbf946f9-n2kvl.agentgateway-base~agentgateway-base.sv
c.cluster.local)
     -> service.version: Str(v0.6.0-1122-g49a81bd6d-dirty)
     -> telemetry.sdk.language: Str(rust)
     -> k8s.namespace.name: Str(agentgateway-base)
     -> service.name: Str(gateway)
     -> k8s.node.name: Str(gateway-59dbf946f9-n2kvl)
     -> k8s.pod.ip: Str(10.244.0.17)
     -> telemetry.sdk.name: Str(opentelemetry)
     -> k8s.pod.name: Str(gateway-59dbf946f9-n2kvl)
     -> service.namespace: Str(agentgateway-base)
     -> telemetry.sdk.version: Str(0.31.0)
     -> host.name: Str(gateway.agentgateway-base.svc.cluster.local)
ScopeLogs #0
ScopeLogs SchemaURL:
InstrumentationScope request
LogRecord #0
ObservedTimestamp: 2026-03-11 17:49:58.313535005 +0000 UTC
Timestamp: 1970-01-01 00:00:00 +0000 UTC
SeverityText: INFO
SeverityNumber: Info(9)
Body: Empty()
```

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-12 13:22:30 -04:00
Markus Kobler
b1bf8e1705
docs: cleanup more kgateway references (#1210) 2026-03-12 09:32:56 -07:00
John Howard
d60c7885ac
Add support for backend tunnel (CONNECT) (#1191)
Like https://github.com/agentgateway/agentgateway/pull/1185 but split
out some unrelated changes

This is like setting HTTP_PROXY=xyz but done with explicit policies not
implicit.

We support a subset of policies only on the tunnel connection: HTTP/1.1
only, authentication, and TLS.
2026-03-11 11:54:18 -07:00
Nina Polshakova
e88dfb4468
Add more eviction config (#1153)
Fixes: https://github.com/agentgateway/agentgateway/issues/1139 
- Adds e2e test for model failover eviction example 
- Adds fields for configuring active health check: 
- consecutiveFailures (count of how many unhealthyExpression before
evicting)
- restoreHealth (health score to set after expression becomes healthy
again)
- healthThreshold (EWMA (exponentially-weighted moving average) health
score threshold when a backend should get evicted)
- makes unhealthyExpression optional, defaults to unhealthy 4xx or 5xx
or connection failure lowering the health score
- maxEvictionPercent (maximum percentage (0–100) of backends in a
priority group that may be evicted simultaneously to prevent cascading
failures)
   - maxEjectionTime (upper bound on ejection time) 

**Testing consecutiveFailures:**
```
❯ cat config.yaml
binds:
- port: 3000
  listeners:
  - name: llm-failover
    protocol: HTTP
    routes:
    - backends:
      - ai:
          groups:
          # Priority 0 – primary: try OpenAI first
          - providers:
            - name: openai
              provider:
                openAI:
                  model: gpt-4
          # Priority 1 – fallback: local Llama via Ollama
          - providers:
            - name: llama
              hostOverride: "localhost:11434"
              pathOverride: /v1/chat/completions
              provider:
                openAI:
                  model: llama3.2
        policies:
          health:
            unhealthyExpression: "response.code >= 500"
            eviction:
               duration: 30s
               restoreHealth: 0
               # healthThreshold: 1.0 # if this is set, OR with consecutiveFailures
               consecutiveFailures: 3
      policies:
        backendAuth:
          key: "${OPENAI_API_KEY}"
```

Send requests:
```
❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
upstream call failed: Connect: Connection refused (os error 61)%

❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
upstream call failed: Connect: Connection refused (os error 61)%

❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
upstream call failed: Connect: Connection refused (os error 61)%

# third time's the charm
❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
{"model":"llama3.2","usage":{"prompt_tokens":31,"completion_tokens":3,"total_tokens":34},"choices":[{"message":{"content":"Hello!","role":"assistant"},"index":0,"finish_reason":"stop"}],"id":"chatcmpl-229","object":"chat.completion","created":1772829061,"system_fingerprint":"fp_ollama"}%
```

Logs:
```
=/v1/chat/completions http.version=HTTP/1.1 http.status=503 protocol=llm gen_ai.operation.name=chat gen_ai.provider.name=openai gen_ai.request.model=gpt-4 error="upstream call failed: Connect: Connection refused (os error 61)" reason=UpstreamFailure duration=175ms
2026-03-09T19:27:07.457590Z     info    request gateway=default/default listener=llm-failover route=default/route0 endpoint=api.openai.com:443 src.addr=[::1]:62045 http.method=POST http.host=localhost http.path=/v1/chat/completions http.version=HTTP/1.1 http.status=503 protocol=llm gen_ai.operation.name=chat gen_ai.provider.name=openai gen_ai.request.model=gpt-4 error="upstream call failed: Connect: Connection refused (os error 61)" reason=UpstreamFailure duration=0ms
2026-03-09T19:27:08.312409Z     info    request gateway=default/default listener=llm-failover route=default/route0 endpoint=api.openai.com:443 src.addr=[::1]:62047 http.method=POST http.host=localhost http.path=/v1/chat/completions http.version=HTTP/1.1 http.status=503 protocol=llm gen_ai.operation.name=chat gen_ai.provider.name=openai gen_ai.request.model=gpt-4 error="upstream call failed: Connect: Connection refused (os error 61)" reason=UpstreamFailure duration=0ms
2026-03-09T19:27:09.485435Z     info    request gateway=default/default listener=llm-failover route=default/route0 endpoint=localhost:11434 src.addr=[::1]:62049 http.method=POST http.host=localhost http.path=/v1/chat/completions http.version=HTTP/1.1 http.status=200 protocol=llm gen_ai.operation.name=chat gen_ai.provider.name=openai gen_ai.request.model=llama3.2 gen_ai.response.model=llama3.2 gen_ai.usage.input_tokens=31 gen_ai.usage.output_tokens=3 duration=159ms
```

With `restoreHealth: 1.0`
```
        policies:
          health:
            unhealthyExpression: "response.code >= 500"
            eviction:
               duration: 10s
               healthThreshold: .5
               restoreHealth: 1.0
```

```
# same as before, first three requests fails
curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""

curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""

curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""

# fourth request should succeed 
curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""

# Waiting 12s for uneviction 
sleep 12

# Phase 2: After uneviction (healthOnReturn=false → health still ~0.34) 

# expect: primary 503, health 0.34<0.5, IMMEDIATELY RE-EVICTED)
curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""

# expect: Ollama 200 
curl -s http://localhost:3000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"any","messages":[{"role":"user","content":"hello"}]}'
echo ""
```
Versus if `restoreHealth: 1.0`, then the proxy would allow three more
requests to the failing open ai endpoint before evicting.

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-10 09:46:01 -07:00
John Howard
af18183cf3
llm: add a new Detect mode for passthrough (#1051)
This introduces a new LLM route type, 'Detect'.

Detect is similar to passthrough, but we attempt to detect the
underlying type. This gives us the following types..

* Conversion: complete translation from X to Y. Highest risk since we
need to support every field. Full API support and reporting
* Native types: we passthrough X to X, but have native understanding of
it. Lower risk since we don't need to know about every field, only
things we need to process. Full API support and reporting
* Passthrough: raw passthrough. No API support or reporting at all, this
is mostly so you can easil;y hit unsupported endpoints on the same
backend
* Detect: passthrough the request as is **no matter what** (even invalid
json, invalid SSE, etc). Attempt to detect token usage stuff. Supports
rate limiting and reporting, but not request manipulation.

TODO: today we support `defaults` and `overrides`, but not `model`. we
should support all or none.
2026-03-10 07:41:29 -07:00
apexlnc
a2fa5061d4
controller: reconcile per-gateway session keys (#1160)
Move session key management into the controller-managed object set
instead of creating Secrets as a side effect of Helm value generation.

This makes the per-Gateway Secret the authoritative source of truth for
managed Gateways:
- build and append a managed Secret child object during post-processing
- watch Secret changes so Gateway reconciliation repairs drift and
deletion
- validate existing keys before reuse and generate deterministic test
keys
- reserve SESSION_KEY and SESSION_KEY_FILE in AGWP env for managed
Gateways
- prefer the mounted session key file over env and inline fallback in
the dataplane

Refresh deployer goldens and generated CRD/schema output.

Motivation for this is ergonomics for this :
https://github.com/agentgateway/agentgateway/pull/878
2026-03-10 00:02:27 +00:00
Nuno Anselmo
b18db6facb
Fix AgentgatewayPolicy CRD HostRewrite property (#1167)
Within the AgentgatewayPolicy CRD there is a bug with the HostRewrite
optional property.

It is simultaneously an `enum` for `Auto`/`None` and of type `object`
with a `mode` property, which are not simultaneously satisfiable.

I believe an adequate fix would be to just move the `enum` into the
`mode`, as it was probably just an indentation bug to begin with.

I'm not sure if there are any considerations to be had about
backwards-compability since, in this case, it goes from not working
(unsatisfiable constraints) to functional (at least on the CRD side).

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-03-09 17:01:26 -07:00
John Howard
f0268d6827
Use agentgateway name in api instead of kgw (#1158) 2026-03-06 10:27:51 -08:00
Nina Polshakova
39fa545663
Add cel-based eviction policy for backends (#1105)
Evict on 5xx / connection failure so the next request can fail over for
model failover.

Now with cel-based backend policy:
```
binds:
- port: 3000
  listeners:
  - name: llm-failover
    protocol: HTTP
    routes:
    - backends:
      - ai:
          groups:
          # Priority 0 – primary: try OpenAI first
          - providers:
            - name: openai
              provider:
                openAI:
                  model: gpt-4
          # Priority 1 – fallback: local Llama via Ollama
          - providers:
            - name: llama
              hostOverride: "localhost:11434"
              pathOverride: /v1/chat/completions
              provider:
                openAI:
                  model: llama3.2
        policies:
          health:
            unhealthyExpression: "response.code >= 500"
            eviction:
               duration: 30s
      policies:
        backendAuth:
          key: "${OPENAI_API_KEY}"
```

Currently, the behavior will still allow the first request to fail, but
then the second request will use the failover provider:
```
# error first time
❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
upstream call failed: Connect: Connection refused (os error 61)%                                                                  

# now failover to local model
❯ curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
{"model":"llama3.2","usage":{"prompt_tokens":31,"completion_tokens":3,"total_tokens":34},"choices":[{"message":{"content":"Hello!","role":"assistant"},"index":0,"finish_reason":"stop"}],"id":"chatcmpl-498","object":"chat.completion","created":1772382504,"system_fingerprint":"fp_ollama"}%   
```

Fixes: https://github.com/kgateway-dev/kgateway/issues/13216

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-06 06:22:18 -08:00
Christian Posta
408a09c860
Add aws backend (#1126)
To support various AWS native calls, such as agentcore in this PR.
2026-03-05 10:58:29 -08:00
John Howard
ada67a32ca
Add transformation metadata support (#1130)
Fixes https://github.com/agentgateway/agentgateway/issues/1109
2026-03-05 08:29:43 -08:00
John Howard
15a2749a2a
Add missing enum to AGW policy (#1129) 2026-03-04 15:19:50 -08:00
Nina Polshakova
72febeed94
Clean up kgateway-system names, add unit test (#1120)
- updates kgateway-system -> agentgateway-system in dev docs and unit
tests
- adds unit tests for backend AgentgatewayPolicy with multiple
targetRefs

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-04 10:53:38 -08:00
John Howard
cde3b1b3fb
Gateway API v1.5.0 (#1068) 2026-03-02 16:41:24 -08:00
John Howard
69e597fe1f
Improvements to tracing and logging config (#1093)
Part of https://github.com/agentgateway/agentgateway/issues/1078

* Deprecate `config.logging` and `config.tracing` which has been
superseded by frontendPolicies
* Remove reading of those, instead convert to frontendPolicies in local
config processing
* Support path in tracing
* Move MCP to the unified tracing config (for frontendPolicies support)
* Add support to add headers on the backend request

Pulls in part of https://github.com/agentgateway/agentgateway/pull/765/
(the MCP part only; that PR has more)
2026-03-02 13:54:36 -08:00
Yossi Mesika
657bcfeb18
Provide Istio mesh config to XDS builder (#1086)
Workloads currently don't have a trust domain set. This results in the
data plane falling back to using `cluster.local` as the trust domain.
Setting Istio to use a different trust domain didn't affect the
Workloads.

The PR is basically replacing the dummy empty mesh config with the real
Istio one (if exists) and by that causing the builder to set the
workloads with the trust domain from the Istio Mesh Config.

This PR replaces https://github.com/agentgateway/agentgateway/pull/1064
following important
[comment](https://github.com/agentgateway/agentgateway/pull/1064#issuecomment-3967999405).
2026-03-02 08:09:59 -08:00
David L. Chandler
b2f5ab6d52
Revert "fix: Overlays can delete map elements with 'null'" (#1079)
Reverts agentgateway/agentgateway#1065 because the unittests didn't use
a real k8s API server. A real k8s rejects any CRD that attempts to use a
null map value, and you cannot easily change the CRD because
controller-tools is opinionated about that. I don't want to add new
'remove' APIs for this edge case or kustomize a CRD.
2026-02-27 11:20:43 -08:00
David L. Chandler
dabab1f08c
fix: Overlays can delete map elements with 'null' (#1065)
Fixes a TODO:
```
    metadata:
      labels:
        # You'd think this would remove the app.kubernetes.io/instance label,
        # but it just sets the label to the empty string. TODO(chandler):
        # Figure out the incantation to cause removal of the label.
        app.kubernetes.io/instance: null
```

---------

Signed-off-by: David L. Chandler <david.chandler@solo.io>
2026-02-26 13:32:27 -08:00
John Howard
189d9acfc0
llm: add new transformation policy for LLM request (#1041)
This lets you write policies on the LLM request directly. For example:

```yaml
transformation:
  max_tokens: min(llmRequest.max_tokens, 1024) # I am cheap, don't let my users burn tokens
```
2026-02-25 07:51:51 -08:00
John Howard
2ac141f36d
crd gen: add some additional markers (#1019)
Fixes https://github.com/agentgateway/agentgateway/issues/985

This fixes a few bugs that were caused by the lack of these
2026-02-23 10:04:02 -08:00
John Howard
60cc68877d
Add Agentgateway Azure Backend Auth (#1016)
Port https://github.com/kgateway-dev/kgateway/pull/13264/

Co-authored-by: Mitch Connors <mitchconnors@gmail.com>

Co-authored-by: Mitch Connors <mitchconnors@gmail.com>
2026-02-19 08:48:18 -08:00
John Howard
73c7e29604
controller: if there are no listeners, deploy a dummy port (#988)
gateway api is going to make listener optional:
https://github.com/kubernetes-sigs/gateway-api/issues/4425. The problem
is, if you go 0 listeners, the service is invalid. Worse, if you go
0->1->0 we would lose the service IP!

So we put a dummy one.
2026-02-19 08:28:53 -08:00
Kristin Brown
02b8450099
Link fixes (#1005)
Updating links in the docs and found some issues with links in the
auto-generated reference docs from this repo. Thanks!

Signed-off-by: Kristin Brown <kristin.brown@solo.io>
2026-02-18 19:13:02 +00:00
John Howard
fcc8d5c6fe
mcp auth: default to strict (#997)
'optional' mode is near useless here, since the whole point of mcp auth
is to force the client to do an oauth flow. Without a 401, they don't.
2026-02-17 14:46:05 -08:00
Nina Polshakova
f1b238e8d4
Add more kgateway pieces (#968)
Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-02-16 08:05:34 -08:00
Nina Polshakova
e694d70386
Control plane: guardrail policies (#952)
Adds Bedrock Guardrails and Google Model Armor to AI AgentgatewayPolicy.

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-02-13 12:20:57 -08:00
John Howard
e343ebed2f
Run e2e tests in CI (#938) 2026-02-12 09:52:06 -08:00
John Howard
ff94b54974
Cherrypick HPA/PDB RBAC fix (#939)
https://github.com/agentgateway/agentgateway/issues/908
2026-02-11 09:59:24 -08:00
Nina Polshakova
aefb466b19
Makefile fixes in controller (#931)
The release workflow now publishes the controller package too. Tested it
on my fork: https://github.com/npolshakova/agentgateway/packages

Currently tested:
- [x] make generate-all
- [x] make analyze
- [x] make fmt
- [x] make unit - passing
- [x] make run 
- [x] make package-agentgateway-charts
- [x] make kind-build-and-load 
- [x]  make kind-load-agentgateway

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-02-11 08:23:27 -08:00
Copilot
326e04d191
Add PreRouting phase support for authentication policies (#934)
JWT, BasicAuthentication, and APIKeyAuthentication policies were
ignoring the `phase` parameter. The data plane already supports these at
gateway level, but the control plane wasn't threading the phase
information through.

## Changes

- **Validation rule**: Updated to allow `jwtAuthentication`,
`basicAuthentication`, and `apiKeyAuthentication` in PreRouting phase
alongside existing policies (extAuth, transformation, extProc)

- **Policy processing**: Added `policyPhase` parameter to
`processJWTAuthenticationPolicy`, `processBasicAuthenticationPolicy`,
and `processAPIKeyAuthenticationPolicy` functions. Each now calls
`phase(policyPhase)` when building the TrafficPolicySpec.

- **Translation layer**: Updated `translateTrafficPolicyToAgw` to pass
`traffic.Phase` to all three authentication policy processors.

## Example

```yaml
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
spec:
  targetRefs:
  - kind: Gateway
    name: my-gateway
  traffic:
    phase: PreRouting  # Now respected by auth policies
    jwtAuthentication:
      mode: Strict
      providers: [...]
```

The phase now correctly propagates: `PreRouting` → `GATEWAY` in the
proto output.

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `cgr.dev`
> - Triggering command: `/usr/libexec/docker/cli-plugins/docker-buildx
/usr/libexec/docker/cli-plugins/docker-buildx buildx build --build-arg
VERSION=eaeb1fb-dirty --build-arg
GIT_REVISION=eaeb1fb553685bc5442de8bf8b2e08149edd4993 -t
ghcr.io/agentgateway/agentgateway:eaeb1fb-dirty . --progress=plain
0.1-go1.25.1.lin/tmp/cc60Bcwp.o -ato -bool t
rg/toolchain@v0.0.1-go1.25.1.linux-amd64/pkg/tool/linux_amd64/compile
-errorsas -ifaceassert t
rg/toolchain@v0.0.1-go1.25.1.lin/tmp/ccQMzFBl.o` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/agentgateway/agentgateway/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Some pre routing policies are missing control plane
support</issue_title>
> <issue_description>in the traffic policies implementation, we ignore
the phase for some policies. We need this for any that support being pre
routing. I know jwt has this issue but there may be some others
too</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes agentgateway/agentgateway#933

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for
you](https://github.com/agentgateway/agentgateway/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-02-11 06:58:07 -08:00
John Howard
c2ea90ed08 Various repo cleanups and re-organization 2026-02-10 10:22:51 -08:00
John Howard
085f54292b Move controller to controller/ 2026-02-09 16:20:45 -08:00