Compare commits

..

143 Commits

Author SHA1 Message Date
Rajat Vig
34871c59e3
fix: handle missing fields in Vertex AI Gemini completions responses (#1465)
## Summary
Gemini's OpenAI-compatible endpoint intermittently omits `message` from
choices and `completion_tokens`/`prompt_tokens` from usage. Add instead
of returning 503. Follows the same pattern as #977.

- Add `#[serde(default)]` to `Choice.message` and `Usage` token count
fields in `completions.rs`
- Derive `Default` on `ResponseMessage` and `Usage` so missing fields
deserialize to zero/empty values
- Add test that verifies deserialization succeeds when Gemini omits
these fields

Fixes #1464

---------

Signed-off-by: Rajat Vig <rvig@etsy.com>
2026-04-08 14:22:24 -07:00
Filinto Duran
0d4b0a9f90
fix(openai): passthrough responses input (#1454)
Problem:

without this relaxation passthrough openai through agw would fail on the
second and subsequent requests

## Summary

- Use raw JSON (`serde_json::Value`) for Responses API input items so
assistant
history and unknown item types (e.g. `phase`, `refusal`) pass through
without
    deserialization failure
- Best-effort message extraction for policies/token counting still works
via
`RawInputItem::as_simple_message()`; strict validation deferred to
provider
    or Bedrock conversion layer
2026-04-08 14:12:06 -07:00
dependabot[bot]
b7bb1a5a7c
build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp from 0.14.0 to 0.19.0 in the go_modules group across 1 directory (#1495)
Bumps the go_modules group with 1 update in the / directory:
[go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp](https://github.com/open-telemetry/opentelemetry-go).

Updates `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`
from 0.14.0 to 0.19.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/open-telemetry/opentelemetry-go/releases">go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp's
releases</a>.</em></p>
<blockquote>
<h2>Release v0.19.0</h2>
<h3>Added</h3>
<ul>
<li>Added <code>Marshaler</code> config option to <code>otlphttp</code>
to enable otlp over json or protobufs. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1586">#1586</a>)</li>
<li>A <code>ForceFlush</code> method to the
<code>&quot;go.opentelemetry.io/otel/sdk/trace&quot;.TracerProvider</code>
to flush all registered <code>SpanProcessor</code>s. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1608">#1608</a>)</li>
<li>Added <code>WithSampler</code> and <code>WithSpanLimits</code> to
tracer provider. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1633">#1633</a>,
<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1702">#1702</a>)</li>
<li><code>&quot;go.opentelemetry.io/otel/trace&quot;.SpanContext</code>
now has a <code>remote</code> property, and <code>IsRemote()</code>
predicate, that is true when the <code>SpanContext</code> has been
extracted from remote context data. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1701">#1701</a>)</li>
<li>A <code>Valid</code> method to the
<code>&quot;go.opentelemetry.io/otel/attribute&quot;.KeyValue</code>
type. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1703">#1703</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li><code>trace.SpanContext</code> is now immutable and has no exported
fields. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1573">#1573</a>)
<ul>
<li><code>trace.NewSpanContext()</code> can be used in conjunction with
the <code>trace.SpanContextConfig</code> struct to initialize a new
<code>SpanContext</code> where all values are known.</li>
</ul>
</li>
<li>Update the <code>ForceFlush</code> method signature to the
<code>&quot;go.opentelemetry.io/otel/sdk/trace&quot;.SpanProcessor</code>
to accept a <code>context.Context</code> and return an error. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1608">#1608</a>)</li>
<li>Update the <code>Shutdown</code> method to the
<code>&quot;go.opentelemetry.io/otel/sdk/trace&quot;.TracerProvider</code>
return an error on shutdown failure. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1608">#1608</a>)</li>
<li>The SimpleSpanProcessor will now shut down the enclosed
<code>SpanExporter</code> and gracefully ignore subsequent calls to
<code>OnEnd</code> after <code>Shutdown</code> is called. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1612">#1612</a>)</li>

<li><code>&quot;go.opentelemetry.io/sdk/metric/controller.basic&quot;.WithPusher</code>
is replaced with <code>WithExporter</code> to provide consistent naming
across project. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1656">#1656</a>)</li>
<li>Added non-empty string check for trace <code>Attribute</code> keys.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1659">#1659</a>)</li>
<li>Add <code>description</code> to SpanStatus only when
<code>StatusCode</code> is set to error. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1662">#1662</a>)</li>
<li>Jaeger exporter falls back to <code>resource.Default</code>'s
<code>service.name</code> if the exported Span does not have one. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1673">#1673</a>)</li>
<li>Jaeger exporter populates Jaeger's Span Process from Resource. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1673">#1673</a>)</li>
<li>Renamed the <code>LabelSet</code> method of
<code>&quot;go.opentelemetry.io/otel/sdk/resource&quot;.Resource</code>
to <code>Set</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1692">#1692</a>)</li>
<li>Changed <code>WithSDK</code> to <code>WithSDKOptions</code> to
accept variadic arguments of <code>TracerProviderOption</code> type in
<code>go.opentelemetry.io/otel/exporters/trace/jaeger</code> package.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1693">#1693</a>)</li>
<li>Changed <code>WithSDK</code> to <code>WithSDKOptions</code> to
accept variadic arguments of <code>TracerProviderOption</code> type in
<code>go.opentelemetry.io/otel/exporters/trace/zipkin</code> package.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1693">#1693</a>)</li>

<li><code>&quot;go.opentelemetry.io/otel/sdk/resource&quot;.NewWithAttributes</code>
will now drop any invalid attributes passed. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1703">#1703</a>)</li>

<li><code>&quot;go.opentelemetry.io/otel/sdk/resource&quot;.StringDetector</code>
will now error if the produced attribute is invalid. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1703">#1703</a>)</li>
</ul>
<h3>Removed</h3>
<ul>
<li>Removed <code>serviceName</code> parameter from Zipkin exporter and
uses resource instead. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1549">#1549</a>)</li>
<li>Removed <code>WithConfig</code> from tracer provider to avoid
overriding configuration. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1633">#1633</a>)</li>
<li>Removed the exported <code>SimpleSpanProcessor</code> and
<code>BatchSpanProcessor</code> structs.
These are now returned as a SpanProcessor interface from their
respective constructors. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1638">#1638</a>)</li>
<li>Removed <code>WithRecord()</code> from <code>trace.SpanOption</code>
when creating a span. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1660">#1660</a>)</li>
<li>Removed setting status to <code>Error</code> while recording an
error as a span event in <code>RecordError</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1663">#1663</a>)</li>
<li>Removed <code>jaeger.WithProcess</code> configuration option. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1673">#1673</a>)</li>
<li>Removed <code>ApplyConfig</code> method from
<code>&quot;go.opentelemetry.io/otel/sdk/trace&quot;.TracerProvider</code>
and the now unneeded <code>Config</code> struct. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1693">#1693</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Jaeger Exporter: Ensure mapping between OTEL and Jaeger span data
complies with the specification. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1626">#1626</a>)</li>
<li><code>SamplingResult.TraceState</code> is correctly propagated to a
newly created span's <code>SpanContext</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1655">#1655</a>)</li>
<li>The <code>otel-collector</code> example now correctly flushes metric
events prior to shutting down the exporter. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1678">#1678</a>)</li>
<li>Do not set span status message in
<code>SpanStatusFromHTTPStatusCode</code> if it can be inferred from
<code>http.status_code</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1681">#1681</a>)</li>
<li>Synchronization issues in global trace delegate implementation. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1686">#1686</a>)</li>
<li>Reduced excess memory usage by global <code>TracerProvider</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1687">#1687</a>)</li>
</ul>
<hr />
<h2>Raw changes made between v0.18.0 and v0.19.0</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md">go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp's
changelog</a>.</em></p>
<blockquote>
<h2>[1.43.0/0.65.0/0.19.0] 2026-04-02</h2>
<h3>Added</h3>
<ul>
<li>Add <code>IsRandom</code> and <code>WithRandom</code> on
<code>TraceFlags</code>, and <code>IsRandom</code> on
<code>SpanContext</code> in <code>go.opentelemetry.io/otel/trace</code>
for <a
href="https://www.w3.org/TR/trace-context-2/#random-trace-id-flag">W3C
Trace Context Level 2 Random Trace ID Flag</a> support. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8012">#8012</a>)</li>
<li>Add service detection with <code>WithService</code> in
<code>go.opentelemetry.io/otel/sdk/resource</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/7642">#7642</a>)</li>
<li>Add <code>DefaultWithContext</code> and
<code>EnvironmentWithContext</code> in
<code>go.opentelemetry.io/otel/sdk/resource</code> to support plumbing
<code>context.Context</code> through default and environment detectors.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8051">#8051</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Support attributes with empty value (<code>attribute.EMPTY</code>)
in
<code>go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Add support for per-series start time tracking for cumulative
metrics in <code>go.opentelemetry.io/otel/sdk/metric</code>.
Set <code>OTEL_GO_X_PER_SERIES_START_TIMESTAMPS=true</code> to enable.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8060">#8060</a>)</li>
<li>Add <code>WithCardinalityLimitSelector</code> for metric reader for
configuring cardinality limits specific to the instrument kind. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/7855">#7855</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Introduce the <code>EMPTY</code> Type in
<code>go.opentelemetry.io/otel/attribute</code> to reflect that an empty
value is now a valid value, with <code>INVALID</code> remaining as a
deprecated alias of <code>EMPTY</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
<li>Improve slice handling in
<code>go.opentelemetry.io/otel/attribute</code> to optimize short slice
values with fixed-size fast paths. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8039">#8039</a>)</li>
<li>Improve performance of span metric recording in
<code>go.opentelemetry.io/otel/sdk/trace</code> by returning early if
self-observability is not enabled. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8067">#8067</a>)</li>
<li>Improve formatting of metric data diffs in
<code>go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest</code>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8073">#8073</a>)</li>
</ul>
<h3>Deprecated</h3>
<ul>
<li>Deprecate <code>INVALID</code> in
<code>go.opentelemetry.io/otel/attribute</code>. Use <code>EMPTY</code>
instead. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8038">#8038</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Return spec-compliant <code>TraceIdRatioBased</code> description.
This is a breaking behavioral change, but it is necessary to
make the implementation <a
href="https://opentelemetry.io/docs/specs/otel/trace/sdk/#traceidratiobased">spec-compliant</a>.
(<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8027">#8027</a>)</li>
<li>Fix a race condition in
<code>go.opentelemetry.io/otel/sdk/metric</code> where the lastvalue
aggregation could collect the value 0 even when no zero-value
measurements were recorded. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8056">#8056</a>)</li>
<li>Limit HTTP response body to 4 MiB in
<code>go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp</code>
to mitigate excessive memory usage caused by a misconfigured or
malicious server.
Responses exceeding the limit are treated as non-retryable errors. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8108">#8108</a>)</li>
<li>Limit HTTP response body to 4 MiB in
<code>go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp</code>
to mitigate excessive memory usage caused by a misconfigured or
malicious server.
Responses exceeding the limit are treated as non-retryable errors. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8108">#8108</a>)</li>
<li>Limit HTTP response body to 4 MiB in
<code>go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp</code>
to mitigate excessive memory usage caused by a misconfigured or
malicious server.
Responses exceeding the limit are treated as non-retryable errors. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8108">#8108</a>)</li>
<li><code>WithHostID</code> detector in
<code>go.opentelemetry.io/otel/sdk/resource</code> to use full path for
<code>kenv</code> command on BSD. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8113">#8113</a>)</li>
<li>Fix missing <code>request.GetBody</code> in
<code>go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp</code>
to correctly handle HTTP2 GOAWAY frame. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/8096">#8096</a>)</li>
</ul>
<h2>[1.42.0/0.64.0/0.18.0/0.0.16] 2026-03-06</h2>
<h3>Added</h3>
<ul>
<li>Add <code>go.opentelemetry.io/otel/semconv/v1.40.0</code> package.
The package contains semantic conventions from the <code>v1.40.0</code>
version of the OpenTelemetry Semantic Conventions.
See the <a
href="https://github.com/open-telemetry/opentelemetry-go/blob/main/semconv/v1.40.0/MIGRATION.md">migration
documentation</a> for information on how to upgrade from
<code>go.opentelemetry.io/otel/semconv/v1.39.0</code>. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/7985">#7985</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2b4fa9681b"><code>2b4fa96</code></a>
Release v0.19.0 (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1710">#1710</a>)</li>
<li><a
href="4beb70416e"><code>4beb704</code></a>
sdk/trace: removing ApplyConfig and Config (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1693">#1693</a>)</li>
<li><a
href="1d42be1601"><code>1d42be1</code></a>
Rename WithDefaultSampler TracerProvider option to WithSampler and
update doc...</li>
<li><a
href="860d5d86e7"><code>860d5d8</code></a>
Add flag to determine whether SpanContext is remote (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1701">#1701</a>)</li>
<li><a
href="0fe65e6bd2"><code>0fe65e6</code></a>
Comply with OpenTelemetry attributes specification (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1703">#1703</a>)</li>
<li><a
href="888843519d"><code>8888435</code></a>
Bump google.golang.org/api from 0.40.0 to 0.41.0 in
/exporters/trace/jaeger (...</li>
<li><a
href="345f264a13"><code>345f264</code></a>
breaking(zipkin): removes servicName from zipkin exporter. (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1697">#1697</a>)</li>
<li><a
href="62cbf0f240"><code>62cbf0f</code></a>
Populate Jaeger's Span.Process from Resource (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1673">#1673</a>)</li>
<li><a
href="28eaaa9a91"><code>28eaaa9</code></a>
Add a test to prove the Tracer is safe for concurrent calls (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1665">#1665</a>)</li>
<li><a
href="8b1be11a54"><code>8b1be11</code></a>
Rename resource pkg label vars and methods (<a
href="https://redirect.github.com/open-telemetry/opentelemetry-go/issues/1692">#1692</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/open-telemetry/opentelemetry-go/compare/v0.14.0...v0.19.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp&package-manager=go_modules&previous-version=0.14.0&new-version=0.19.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 13:03:27 -07:00
markdingram-anaplan
39c98f335b
feat: support OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES env vars (#1452)
- slight tweak of #1396 

- check xds address is set before overwriting env var values, otherwise
OTEL_SERVICE_NAME & OTEL_RESOURCE_ATTRIBUTES values are overidden with
"default" -
<cf5ade8a49/crates/agentgateway/src/config.rs (L84)>
2026-04-08 12:10:29 -07:00
Steven Landow
edbb343c98
allow expanding references in traffic plugin (#1482)
Allow plugins which resolve policy targets to expand a single
group+kind+section to expand to multiple actual targets in terms of
proxy configuration.
2026-04-08 10:53:33 -07:00
Rajat Vig
a9491f891a
test: add MCP level tests for extauth and ratelimit policies (#1421)
## Summary
- Adds `mcp_local_ratelimit` test to verify local rate limiting works
with MCP backends
- Adds `mcp_extauth_deny` test to verify external authorization denial
works with MCP backends
- Adds `mcp_remote_ratelimit_deny` test to verify remote rate limiting
works with MCP backends

All three tests use mock gRPC servers where applicable and validate that
policy enforcement correctly propagates through the MCP protocol layer.

Closes #554

---------

Signed-off-by: Rajat Vig <rvig@etsy.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: John Howard <john.howard@solo.io>
2026-04-08 09:10:21 -07:00
John Howard
ee83b193f7
fixup release post-blacksmith (#1493)
Release failed due to the blacksmith auto-migration not properly
handling our matrix
2026-04-08 08:02:04 -07:00
Copilot
0b1cb95c9d
restrict nightly workflow to upstream repo only (#1466)
The nightly release workflow runs on forks, which is unnecessary and can
cause failures due to missing secrets/permissions.

## Changes

- **`.github/workflows/nightly.yml`**: Add `if: github.repository ==
'agentgateway/agentgateway'` to the `prepare` job, gating the entire
workflow since `release` depends on `prepare`.

```yaml
prepare:
  if: github.repository == 'agentgateway/agentgateway'
  runs-on: ubuntu-24.04
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-04-08 06:21:06 -07:00
John Howard
ac0005fb0d
mcp: omit expected 405 error logs (#1484)
Ref https://github.com/agentgateway/agentgateway/issues/1475
2026-04-08 06:20:43 -07:00
dependabot[bot]
ead514fffd
build(deps): bump the npm_and_yarn group across 1 directory with 2 updates (#1489)
Bumps the npm_and_yarn group with 2 updates in the /ui directory:
[@hono/node-server](https://github.com/honojs/node-server) and
[hono](https://github.com/honojs/hono).

Updates `@hono/node-server` from 1.19.10 to 1.19.13
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/honojs/node-server/releases"><code>@​hono/node-server</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v1.19.13</h2>
<h2>Security Fix</h2>
<p>Fixed an issue in Serve Static Middleware where inconsistent handling
of repeated slashes (<code>//</code>) between the router and static file
resolution could allow middleware to be bypassed. Users of Serve Static
Middleware are encouraged to upgrade to this version.</p>
<p>See GHSA-92pp-h63x-v22m for details.</p>
<h2>v1.19.12</h2>
<h2>What's Changed</h2>
<ul>
<li>chore: ignore claude setting by <a
href="https://github.com/yusukebe"><code>@​yusukebe</code></a> in <a
href="https://redirect.github.com/honojs/node-server/pull/314">honojs/node-server#314</a></li>
<li>fix: request draining for early 413 responses by <a
href="https://github.com/usualoma"><code>@​usualoma</code></a> in <a
href="https://redirect.github.com/honojs/node-server/pull/329">honojs/node-server#329</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/honojs/node-server/compare/v1.19.11...v1.19.12">https://github.com/honojs/node-server/compare/v1.19.11...v1.19.12</a></p>
<h2>v1.19.11</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: do not overwrite Content-Length in the fast path pattern if
Content-Length already exists. by <a
href="https://github.com/usualoma"><code>@​usualoma</code></a> in <a
href="https://redirect.github.com/honojs/node-server/pull/309">honojs/node-server#309</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/honojs/node-server/compare/v1.19.10...v1.19.11">https://github.com/honojs/node-server/compare/v1.19.10...v1.19.11</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fd64e659a3"><code>fd64e65</code></a>
1.19.13</li>
<li><a
href="025c30f55d"><code>025c30f</code></a>
Merge commit from fork</li>
<li><a
href="6cdb5a7249"><code>6cdb5a7</code></a>
1.19.12</li>
<li><a
href="70250f780e"><code>70250f7</code></a>
fix: request draining for early 413 responses (<a
href="https://redirect.github.com/honojs/node-server/issues/329">#329</a>)</li>
<li><a
href="cfc08b330a"><code>cfc08b3</code></a>
chore: ignore claude setting (<a
href="https://redirect.github.com/honojs/node-server/issues/314">#314</a>)</li>
<li><a
href="ecd4d6be55"><code>ecd4d6b</code></a>
1.19.11</li>
<li><a
href="c94489955e"><code>c944899</code></a>
fix: do not overwrite Content-Length in the fast path pattern if
Content-Leng...</li>
<li>See full diff in <a
href="https://github.com/honojs/node-server/compare/v1.19.10...v1.19.13">compare
view</a></li>
</ul>
</details>
<br />

Updates `hono` from 4.12.7 to 4.12.12
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/honojs/hono/releases">hono's
releases</a>.</em></p>
<blockquote>
<h2>v4.12.12</h2>
<h2>Security fixes</h2>
<p>This release includes fixes for the following security issues:</p>
<h3>Middleware bypass via repeated slashes in serveStatic</h3>
<p>Affects: Serve Static middleware. Fixes a path normalization
inconsistency where repeated slashes (<code>//</code>) could bypass
route-based middleware protections and allow access to protected static
files. GHSA-wmmm-f939-6g9c</p>
<h3>Path traversal in toSSG() allows writing files outside the output
directory</h3>
<p>Affects: <code>toSSG()</code> for Static Site Generation. Fixes a
path traversal issue where crafted <code>ssgParams</code> values could
write files outside the configured output directory.
GHSA-xf4j-xp2r-rqqx</p>
<h3>Incorrect IP matching in ipRestriction() for IPv4-mapped IPv6
addresses</h3>
<p>Affects: IP Restriction Middleware. Fixes improper handling of
IPv4-mapped IPv6 addresses (e.g. <code>::ffff:127.0.0.1</code>) that
could cause allow/deny rules to be bypassed. GHSA-xpcf-pg52-r92g</p>
<h3>Missing validation of cookie name on write path in setCookie()</h3>
<p>Affects: <code>setCookie()</code>, <code>serialize()</code>, and
<code>serializeSigned()</code> from <code>hono/cookie</code>. Fixes
missing validation of cookie names on the write path, preventing
inconsistent handling between parsing and serialization.
GHSA-26pp-8wgv-hjvm</p>
<h3>Non-breaking space prefix bypass in cookie name handling in
getCookie()</h3>
<p>Affects: <code>getCookie()</code> from <code>hono/cookie</code>.
Fixes a discrepancy in cookie name handling that could allow
attacker-controlled cookies to override legitimate ones and bypass
prefix protections. GHSA-r5rp-j6wh-rvv4</p>
<hr />
<p>Users who use Serve Static, Static Site Generation, Cookie utilities,
or IP restriction middleware are strongly encouraged to upgrade to this
version.</p>
<h2>v4.12.11</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(css): add classNameSlug option to createCssContext by <a
href="https://github.com/flow-pie"><code>@​flow-pie</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4834">honojs/hono#4834</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/flow-pie"><code>@​flow-pie</code></a>
made their first contribution in <a
href="https://redirect.github.com/honojs/hono/pull/4834">honojs/hono#4834</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/honojs/hono/compare/v4.12.10...v4.12.11">https://github.com/honojs/hono/compare/v4.12.10...v4.12.11</a></p>
<h2>v4.12.10</h2>
<h2>What's Changed</h2>
<ul>
<li>test(router): fix <code>Simple capturing group</code> test by <a
href="https://github.com/yusukebe"><code>@​yusukebe</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4838">honojs/hono#4838</a></li>
<li>docs: fix impaired -&gt; inspired typo in benchmark READMEs by <a
href="https://github.com/Abhi3975"><code>@​Abhi3975</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4843">honojs/hono#4843</a></li>
<li>fix(jsx/dom): apply select value after children are rendered by <a
href="https://github.com/usualoma"><code>@​usualoma</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4847">honojs/hono#4847</a></li>
<li>fix(compress): convert strong ETag to weak ETag when compressing by
<a href="https://github.com/usualoma"><code>@​usualoma</code></a> in <a
href="https://redirect.github.com/honojs/hono/pull/4848">honojs/hono#4848</a></li>
<li>docs(ip-restriction): add clear JSDoc examples and param types by <a
href="https://github.com/VISHNU7KASIREDDY"><code>@​VISHNU7KASIREDDY</code></a>
in <a
href="https://redirect.github.com/honojs/hono/pull/4851">honojs/hono#4851</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/Abhi3975"><code>@​Abhi3975</code></a>
made their first contribution in <a
href="https://redirect.github.com/honojs/hono/pull/4843">honojs/hono#4843</a></li>
<li><a
href="https://github.com/VISHNU7KASIREDDY"><code>@​VISHNU7KASIREDDY</code></a>
made their first contribution in <a
href="https://redirect.github.com/honojs/hono/pull/4851">honojs/hono#4851</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c37ba26da9"><code>c37ba26</code></a>
4.12.12</li>
<li><a
href="cc067c8559"><code>cc067c8</code></a>
Merge commit from fork</li>
<li><a
href="a586cd72e3"><code>a586cd7</code></a>
Merge commit from fork</li>
<li><a
href="48fa2233bc"><code>48fa223</code></a>
Merge commit from fork</li>
<li><a
href="b470278920"><code>b470278</code></a>
Merge commit from fork</li>
<li><a
href="9aff14bd72"><code>9aff14b</code></a>
Merge commit from fork</li>
<li><a
href="2c403c67eb"><code>2c403c6</code></a>
4.12.11</li>
<li><a
href="f82aba8e8e"><code>f82aba8</code></a>
feat(css): add classNameSlug option to createCssContext (<a
href="https://redirect.github.com/honojs/hono/issues/4834">#4834</a>)</li>
<li><a
href="9f374a55b2"><code>9f374a5</code></a>
4.12.10</li>
<li><a
href="a8c56a6620"><code>a8c56a6</code></a>
docs(ip-restriction): add clear JSDoc examples and param types (<a
href="https://redirect.github.com/honojs/hono/issues/4851">#4851</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/honojs/hono/compare/v4.12.7...v4.12.12">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 06:20:22 -07:00
syn-zhu
70042851d6
fix(ui): parse namespace from service name when matching A2A policies (#1487)
Fixes #1486

## Summary

`NamespacedHostname` always serializes as `"namespace/hostname"` (via
its `Display` impl), but `routeBackendMatchesA2aPolicy()` compared the
full `"namespace/hostname"` string against just the `hostname` from the
A2A policy target. This caused A2A routes to show as "Service" in the
Playground instead of "A2A".

## Change

Split `service.name` on `/` to extract namespace and hostname before
comparing against the policy target. Also removed the dead object-format
branch (`name?.hostname`) since `NamespacedHostname` never serializes as
an object.

## Regression of #978 / #979

The original fix in #979 handled the string case but didn't account for
the `namespace/` prefix in the serialized format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 19:14:23 -07:00
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
dependabot[bot]
28ead632fe
build(deps): bump aiohttp from 3.13.3 to 3.13.4 in /examples/a2a/strands-agents in the uv group across 1 directory (#1427)
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aiohttp&package-manager=uv&previous-version=3.13.3&new-version=3.13.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:30:58 -07:00
Filinto Duran
ccc31c040b
fix(llm/bedrock): correct output_index in Responses API stream events (#1455)
Summary

- Fix output_index in Bedrock streaming Responses API events to reflect
position in the response.output[] array instead of
  Bedrock's internal content_block_index
- Text content events now correctly use output_index: 0 (the message
item), tool calls get sequential indices starting at 1
- Add streaming tool-call snapshot tests (tool.bin) to prevent
regressions

  Problem

The old code used Bedrock's content_block_index as output_index. This
collided with the message item (always at index 0) for
tool-only or multi-tool responses — e.g., a tool-only stream would emit
both the message and the first tool call at output_index:
  0.

  Test plan

  - Existing from_bedrock snapshot tests pass
- New streaming tool-call snapshots verify correct output_index values
(message=0, tool1=1, tool2=2)
  - Verified against live Bedrock with a multi-tool streaming request
2026-04-07 15:09:58 -07:00
Filinto Duran
3bf346eb6b
update async-openai with new types (#1453)
https://github.com/64bit/async-openai/releases/tag/async-openai-v0.34.0

feat: sync upstream spec by @64bit in
https://github.com/64bit/async-openai/pull/529
added video charater, edit apis
updated types

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-04-07 13:42:32 -07:00
John Howard
c1d05ae952
fix: make index lookup nil-safe after Istio bump (#1483)
https://github.com/agentgateway/agentgateway/pull/1477 triggers a new
race, as Index can now be nil. To avoid adding a bunch of nil-checks
everywhere, introduce a common helper
2026-04-07 13:20:59 -07:00
Sai Teja Battula
4e9a4bdc4f
Fix #900: system-assigned managed identity crashes with NoopClient panic (#1433)
## Summary

Fix system-assigned managed identity crash caused by NoopClient panic.

## Problem

When `managedIdentity: {}` is configured (system-assigned), the gateway
panics on the first IMDS request:

**Root cause:** The `.map()` call short-circuits to `None` when
`user_assigned_identity` is `None`, so
`ManagedIdentityCredential::new(None)` is called. The Azure SDK then
falls back to its default `NoopClient` instead of the custom
reqwest-backed transport.

## Fix

Always construct `ManagedIdentityCredentialOptions` with the custom
transport, making `user_assigned_id` the only optional field. When
`user_assigned_id` is `None`, the SDK treats it as system-assigned —
same behaviour as before, but now with the correct HTTP client.

## Behaviour after fix

| Configuration | Before | After |
|---|---|---|
| `managedIdentity: {}` (system-assigned) | 💥 Panic | ✅ Works |
| `managedIdentity: { clientId: "..." }` | ✅ Works | ✅ Works |
| `managedIdentity: { objectId: "..." }` | ✅ Works | ✅ Works |
| `managedIdentity: { resourceId: "..." }` | ✅ Works | ✅ Works |

## Files changed

- `crates/agentgateway/src/http/auth.rs` — fix `ManagedIdentity` arm in
`build_credential()`

Fixes #900

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-04-07 13:06:26 -07:00
dependabot[bot]
661c1b0d99
build(deps): bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 in the go_modules group across 1 directory (#1481)
Bumps the go_modules group with 1 update in the / directory:
[github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose).

Updates `github.com/go-jose/go-jose/v4` from 4.1.3 to 4.1.4
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/go-jose/go-jose/releases">github.com/go-jose/go-jose/v4's
releases</a>.</em></p>
<blockquote>
<h2>v4.1.4</h2>
<h2>What's Changed</h2>
<p>Fixes Panic in JWE decryption. See <a
href="https://github.com/go-jose/go-jose/security/advisories/GHSA-78h2-9frx-2jm8">https://github.com/go-jose/go-jose/security/advisories/GHSA-78h2-9frx-2jm8</a></p>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/go-jose/go-jose/compare/v4.1.3...v4.1.4">https://github.com/go-jose/go-jose/compare/v4.1.3...v4.1.4</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0e59876635"><code>0e59876</code></a>
Merge commit from fork</li>
<li><a
href="ddffdbcec8"><code>ddffdbc</code></a>
Bump actions/checkout from 5 to 6 (<a
href="https://redirect.github.com/go-jose/go-jose/issues/213">#213</a>)</li>
<li>See full diff in <a
href="https://github.com/go-jose/go-jose/compare/v4.1.3...v4.1.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/go-jose/go-jose/v4&package-manager=go_modules&previous-version=4.1.3&new-version=4.1.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 12:13:24 -07:00
Rui Gu
d3db9106b8
fix(controller): Service-targeted policies dropped due to init ordering and missing PolicyAttachment traversal (#1474)
## Changes
1. **Split `AgwPolicyCollection` into two phases** (authored by
@alexeldeib):
- `CollectPolicyReferences`: collects `PolicyAttachments` from all
plugins first
- `BuildPolicies`: builds policies with the fully-populated
`ReferenceIndex`
2. **Use `LookupGatewaysForBackend` in `TranslateAgentgatewayPolicy`**:
traverses `PolicyAttachments` to resolve gateway associations for
indirectly-referenced targets.
3. **Add golden test**: validates that a Service-targeted backend TLS
policy is correctly associated with a gateway when the Service is only
referenced via an ext_proc policy's `backendRef`.

---------

Co-authored-by: Ace Eldeib <aeldeib@coreweave.com>
Co-authored-by: John Howard <john.howard@solo.io>
2026-04-07 11:30:52 -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
Yossi Mesika
143ee77d86
Bump Istio dependency (#1477)
Bump Istio dependency and adapt to changes in the ambient.Builder API.
2026-04-07 10:46:35 -07:00
John Howard
ebed6743b7
make sponsor icon bigger (#1480) 2026-04-07 10:45:30 -07:00
John Howard
b35cc7d561
Add sponsors to readme (#1479) 2026-04-07 10:44:06 -07:00
blacksmith-sh[bot]
5c6c7f10e2
.github/workflows: Migrate workflows to Blacksmith runners (#1473)
To whomever may be reviewing this PR,

**[Blacksmith](https://www.blacksmith.sh/) is the fastest way to run
your GitHub Actions.**

## What does this PR change?

This PR has been automatically generated by a team member in your GitHub
organization using Blacksmith's [Migration
Wizard](https://docs.blacksmith.sh/introduction/quickstart), or MigWiz
for short. This PR changes the following:

1. Your selected workflows will now run on Blacksmith's 2x faster
hardware (e.g., `runs-on: blacksmith-4vcpu-ubuntu-2204`). Learn more
about the [different instances available to choose
from](https://docs.blacksmith.sh/blacksmith-runners/overview#runner-tags).
2. Your jobs running on Blacksmith will now have all official GitHub and
popular third-party cache actions automatically interact with our 4x
faster, colocated cache. Learn more about [Blacksmith's actions
cache](https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions).
3. Your GitHub Actions will now actually be observable. Learn more about
Blacksmith's
[logging](https://docs.blacksmith.sh/blacksmith-observability/logs) and
other
[observability](https://docs.blacksmith.sh/blacksmith-observability/dashboard)
features.
4. Your Docker builds will now automatically share their Docker layer
cache, resulting in up to 40x faster builds. Learn more about
[Blacksmith's Docker layer
caching](https://docs.blacksmith.sh/blacksmith-caching/docker-builds).

## FAQ

- Is this free? The first 3,000 minutes per month are free.
- Who uses Blacksmith? Clerk, Ashby, VEED, and 600+ others.
- What's the catch? There is none. Merge this thing already.

Co-authored-by: blacksmith-sh[bot] <157653362+blacksmith-sh[bot]@users.noreply.github.com>
2026-04-07 10:43:46 -07:00
Copilot
6deb9d38ae
Move proxy-test CI config validation to Rust integration tests (#1468)
- [x] Created `crates/agentgateway/tests/validate_examples.rs`:
integration test validating all `examples/**/config.yaml` files
- Fixed Windows path issue: `strip_prefix` operates on raw `PathBuf`
before string conversion
  - Removed `dbg!()` noise from CI logs
- Fixed header comment: `examples/**/config.yaml` (recursive walk, not
just one level)
- Converted single looping test to 17 per-config `#[rstest]` cases for
better CI failure granularity
  - Ran `rustfmt`
- [x] Updated `tools/manage-validation-deps.sh`:
- Removed `docker logs -f keycloak` (would hang indefinitely); replaced
with `docker logs --tail 50` only on failure
- [x] Updated `.github/workflows/pull_request.yml`:
  - Removed redundant `make validate` step
- Added "Start validation dependencies" step (ubuntu only) before tests
  - Set `KEYCLOAK_AVAILABLE=1` in env for the Test step on ubuntu
  - Added "Stop validation dependencies" step (ubuntu only, always runs)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
Co-authored-by: John Howard <john.howard@solo.io>
2026-04-07 10:19:06 -07:00
John Howard
cf5ade8a49
xds: cleanup error paths that cannot fail (#1432) 2026-04-02 14:41:08 -07:00
Steven Landow
076fa978a1
proxy: apply service targeted policy (#1441)
* waypoint routes will either have a service_key (either in the explicit
route over xds _or_ in the implicit/default route)
* service_key will be used to lookup policies as a
`PolicyTarget::Backend(BackendTarget::Service(...))`

also adds some tests on the general hbone path + various policies on
that path
2026-04-02 11:17:36 -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
a0cdfbeeb6
Enhance waypoint support in proxy (#1185)
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.

TODO before merging: auth is hardcoded in a weird way right now pending
the backend auth customization
2026-04-02 08:43:28 -07:00
John Howard
4d04dea960
Add tests for reference grant (#1428) 2026-04-01 19:38:56 -07:00
John Howard
badc180a79
ext_proc: better handling of immediate response and fail_open (#1430)
Fixes https://github.com/agentgateway/agentgateway/issues/1400

1. Handle immediate response in various phases of the lifecycle
2. Remove complex task message passing
3. Adopt Envoy's new fail_open strategy which is that it only triggers
   on the initial request failing unless there is no body.
2026-04-01 19:38:47 -07:00
John Howard
9e726dbd69
cleanup misc hyper-util cruft that is unused (#1431) 2026-04-01 19:38:27 -07:00
John Howard
be0c3128ac
cleanup logging: executor is now cheap (#1425)
Before it was super expensive to make this; now its ~free so we don't
need hacks to skip it.

Verified with a quick perf test + flamegraph
2026-04-01 09:29:31 -07:00
John Howard
eeb246b9fd
Misc refactoring after oidc (#1424) 2026-04-01 08:35:29 -07:00
John Howard
8f0e00850d
controller: stricter controller securityContext by default (#1406) 2026-04-01 10:34:45 -05:00
Nina Polshakova
304e2c3073
Fix make run: no v prefix (#1422)
Found an issue with the helm version `make run` when checking
https://github.com/agentgateway/agentgateway/issues/1115 was fixed.

```
Error: path "agentgateway/controller/_test/agentgateway-crds-v1.0.1-dev.tgz" not found                                                                                                
make: *** [Makefile:500: deploy-agentgateway-crd-chart] Error 1 
```

The deploy targets were using `$(VERSION)` (which is `v1.0.1-dev`) but
the package targets create files using `$(HELM_CHART_VERSION_NO_V)`
(which is `1.0.1-dev` - without the "v" prefix). `make run` now uses the
correct version.

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-04-01 08:20:19 -07: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
570f9b18b3
nightly: add a usable helm tag (#1376)
We did not add a helm tag before, and if we did use latest-dev it
wouldn't work anyways

fixes https://github.com/agentgateway/agentgateway/issues/1316

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-01 08:16:25 -07:00
apexlnc
225ca63127
feat(auth): Add built-in OIDC browser auth flow (#1233)
Add built-in `oidc` browser authentication to the Rust runtime.

This PR introduces a self-contained `oidc` traffic policy for local
config. The gateway can start the authorization code flow with PKCE,
handle the callback itself, exchange the code for tokens, validate the
returned ID token, and persist an encrypted browser session cookie. That
gives users a built-in browser auth path without requiring an external
`oauth2-proxy` sidecar.

The feature is route-owned rather than globally dispatched. A route is
protected by attaching `oidc` to it, and the route that matches the
callback path is the route whose effective OIDC policy completes the
flow and owns the resulting browser session. Listener-level OIDC config
is lowered into route-phase policy attachments, but callback handling
still happens through normal route selection rather than a separate
callback registry or listener interception path.

Provider setup supports the two expected local-config modes:
- issuer-based discovery
- fully explicit `authorizationEndpoint`, `tokenEndpoint`, and `jwks`
configuration

At the config boundary, local OIDC compilation owns discovery, JWKS
loading, endpoint validation, and policy construction. The runtime OIDC
surface is kept focused on browser-flow behavior: redirects, callback
processing, token exchange, ID-token validation, and browser session
handling. The stored post-login redirect target is sanitized when
captured so callback completion only reflects local in-gateway
destinations.

This PR also:
- wires `OIDC_COOKIE_SECRET` through core config/bootstrap
- updates the generated schema and docs for the new policy
- adds a local Keycloak-backed `examples/oidc` example
- keeps `examples/oauth2-proxy` updated as the documented external
sidecar alternative

This is local-config only. Built-in logout, post-logout redirects,
refresh or access token persistence, and xDS/controller-managed OIDC
config remain out of scope for this first cut.
2026-04-01 08:05:40 -07:00
John Howard
88d3ac4e45
client: better error messages (#1416)
Before/after
```
upstream call failed: SendRequest: user body write aborted
upstream call failed: SendRequest: user body write aborted: early end, expected 5 more bytes
```
2026-03-31 14:03:33 -07:00
John Howard
d95d555d5b
llm: support serviceTier, image and audio tokens (#1414)
Fixes https://github.com/agentgateway/agentgateway/issues/1409
2026-03-31 10:50:53 -07:00
Anders Schwartz
e5eea3ebd8
fix(mcp): propagate maxBufferSize to MCP upstream HTTP requests (#1413)
Fixes #1410

The MCP upstream path (IncomingRequestContext) does not propagate the
BufferLimit extension from incoming frontend requests to outgoing
backend requests. This causes the HTTP client to fall back to the 2MB
default when reading MCP backend responses, ignoring maxBufferSize.

The LLM path was fixed in #881 and the Bedrock path in #1378. This
applies the same pattern to the MCP path by preserving BufferLimit
through IncomingRequestContext, matching how Claims is already handled.

Co-authored-by: FlowState Bot <flowstate-bot@users.noreply.github.com>
2026-03-31 08:59:57 -07:00
John Howard
a1b70fa595
Wait for bind before becoming ready (#1407) 2026-03-30 14:56:51 -07:00
kyle
db5e9598b7
fix: Vertex AI compatibility for Claude Code proxy requests (#1359)
# fix: Vertex AI compatibility for Claude Code proxy requests

## Summary

When using agentgateway as a proxy for **Claude Code** with the **Vertex
AI Anthropic provider**, requests fail due to two issues:

1. **Serde deserialization** — `#[serde(tag = "type")]` on passthrough
content block enums fails on unknown content types like `thinking`,
`tool_use`, etc.
2. **Unsupported body fields** — Vertex rejects fields like
`output_config` and `cache_control.scope` that Claude Code sends via
beta features

This PR fixes both in code.

> **Note:** To use agentgateway as a Claude Code proxy, you also need an
`AgentgatewayPolicy` to rewrite the `anthropic-beta` request header to
only include Vertex-supported values. Vertex hard-resets TCP connections
on unrecognized beta header values. See the "Beta header policy" section
below for the recommended configuration.

## Changes

### `messages.rs` — Fix content block passthrough

Switch `ContentPart` and `TextPart` from internally-tagged to untagged
serde enums:

```rust
// Before: requires "type" field on every content block
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ContentPart {
    Text { text: String, ... },
    #[serde(untagged)]
    Unknown(serde_json::Value),
}

// After: tries Text first (needs type + text fields), falls back to Unknown
#[serde(untagged)]
pub enum ContentPart {
    Text { r#type: String, text: String, ... },
    Unknown(serde_json::Value),
}
```

This allows `thinking`, `tool_use`, `tool_result`, and other content
block types to pass through without deserialization errors.

### `vertex.rs` — Strip unsupported fields and deduplicate body
preparation

Extract a shared `prepare_anthropic_body` pipeline that both
`prepare_anthropic_message_body` and
`prepare_anthropic_count_tokens_body` use. The pipeline: parse → inject
`anthropic_version` → apply caller-specific model handling → strip
unsupported fields → serialize.

Unsupported field removal:
- `output_config` and `output_format` — removed at top level only (not
recursively)
- `cache_control.scope` — removed recursively via `remove_nested_field`,
since `cache_control` can appear on content blocks at any depth

Fields that Vertex **does** support (verified empirically) are
intentionally kept:
- `metadata` (user attribution)
- `context_management` (compaction, context editing)
- `thinking` (including `"type": "adaptive"`)

### Required: Beta header policy

Vertex rejects unknown `anthropic-beta` header values with a TCP
connection reset (not a clean HTTP error). An `AgentgatewayPolicy` is
required to rewrite the header:

```yaml
traffic:
  headerModifiers:
    request:
      set:
      - name: anthropic-beta
        value: "interleaved-thinking-2025-05-14,output-128k-2025-02-19,context-management-2025-06-27,compact-2026-01-12"
```

---

## Testing Evidence

### 1. `missing field 'type'` — fixed

**Before:**
```
error="processing failed: failed to marshal request: missing field `type`"
```

**After:** All content block types pass through as `Unknown(Value)`. No
deserialization errors.

---

### 2. `output_config` rejection — fixed

**Before:**
```json
{"type":"error","error":{"type":"invalid_request_error",
  "message":"output_config: Extra inputs are not permitted"}}
```

**After:** `output_config` stripped before reaching Vertex. Returns `200
OK`.

---

### 3. `cache_control.scope` rejection — fixed

Claude Code sends `"cache_control": {"type": "ephemeral", "scope":
"global"}` via the `prompt-caching-scope` beta.

**Before:**
```json
{"type":"error","error":{"type":"invalid_request_error",
  "message":"system.2.cache_control.ephemeral.scope: Extra inputs are not permitted"}}
```

**After:** `scope` stripped recursively. Caching still works:
```
cache_creation_input_tokens: 31962
```

---

### 4. Unsupported beta headers — fixed via policy

Claude Code sends an `anthropic-beta` header with all its enabled betas.
Several of these are not supported on Vertex AI and cause a hard **TCP
connection reset** (not a clean 400 error):

| Beta header value | Vertex support |
|---|---|
| `interleaved-thinking-2025-05-14` | Supported |
| `output-128k-2025-02-19` | Supported |
| `context-management-2025-06-27` | Supported |
| `compact-2026-01-12` | Supported |
| `prompt-caching-scope-2026-01-05` | **Rejected** (connection reset) |
| `structured-outputs-2025-12-15` | **Rejected** (connection reset) |
| `effort-2025-11-24` | **Rejected** (connection reset) |
| `redact-thinking-2026-02-12` | **Rejected** (400 error) |
| `claude-code-20250219` | **Rejected** (connection reset) |

**Before:**
```bash
$ curl -s ... -H "anthropic-beta: interleaved-thinking-2025-05-14,prompt-caching-scope-2026-01-05"
upstream connect error or disconnect/reset before headers. reset reason: connection termination
```

**After:** An `AgentgatewayPolicy` with `headerModifiers.request.set`
rewrites the header to only include Vertex-supported values. The
original header from the client is replaced entirely:
```bash
# Client sends: anthropic-beta: claude-code-20250219,interleaved-thinking-2025-05-14,...,prompt-caching-scope-2026-01-05
# Policy rewrites to: interleaved-thinking-2025-05-14,output-128k-2025-02-19,context-management-2025-06-27,compact-2026-01-12
# Result: 200 OK
```

---

### 5. `context_management` and `metadata` — verified supported

```bash
curl -s -o /dev/null -w "%{http_code}" ... -d '{"context_management": {"edits": [...]}, ...}'
# 200

curl -s -o /dev/null -w "%{http_code}" ... -d '{"metadata": {"user_id": "test"}, ...}'
# 200
```

These are intentionally **not** stripped.

---

### 6. End-to-end: Claude Code via agentgateway

```bash
$ ANTHROPIC_BASE_URL=https://agentgateway.example.com/claude ANTHROPIC_AUTH_TOKEN=dummy claude
> hi
Hi! What are you working on today?
```

```
http.status=200 gen_ai.request.model=claude-haiku-4-5-20251001 duration=774ms
http.status=200 gen_ai.request.model=claude-opus-4-6 duration=1681ms
```
2026-03-30 21:54:24 +00:00
John Howard
85d5e1ade5
Prune unused deps in cargo (#1404) 2026-03-30 14:50:23 -07:00
Steven Landow
2fd260be35
fix finding listener for HBONE path (#1403)
This fixes two issues:

1. the same thing #1392 fixes - avoids ListenerNotFound when we get to
proxy_http
2. passing the synthetic listener with a bogus listener name and empty
gateway name breaks on the TCP path would break policy lookup
  * get_backend_policies gets a route path that contains a listener_name
  * internal_backend_policy gets a gateway with empty names
* as_gateway_target_ref produces a PolicyTargetRef with empty stuff, so
we miss in policies_by_target
2026-03-30 12:44:57 -07:00
Matthew Karsten
54e18b2b30
feat: support OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES env vars (#1396)
## Summary
Addresses #602 — adds support for the standardized OpenTelemetry
environment variables `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES`
in the resource defaults initialization.

### Changes
`set_resource_defaults_from_config` now:
1. Parses `OTEL_RESOURCE_ATTRIBUTES` (comma-separated `key=value` pairs)
and seeds resource attributes from it
2. Falls back to `OTEL_SERVICE_NAME` when the gateway config doesn't
provide a service name
3. Config-derived attributes override env-sourced ones (retain/push
pattern ensures no duplicates)

### Precedence
Gateway config > `OTEL_*` env vars > compiled defaults

This matches the [OTel resource SDK
spec](https://opentelemetry.io/docs/specs/otel/resource/sdk/#specifying-resource-information-via-an-environment-variable)
and lets operators configure telemetry resource attributes via standard
env vars in Kubernetes deployments without modifying gateway config.

### Testing
- `cargo check --lib -p agentgateway` passes cleanly
- No behavioral change when env vars are unset (existing tests
unaffected)

---------

Co-authored-by: Matthew Karsten <matthewkarsten@example.com>
Co-authored-by: John Howard <john.howard@solo.io>
2026-03-30 10:31:29 -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
0b3c8c68bb
mcp: allow OpenAPI and SSE stateless sessions (#1399) 2026-03-30 09:48:38 -07:00
John Howard
61e49fb507
Filter unused secrets (#1383)
https://github.com/agentgateway/agentgateway/issues/1341

Also drops a duplicate watch on configmaps by once watching with ns
filter and another time without (preventing watch dedupe)
2026-03-30 09:46:31 -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
Eitan Yarmush
e0bd15ceef
fix: use protocol-filtered matching in detect_misdirected (#1395)
detect_misdirected() used unfiltered best_match() to verify the
TLS-selected listener, which could return an HTTP listener with the same
wildcard hostname. Since ListenerSet uses HashMap (non-deterministic
iteration), this caused spurious 421 errors when BindProtocol::auto
serves both HTTP and HTTPS listeners on the same bind.

Use best_match_tls() instead, matching the protocol-aware pattern
already used in TLS handshake listener selection (gateway.rs) and the
HTTP fallback path (best_match_http).

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 15:48:52 +00:00
dependabot[bot]
04695a4f30
build(deps): bump the cargo-weekly group with 8 updates (#1394)
Bumps the cargo-weekly group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| <a
href="https://github.com/googleapis/google-cloud-rust">google-cloud-auth</a>
| `1.7.0` | `1.8.0` |
| <a href="https://github.com/mitsuhiko/insta">insta</a> | `1.46.3` |
`1.47.1` |
| <a href="https://github.com/RustCrypto/hashes">md-5</a> | `0.10.6` |
`0.11.0` |
| <a href="https://github.com/RustCrypto/hashes">sha1</a> | `0.10.6` |
`0.11.0` |
| <a href="https://github.com/RustCrypto/hashes">sha2</a> | `0.10.9` |
`0.11.0` |
| <a href="https://github.com/dtolnay/thiserror">thiserror</a> |
`1.0.69` | `2.0.18` |
| <a href="https://github.com/uuid-rs/uuid">uuid</a> | `1.22.0` |
`1.23.0` |
| <a
href="https://github.com/geeknoid/frozen-collections">frozen-collections</a>
| `0.8.0` | `0.9.1` |

`nom` and `criterion` have been excluded from this update and added to
the dependabot ignore list.

Updates `google-cloud-auth` from 1.7.0 to 1.8.0

<br>

Updates `insta` from 1.46.3 to 1.47.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mitsuhiko/insta/releases">insta's
releases</a>.</em></p>
<blockquote>
<h2>1.47.1</h2>
<h2>Release Notes</h2>
<ul>
<li>Revert sorting of sequences in <code>sort_maps</code>. The change in
1.47.0 sorted all
<code>Seq</code> values (including <code>Vec</code>), not just
non-deterministic collections like
<code>HashSet</code>, which was a breaking change. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/876">#876</a></li>
</ul>
<h2>1.47.0</h2>
<h2>Release Notes</h2>
<ul>
<li>Add <code>Comparator</code> trait for customizing how snapshot
values are compared. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/872">#872</a>
(<a href="https://github.com/dstu"><code>@dstu</code></a>)</li>
<li>Sort sequences in <code>sort_maps</code> to fix non-deterministic
<code>HashSet</code> snapshots. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/876">#876</a></li>
<li>Improve TOML serialization error message for unsupported types,
suggesting <code>assert_json_snapshot!</code> or
<code>assert_yaml_snapshot!</code> as alternatives. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/880">#880</a></li>
<li>Remove unnecessary <code>Send + Sync</code> bounds from
<code>Redaction</code>, allowing non<code>Send</code> closures in
dynamic redactions. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/874">#874</a></li>
<li>Don't use <code>Arc</code> in <code>Settings</code> unnecessarily.
<a
href="https://redirect.github.com/mitsuhiko/insta/issues/873">#873</a>
(<a href="https://github.com/dstu"><code>@dstu</code></a>)</li>
<li>Upgrade <code>console</code> to 0.16 and MSRV to 1.66. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/885">#885</a></li>
<li>Upgrade <code>toml-edit</code> to 0.25. <a
href="https://redirect.github.com/mitsuhiko/insta/issues/882">#882</a>
(<a
href="https://github.com/alexanderkjall"><code>@alexanderkjall</code></a>)</li>
</ul>
</blockquote>
</details>
<br>

Updates `md-5` from 0.10.6 to 0.11.0
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b5051e5a5e"><code>b5051e5</code></a>
Cut new releases (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/812">#812</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/RustCrypto/hashes/compare/md-5-v0.10.6...md2-v0.11.0">compare
view</a></li>
</ul>
</details>
<br>

Updates `sha1` from 0.10.6 to 0.11.0
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2f00175af9"><code>2f00175</code></a>
Release sha1 v0.11.0 (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/810">#810</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/RustCrypto/hashes/compare/sha1-v0.10.6...sha1-v0.11.0">compare
view</a></li>
</ul>
</details>
<br>

Updates `sha2` from 0.10.9 to 0.11.0
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ffe093984c"><code>ffe0939</code></a>
Release sha2 0.11.0 (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/806">#806</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/RustCrypto/hashes/compare/sha2-v0.10.9...sha2-v0.11.0">compare
view</a></li>
</ul>
</details>
<br>

Updates `thiserror` from 1.0.69 to 2.0.18
<details>
<summary>Commits</summary>
<ul>
<li><a
href="dc0f6a23a3"><code>dc0f6a2</code></a>
Release 2.0.18</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/thiserror/compare/1.0.69...2.0.18">compare
view</a></li>
</ul>
</details>
<br>

Updates `uuid` from 1.22.0 to 1.23.0
<details>
<summary>Commits</summary>
<ul>
<li><a
href="00ab922d53"><code>00ab922</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/876">#876</a> from
uuid-rs/cargo/v1.23.0</li>
<li>Additional commits viewable in <a
href="https://github.com/uuid-rs/uuid/compare/v1.22.0...v1.23.0">compare
view</a></li>
</ul>
</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-03-30 08:30:56 -07:00
Rajat Vig
a67cd7b5c9
feat(metrics): add retry metrics (#1393)
Closes #815

Signed-off-by: Rajat Vig <rvig@etsy.com>
2026-03-30 08:18:42 -07:00
dependabot[bot]
60ebe19a78
build(deps): bump path-to-regexp from 8.3.0 to 8.4.0 in /ui in the npm_and_yarn group across 1 directory (#1387)
Bumps the npm_and_yarn group with 1 update in the /ui directory:
[path-to-regexp](https://github.com/pillarjs/path-to-regexp).

Updates `path-to-regexp` from 8.3.0 to 8.4.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pillarjs/path-to-regexp/releases">path-to-regexp's
releases</a>.</em></p>
<blockquote>
<h2>8.4.0</h2>
<p><strong>Important</strong></p>
<ul>
<li>Fix <a
href="https://www.cve.org/CVERecord?id=CVE-2026-4926">CVE-2026-4926</a>
(<a
href="https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-j3q9-mxjg-w52f">GHSA-j3q9-mxjg-w52f</a>)</li>
<li>Fix <a
href="https://www.cve.org/CVERecord?id=CVE-2026-4923">CVE-2026-4923</a>
(<a
href="https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-27v5-c462-wpq7">GHSA-27v5-c462-wpq7</a>)</li>
</ul>
<p><strong>Fixed</strong></p>
<ul>
<li>Restricts wildcard backtracking when using more than 1 in a path (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/pull/421">pillarjs/path-to-regexp#421</a>)</li>
</ul>
<p><strong>Changed</strong></p>
<ul>
<li>Dedupes regex prefixes (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/pull/422">pillarjs/path-to-regexp#422</a>)
<ul>
<li>This will result in shorter regular expressions for some cases using
optional groups</li>
</ul>
</li>
<li>Rejects large optional route combinations (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/pull/424">pillarjs/path-to-regexp#424</a>)
<ul>
<li>When using groups such as <code>/users{/delete}</code> it will
restrict the number of generated combinations to &lt; 256, equivalent to
8 top-level optional groups and unlikely to occur in a real world
application, but avoids exploding the regex size for applications that
accept user created routes</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="34cb451dda"><code>34cb451</code></a>
8.4.0</li>
<li><a
href="22a967901a"><code>22a9679</code></a>
Reject large optional route combinations (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/424">#424</a>)</li>
<li><a
href="8881a88930"><code>8881a88</code></a>
Byte optimization (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/423">#423</a>)</li>
<li><a
href="43669ac637"><code>43669ac</code></a>
Dedupe regex prefixes (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/422">#422</a>)</li>
<li><a
href="48646547da"><code>4864654</code></a>
Restrict repeated wildcard backtracking (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/421">#421</a>)</li>
<li><a
href="05a5a97370"><code>05a5a97</code></a>
Remove dependabot config (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/404">#404</a>)</li>
<li><a
href="5b635cd1bd"><code>5b635cd</code></a>
Remove <code>package-lock.json</code> (<a
href="https://redirect.github.com/pillarjs/path-to-regexp/issues/407">#407</a>)</li>
<li>See full diff in <a
href="https://github.com/pillarjs/path-to-regexp/compare/v8.3.0...v8.4.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=path-to-regexp&package-manager=npm_and_yarn&previous-version=8.3.0&new-version=8.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-28 18:38:13 -07:00
dependabot[bot]
76b725627e
build(deps): bump cryptography from 46.0.5 to 46.0.6 in /examples/a2a/strands-agents in the uv group across 1 directory (#1388)
Bumps the uv group with 1 update in the /examples/a2a/strands-agents
directory: [cryptography](https://github.com/pyca/cryptography).

Updates `cryptography` from 46.0.5 to 46.0.6
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst">cryptography's
changelog</a>.</em></p>
<blockquote>
<p>46.0.6 - 2026-03-25</p>
<pre><code>
* **SECURITY ISSUE**: Fixed a bug where name constraints were not
applied
  to peer names during verification when the leaf certificate contains a
wildcard DNS SAN. Ordinary X.509 topologies are not affected by this
bug,
including those used by the Web PKI. Credit to **Oleh Konko (1seal)**
for
  reporting the issue. **CVE-2026-34073**
<p>.. _v46-0-5:<br />
</code></pre></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="91d728897b"><code>91d7288</code></a>
Cherry-pick <a
href="https://redirect.github.com/pyca/cryptography/issues/14542">#14542</a>
(<a
href="https://redirect.github.com/pyca/cryptography/issues/14543">#14543</a>)</li>
<li>See full diff in <a
href="https://github.com/pyca/cryptography/compare/46.0.5...46.0.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cryptography&package-manager=uv&previous-version=46.0.5&new-version=46.0.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-28 18:37:46 -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
0b901fcf59
bedrock: respect buffer limit (#1378)
fixes https://github.com/agentgateway/agentgateway/issues/711
2026-03-27 12:57:22 -07:00
Ram Vennam
758de777bb
Update README key features, description, and getting started section (#1380)
minor updates to the README

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-27 19:20:59 +00:00
Ram Vennam
379b23d9b8
Update architecture diagram (#1379)
Not the greatest diagram but still better than what's currently there.
2026-03-27 18:45:46 +00:00
John Howard
9ce893eddb
mcp: when stdio server fails, send error to client (#1377)
Today we just hang forever

fixes https://github.com/agentgateway/agentgateway/issues/431
2026-03-27 10:58:36 -07:00
John Howard
878d9a0f78
Better handle invalid route backends (#1339)
Per GW API spec we should send a weight-proportional amount of traffic
to invalid backends. We did not and instead sent a backend `{}` which
implies `weight=0` which implies no traffic.
2026-03-26 15:36:44 -07:00
John Howard
d5104c40ec
add test for network authz (#1368) 2026-03-26 15:07:56 -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
John Howard
390719a08b
More CEL validation in controller (#1287)
builds on https://github.com/agentgateway/agentgateway/pull/1245
2026-03-26 14:00:52 -07:00
John Howard
242ececfb2
cel: add sha256, sha1, and md5 encoding (#1338) 2026-03-26 13:00:39 -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
81fb149c1b
Update cargo deps (#1112)
everything but mcp in
https://github.com/agentgateway/agentgateway/pull/1327
2026-03-26 10:46:35 -07:00
Markus Kobler
9990c57208
feat(llm): add support for path prefix (#1364) 2026-03-26 17:37:58 +00:00
dependabot[bot]
dde32322dd
build(deps): bump requests from 2.32.5 to 2.33.0 in /examples/a2a/strands-agents in the uv group across 1 directory (#1362)
Bumps the uv group with 1 update in the /examples/a2a/strands-agents
directory: [requests](https://github.com/psf/requests).

Updates `requests` from 2.32.5 to 2.33.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/psf/requests/releases">requests's
releases</a>.</em></p>
<blockquote>
<h2>v2.33.0</h2>
<h2>2.33.0 (2026-03-25)</h2>
<p><strong>Announcements</strong></p>
<ul>
<li>📣 Requests is adding inline types. If you have a typed code base
that uses Requests, please take a look at <a
href="https://redirect.github.com/psf/requests/issues/7271">#7271</a>.
Give it a try, and report any gaps or feedback you may have in the
issue. 📣</li>
</ul>
<p><strong>Security</strong></p>
<ul>
<li>CVE-2026-25645 <code>requests.utils.extract_zipped_paths</code> now
extracts contents to a non-deterministic location to prevent malicious
file replacement. This does not affect default usage of Requests, only
applications calling the utility function directly.</li>
</ul>
<p><strong>Improvements</strong></p>
<ul>
<li>Migrated to a PEP 517 build system using setuptools. (<a
href="https://redirect.github.com/psf/requests/issues/7012">#7012</a>)</li>
</ul>
<p><strong>Bugfixes</strong></p>
<ul>
<li>Fixed an issue where an empty netrc entry could cause malformed
authentication to be applied to Requests on Python 3.11+. (<a
href="https://redirect.github.com/psf/requests/issues/7205">#7205</a>)</li>
</ul>
<p><strong>Deprecations</strong></p>
<ul>
<li>Dropped support for Python 3.9 following its end of support. (<a
href="https://redirect.github.com/psf/requests/issues/7196">#7196</a>)</li>
</ul>
<p><strong>Documentation</strong></p>
<ul>
<li>Various typo fixes and doc improvements.</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/M0d3v1"><code>@​M0d3v1</code></a> made
their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/6865">psf/requests#6865</a></li>
<li><a href="https://github.com/aminvakil"><code>@​aminvakil</code></a>
made their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/7220">psf/requests#7220</a></li>
<li><a href="https://github.com/E8Price"><code>@​E8Price</code></a> made
their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/6960">psf/requests#6960</a></li>
<li><a href="https://github.com/mitre88"><code>@​mitre88</code></a> made
their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/7244">psf/requests#7244</a></li>
<li><a href="https://github.com/magsen"><code>@​magsen</code></a> made
their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/6553">psf/requests#6553</a></li>
<li><a
href="https://github.com/Rohan5commit"><code>@​Rohan5commit</code></a>
made their first contribution in <a
href="https://redirect.github.com/psf/requests/pull/7227">psf/requests#7227</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/psf/requests/blob/main/HISTORY.md#2330-2026-03-25">https://github.com/psf/requests/blob/main/HISTORY.md#2330-2026-03-25</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psf/requests/blob/main/HISTORY.md">requests's
changelog</a>.</em></p>
<blockquote>
<h2>2.33.0 (2026-03-25)</h2>
<p><strong>Announcements</strong></p>
<ul>
<li>📣 Requests is adding inline types. If you have a typed code base
that
uses Requests, please take a look at <a
href="https://redirect.github.com/psf/requests/issues/7271">#7271</a>.
Give it a try, and report
any gaps or feedback you may have in the issue. 📣</li>
</ul>
<p><strong>Security</strong></p>
<ul>
<li>CVE-2026-25645 <code>requests.utils.extract_zipped_paths</code> now
extracts
contents to a non-deterministic location to prevent malicious file
replacement. This does not affect default usage of Requests, only
applications calling the utility function directly.</li>
</ul>
<p><strong>Improvements</strong></p>
<ul>
<li>Migrated to a PEP 517 build system using setuptools. (<a
href="https://redirect.github.com/psf/requests/issues/7012">#7012</a>)</li>
</ul>
<p><strong>Bugfixes</strong></p>
<ul>
<li>Fixed an issue where an empty netrc entry could cause
malformed authentication to be applied to Requests on
Python 3.11+. (<a
href="https://redirect.github.com/psf/requests/issues/7205">#7205</a>)</li>
</ul>
<p><strong>Deprecations</strong></p>
<ul>
<li>Dropped support for Python 3.9 following its end of support. (<a
href="https://redirect.github.com/psf/requests/issues/7196">#7196</a>)</li>
</ul>
<p><strong>Documentation</strong></p>
<ul>
<li>Various typo fixes and doc improvements.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="bc04dfd6da"><code>bc04dfd</code></a>
v2.33.0</li>
<li><a
href="66d21cb07b"><code>66d21cb</code></a>
Merge commit from fork</li>
<li><a
href="8b9bc8fc0f"><code>8b9bc8f</code></a>
Move badges to top of README (<a
href="https://redirect.github.com/psf/requests/issues/7293">#7293</a>)</li>
<li><a
href="e331a288f3"><code>e331a28</code></a>
Remove unused extraction call (<a
href="https://redirect.github.com/psf/requests/issues/7292">#7292</a>)</li>
<li><a
href="753fd08c5e"><code>753fd08</code></a>
docs: fix FAQ grammar in httplib2 example</li>
<li><a
href="774a0b837a"><code>774a0b8</code></a>
docs(socks): same block as other sections</li>
<li><a
href="9c72a41bec"><code>9c72a41</code></a>
Bump github/codeql-action from 4.33.0 to 4.34.1</li>
<li><a
href="ebf7190679"><code>ebf7190</code></a>
Bump github/codeql-action from 4.32.0 to 4.33.0</li>
<li><a
href="0e4ae38f0c"><code>0e4ae38</code></a>
docs: exclude Response.is_permanent_redirect from API docs (<a
href="https://redirect.github.com/psf/requests/issues/7244">#7244</a>)</li>
<li><a
href="d568f47278"><code>d568f47</code></a>
docs: clarify Quickstart POST example (<a
href="https://redirect.github.com/psf/requests/issues/6960">#6960</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/psf/requests/compare/v2.32.5...v2.33.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=requests&package-manager=uv&previous-version=2.32.5&new-version=2.33.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-26 09:52:49 -07: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
Ákos Tóth
08b9aa04ab
fix: coalesce consecutive same-role messages in Bedrock Converse translation (#1358)
## Summary

The OpenAI Chat Completions API represents parallel tool results as
separate `tool` role messages. When translating to Bedrock's Converse
API, each is mapped to a Bedrock `User` message. This produces
consecutive same-role messages, which Bedrock rejects (messages must
strictly alternate user/assistant).

The same issue exists in the Responses API path where consecutive
`FunctionCallOutput` and `CustomToolCallOutput` items each produce
separate `User` messages.

## Changes

- Add `helpers::coalesce_consecutive_messages` — merges consecutive
messages with the same role by combining their content vectors
- Apply in `from_completions::translate_internal` after message
collection
- Apply in `from_responses` after the message-building loop
- The `from_messages` (Anthropic) path is unaffected because Anthropic
format already bundles tool results into a single user message

## Testing

- Added
`test_completions_consecutive_tool_messages_are_merged_into_single_user_message`
— constructs an OpenAI request with an assistant message containing two
parallel tool calls followed by two consecutive tool result messages,
verifies the output has 3 Bedrock messages (User, Assistant, User) with
both ToolResult blocks merged into the final User message
- All 27 existing bedrock conversion tests continue to pass

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-03-26 09:11:10 -07:00
dependabot[bot]
eb560f3142
build(deps): bump the npm_and_yarn group across 1 directory with 1 update (#1360)
Bumps the npm_and_yarn group with 1 update in the /ui directory:
[picomatch](https://github.com/micromatch/picomatch).

Updates `picomatch` from 2.3.1 to 2.3.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/picomatch/releases">picomatch's
releases</a>.</em></p>
<blockquote>
<h2>2.3.2</h2>
<p>This is a security release fixing several security relevant
issues.</p>
<h2>What's Changed</h2>
<ul>
<li>fix: exception when glob pattern contains constructor by <a
href="https://github.com/Jason3S"><code>@​Jason3S</code></a> in <a
href="https://redirect.github.com/micromatch/picomatch/pull/144">micromatch/picomatch#144</a></li>
<li>Fix for <a
href="https://github.com/micromatch/picomatch/security/advisories/GHSA-c2c7-rcm5-vvqj">CVE-2026-33671</a></li>
<li>Fix for <a
href="https://github.com/micromatch/picomatch/security/advisories/GHSA-3v7f-55p6-f55p">CVE-2026-33672</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2">https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md">picomatch's
changelog</a>.</em></p>
<blockquote>
<h1>Release history</h1>
<p><strong>All notable changes to this project will be documented in
this file.</strong></p>
<p>The format is based on <a
href="http://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>
and this project adheres to <a
href="http://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p>
<!-- raw HTML omitted -->
<ul>
<li>Changelogs are for humans, not machines.</li>
<li>There should be an entry for every single version.</li>
<li>The same types of changes should be grouped.</li>
<li>Versions and sections should be linkable.</li>
<li>The latest version comes first.</li>
<li>The release date of each versions is displayed.</li>
<li>Mention whether you follow Semantic Versioning.</li>
</ul>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Changelog entries are classified using the following labels <em>(from
<a href="http://keepachangelog.com/">keep-a-changelog</a></em>):</p>
<ul>
<li><code>Added</code> for new features.</li>
<li><code>Changed</code> for changes in existing functionality.</li>
<li><code>Deprecated</code> for soon-to-be removed features.</li>
<li><code>Removed</code> for now removed features.</li>
<li><code>Fixed</code> for any bug fixes.</li>
<li><code>Security</code> in case of vulnerabilities.</li>
</ul>
<!-- raw HTML omitted -->
<h2>4.0.0 (2024-02-07)</h2>
<h3>Fixes</h3>
<ul>
<li>Fix bad text values in parse <a
href="https://redirect.github.com/micromatch/picomatch/issues/126">#126</a>,
thanks to <a
href="https://github.com/connor4312"><code>@​connor4312</code></a></li>
</ul>
<h3>Changed</h3>
<ul>
<li>Remove process global to work outside of node <a
href="https://redirect.github.com/micromatch/picomatch/issues/129">#129</a>,
thanks to <a
href="https://github.com/styfle"><code>@​styfle</code></a></li>
<li>Add sideEffects to package.json <a
href="https://redirect.github.com/micromatch/picomatch/issues/128">#128</a>,
thanks to <a
href="https://github.com/frandiox"><code>@​frandiox</code></a></li>
<li>Removed <code>os</code>, make compatible browser environment. See <a
href="https://redirect.github.com/micromatch/picomatch/issues/124">#124</a>,
thanks to <a
href="https://github.com/gwsbhqt"><code>@​gwsbhqt</code></a></li>
</ul>
<h2>3.0.1</h2>
<h3>Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="81cba8d4b7"><code>81cba8d</code></a>
Publish 2.3.2</li>
<li><a
href="fc1f6b6900"><code>fc1f6b6</code></a>
Merge commit from fork</li>
<li><a
href="eec17aee54"><code>eec17ae</code></a>
Merge commit from fork</li>
<li><a
href="78f8ca4362"><code>78f8ca4</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/picomatch/issues/156">#156</a>
from micromatch/backport-144</li>
<li><a
href="3f4f10eaa6"><code>3f4f10e</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/picomatch/issues/144">#144</a>
from Jason3S/jdent-object-properties</li>
<li>See full diff in <a
href="https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2">compare
view</a></li>
</ul>
</details>
<br />

Updates `picomatch` from 4.0.3 to 4.0.4
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/picomatch/releases">picomatch's
releases</a>.</em></p>
<blockquote>
<h2>2.3.2</h2>
<p>This is a security release fixing several security relevant
issues.</p>
<h2>What's Changed</h2>
<ul>
<li>fix: exception when glob pattern contains constructor by <a
href="https://github.com/Jason3S"><code>@​Jason3S</code></a> in <a
href="https://redirect.github.com/micromatch/picomatch/pull/144">micromatch/picomatch#144</a></li>
<li>Fix for <a
href="https://github.com/micromatch/picomatch/security/advisories/GHSA-c2c7-rcm5-vvqj">CVE-2026-33671</a></li>
<li>Fix for <a
href="https://github.com/micromatch/picomatch/security/advisories/GHSA-3v7f-55p6-f55p">CVE-2026-33672</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2">https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md">picomatch's
changelog</a>.</em></p>
<blockquote>
<h1>Release history</h1>
<p><strong>All notable changes to this project will be documented in
this file.</strong></p>
<p>The format is based on <a
href="http://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>
and this project adheres to <a
href="http://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p>
<!-- raw HTML omitted -->
<ul>
<li>Changelogs are for humans, not machines.</li>
<li>There should be an entry for every single version.</li>
<li>The same types of changes should be grouped.</li>
<li>Versions and sections should be linkable.</li>
<li>The latest version comes first.</li>
<li>The release date of each versions is displayed.</li>
<li>Mention whether you follow Semantic Versioning.</li>
</ul>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Changelog entries are classified using the following labels <em>(from
<a href="http://keepachangelog.com/">keep-a-changelog</a></em>):</p>
<ul>
<li><code>Added</code> for new features.</li>
<li><code>Changed</code> for changes in existing functionality.</li>
<li><code>Deprecated</code> for soon-to-be removed features.</li>
<li><code>Removed</code> for now removed features.</li>
<li><code>Fixed</code> for any bug fixes.</li>
<li><code>Security</code> in case of vulnerabilities.</li>
</ul>
<!-- raw HTML omitted -->
<h2>4.0.0 (2024-02-07)</h2>
<h3>Fixes</h3>
<ul>
<li>Fix bad text values in parse <a
href="https://redirect.github.com/micromatch/picomatch/issues/126">#126</a>,
thanks to <a
href="https://github.com/connor4312"><code>@​connor4312</code></a></li>
</ul>
<h3>Changed</h3>
<ul>
<li>Remove process global to work outside of node <a
href="https://redirect.github.com/micromatch/picomatch/issues/129">#129</a>,
thanks to <a
href="https://github.com/styfle"><code>@​styfle</code></a></li>
<li>Add sideEffects to package.json <a
href="https://redirect.github.com/micromatch/picomatch/issues/128">#128</a>,
thanks to <a
href="https://github.com/frandiox"><code>@​frandiox</code></a></li>
<li>Removed <code>os</code>, make compatible browser environment. See <a
href="https://redirect.github.com/micromatch/picomatch/issues/124">#124</a>,
thanks to <a
href="https://github.com/gwsbhqt"><code>@​gwsbhqt</code></a></li>
</ul>
<h2>3.0.1</h2>
<h3>Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="81cba8d4b7"><code>81cba8d</code></a>
Publish 2.3.2</li>
<li><a
href="fc1f6b6900"><code>fc1f6b6</code></a>
Merge commit from fork</li>
<li><a
href="eec17aee54"><code>eec17ae</code></a>
Merge commit from fork</li>
<li><a
href="78f8ca4362"><code>78f8ca4</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/picomatch/issues/156">#156</a>
from micromatch/backport-144</li>
<li><a
href="3f4f10eaa6"><code>3f4f10e</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/picomatch/issues/144">#144</a>
from Jason3S/jdent-object-properties</li>
<li>See full diff in <a
href="https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-26 07:53:13 -07:00
apexlnc
74f7f33f41
feat(mcp): Expose tool payloads on the MCP CEL context (#1331)
Expose MCP tool call payloads through the existing `mcp` CEL surface
instead of introducing a second post-request variable.

Request-time CEL and authorization still use `mcp` as the MCP identity
surface, so RBAC expressions like `mcp.tool.name` and `mcp.tool.target`
keep working unchanged. After request handling completes, the same `mcp`
object can also carry `methodName`, `sessionId`, and tool payload fields
such as `mcp.tool.arguments`, `mcp.tool.result`, and `mcp.tool.error`.

That keeps the public CEL model simpler than the earlier `mcp` plus
`mcpLog` split, removes one extra MCP context type, and keeps the
generated schema honest about the one object users actually query.
Internally, authz still evaluates the smaller identity-only subset,
while post-request logging and tracing evaluate the richer post-response
view of the same MCP object.

For `tools/call`, the schema now explicitly documents:
- `mcp.methodName`
- `mcp.sessionId`
- `mcp.tool.target`
- `mcp.tool.name`
- `mcp.tool.arguments`
- `mcp.tool.result`
- `mcp.tool.error`

That means access-log CEL can use config like:

```yaml
frontendPolicies:
  accessLog:
    add:
      mcp_tool_name: mcp.tool.name
      mcp_method: mcp.methodName
      mcp_session: mcp.sessionId
      mcp_args: mcp.tool.arguments
      mcp_result: mcp.tool.result
      mcp_error: mcp.tool.error
```

Under multiplexing, `mcp.tool.target` and `mcp.tool.name` reflect the
resolved upstream target and resolved tool name after gateway routing,
which matches the identity used during authorization.

Legacy SSE keeps its non-blocking `202 Accepted` POST behavior, so
terminal result and error payloads remain absent from the POST access
log on that transport. Streamable HTTP exposes the full post-request MCP
payload surface. This branch also regenerates the CEL schema/docs,
removes redundant field-specific CEL tests, reuses the shared proxy test
setup for MCP access-log coverage, and adds end-to-end MCP coverage for
both transports.

Validated with `make gen`, `make lint`, and `make test`.
2026-03-25 17:10:29 -07:00
Steven Landow
36c8677bf2
allow attaching routes to services (#1353)
https://github.com/agentgateway/agentgateway/pull/1352 could set this
ServiceKey to attach routes directly to services

* add serviceKey to the Route and TCPRoute protos
* plumb serviceKey from ParentInfo into those protos as routes are
attached to their parents
* refactor route selection in the proxy to share some code between paths
that use service or listener attached routes

most of the diff is proto regen + tests
2026-03-25 17:02:14 -07:00
Christian Posta
c48ebfd6da
read oas doc servers and pick out the path prefixes, not the full ser… (#1289)
…ver since that is specified in the agentgateway backend

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-03-25 15:07:59 -07:00
John Howard
36742d9207
controller: refactor out MCP translation (#1356)
this was one big function that was hard to grok; split it up to simplify
2026-03-25 15:05:08 -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
Eitan Yarmush
91868fb70b
Add auto-TLS protocol detection with BindProtocol::auto (#1333)
Adds a new `BindProtocol::auto` variant that peeks at the first byte of
incoming connections to determine whether to handle them as TLS (0x16)
or plaintext HTTP. This allows a single bind to serve both protocols.

Also makes ProxyInputs fields public with a new() constructor, and
exposes the telemetry module. Includes tests for auto-detect of
plaintext HTTP, TLS via ClientHello, and SNI mismatch rejection.

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:16:24 -07:00
tot19
f9a7fbe5cf
feat(mcp): merge upstream instructions when multiplexing (#1347)
## Summary

- When multiplexing multiple MCP backend targets, `merge_initialize`
discarded all upstream servers' instructions and replaced them with a
hardcoded gateway description
- Upstream instructions are now collected from each backend's
`InitializeResult` and merged into the final response, prefixed with the
server name for disambiguation
- Added three unit tests covering: merged instructions with multiple
backends, no upstream instructions, and single backend without
multiplexing

Closes #1346

## Test plan

- [x] `cargo test -p agentgateway test_merge_initialize` — 3 new unit
tests pass
- [x] `cargo test -p agentgateway` — all 82 tests pass
- [x] `make lint` — passes (fmt + clippy)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 16:55:59 +00:00
Steven Landow
a536a5d18c
allow plugging in parentRef resolution (#1352)
A plugin that add routes can re-use the main route generation logic but
re-implement or wrap this interface to allow changing the parentRef
lookup behavior.
2026-03-25 09:48:07 -07:00
Steven Landow
8f6c538890
expose ancestor backends from plugins (#1351)
We can add routes and backends, but without sending the ancestor
information the backends will not be sent to the proxy because they
don't seem to be referenced by any route.
2026-03-25 16:39:14 +00:00
John Howard
be0d630dd2
Better rendering of json schema to markdown (#1343) 2026-03-25 09:34:18 -07:00
John Howard
a10e46a8f5
ci: pin GHA (#1350) 2026-03-25 09:34:10 -07:00
Ákos Tóth
24166a1075
fix: route non-success streaming responses through buffered error path (#1348)
## Summary

When a streaming request (`stream: true` in OpenAI Chat Completions, or
`stream: true` in Anthropic Messages) receives a non-2xx error response
from the backend, the error response body is silently dropped. The
client receives the correct status code and headers (including
`Content-Length`) but zero body bytes, causing `unexpected EOF` /
`connection closed before message completed`.

## Root Cause

`process_response` dispatches to `process_streaming` based solely on
`req.streaming`, without checking the response status:

```rust
if req.streaming {
    return self.process_streaming(req, ..., resp).await;
}
```

Backend error responses (4xx, 5xx) are plain JSON (`application/json`),
not event-stream data. The streaming parsers — specifically the AWS
EventStream decoder for Bedrock — interpret the JSON bytes as binary
frame headers. For example, `{"me` (the start of `{"message":"..."}`')
is read as a big-endian u32 frame length of ~2 GB. The decoder returns
`Incomplete` forever, producing zero output bytes.

Meanwhile, the original `Content-Length` header from the backend is
preserved through `resp.map(|b| ...)`. The client sees `Content-Length:
116` but receives 0 bytes → `unexpected EOF`.

The non-streaming path correctly handles errors via `process_error` →
`translate_error`, but is unreachable when `req.streaming == true`.

## Fix

Add a response status check before entering the streaming path:

```rust
if req.streaming && resp.status().is_success() {
    return self.process_streaming(req, ..., resp).await;
}
```

Non-success responses now fall through to the buffered path where
`process_error` translates the backend error format to the frontend
format and the body is forwarded intact.

## Impact

This affects **every** streaming request to any backend that returns
plain JSON error responses — which is standard behavior for AWS Bedrock,
and likely other providers. Without this fix, clients cannot read error
details from streaming requests, making debugging backend rejections
(e.g. `ValidationException`) impossible.

Fixes #1340

---------

Co-authored-by: Skynet <noreply@dynatrace.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-03-25 16:19:38 +00:00
John Howard
c3da9a38d3
controller: more extension points (#1342)
* Make status able to share the StatusSync logic
* Now that target refs are extensible, we also need the presence of the
  target object to be; extend that interface slightly
2026-03-24 15:20:14 -07:00
John Howard
3d246e21b2
Bump cargo deps (#1327) 2026-03-24 12:46:04 -07:00
John Howard
229f50294e
Use TLSRoute v1 for status writing (#1325) 2026-03-24 11:27:45 -07:00
John Howard
5ecb337374
controller: add backend plugins and extensible reference types (#1326) 2026-03-24 10:42:46 -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
e24c1aaf21
release: fix chart registry (#1336)
regressionin 4da7b7637

fixes https://github.com/agentgateway/agentgateway/issues/1332
2026-03-24 08:05:54 -07:00
Lawrence G.
aa196aa940
helm: add valueFrom support to extraEnv (#1329)
extends the `controller.extraEnv` value to support `valueFrom` K8s
sources, e.g. `Secrets`

Signed-off-by: Lawrence Gadban <lawrence.gadban@solo.io>
2026-03-24 08:05:36 -07:00
John Howard
d7604e9aa0
cel: fix LLM RL by avoiding using removed req extensions (#1317)
This was a bug we worked around in MCP but not in LLM; I think the MCP
fix was not ideal so changed it to use this approach consistently which
should be a lot harder to mess up
2026-03-23 16:15:46 -07:00
John Howard
75906e35b8
cel: fix lookup string in list (#1324) 2026-03-23 15:57:54 -07:00
Steven Landow
cab1f2b8af
proxy: respect Service SANs field (#1322)
We were ignoring this WDS field, control planes can set a list of SANs
on a Service and we should allow them when creating the mesh TLS.
2026-03-23 15:21:03 -07:00
John Howard
1ddcb20785
controller: consistently use Gateway as policy parent (#1323)
Before we had some type-specific status handling. Now, we consistently
report up the Gateway that the target is attached to as part of the
status with deduping.

The dedupe is concerning since translatePolicyToAgw is called
per-target, which means in theory they could return different errors.
and, its computed redundantly. This is refactored to just call translate
once and then build a per-target condition.
2026-03-23 14:53:31 -07:00
John Howard
bc4d3104ec
refactor: remove some setup indirection. (#1320)
We go struct -> functional options -> struct... no benefit.
2026-03-23 14:34:59 -07:00
John Howard
e1be6afa65
controller: do not allow policy backends to target InferencePool (#1321)
This code is used for things like referencing ext rate limit, ext auth,
ext proc, etc servers. Pointing to an InferencePool makes no ense at
all.

This does NOT prevent attaching policies or routes to inferencePool
2026-03-23 11:26:46 -07:00
John Howard
63ddb7123f
policy: better failure modes for translation failures (#1245)
This PR attempts to document and rationalize our failure modes during
translation. The idea is to pick a logical best option for each type of
policy, that generally results in "fails at runtime" and NOT "policy is
silently ignored". For policies where there is a 'fail open' mode that
is respected.

As part of this, the PR fixes a number of bad behaviors. Below lists the
_current behaviors_

# Failure modes

**External Authorization (ExtAuth)**: backend ref can fail, making it
"invalid". Proxy fails or doesn't based on failure mode *which is not
exposed in CRD so is always fail-closed today*.
**External Processor (ExtProc)**: Same as above; always fail-closed
**JWT Authentication**: invalid provider is skipped and thus cannot
match
**Basic Authentication**: Keys we cannot fetch are elided, so no keys
will match
**API Key Authentication**: Keys we cannot fetch are elided, so no keys
will match. If we fetch multiple keys and some are invalid, the valid
keys will still work.
**Authorization (RBAC)**: invalid expressions will be treated as runtime
errors. "Allow" never matches (so will never allow), "Deny" also never
matches (so will never deny!!); "Require" mode would be a safer "Deny"
**Global Rate Limit**: same as ext authz. Failure mode exists but NOT
exposed in CRD
**Transformation (Headers/Body)**: invalid expressions will be treated
as runtime errors. These will strip the header we processing or empty
the body.
**Retry**: backoff: disabled (should be impossible), attempts: clamped
to 0..255
**Local Rate Limit**: cannot fail
**CORS**: cannot fail
**CSRF**: cannot fail
**Header Modifiers**: cannot fail
**Hostname Rewrite**: cannot fail
**Timeouts**: cannot fail
**Direct Response**: cannot fail


**Frontend TCP**: cannot fail
**Frontend TLS**: cannot fail
**Frontend HTTP**: cannot fail
**Access Logging**: backend ref can fail, making it "invalid". Calls
will fail to export which will do.... ???. Missing status for CEL
expressions. Invalid CEL expressions will make the attribute not log,
filter not match, etc.
**Tracing**: backend ref can fail, making it "invalid". Calls will fail
to export which will do.... ???. Missing status for CEL expressions.
Invalid CEL expressions will make the attribute not log, sample never
match, etc.


**Backend TLS**: MtlsCertificateRef not found, does not use any client
auth. This seems right, since then the server will probably reject which
is fine. CACertificateRefs missing will not include those; also seems
right as it will (probably) make them reject.
**Backend HTTP**: cannot fail
**Backend TCP**: does nothing! TODO.
**Backend Tunnel (HTTPS Proxy)**: invalid backend ref will make the
backend invalid and thus block requests.
**Backend Auth (API Keys, AWS, Azure, GCP)**: For missing key, always
set to an empty value. AWS: sets empty values which I assume proxy fails
at runtime with. Azure: same as AWS. GCP: cannot fail.
**Backend Health (Eviction)**: cannot fail
**AI Policy (Prompts, Guards, Aliases)**: Invalid defaults or overrides
are ignored, but should not be possible. Invalid transformation CEL
expressions are reported as status and sent to the data plane, where it
will wipe out the field if it fails. Invalid prompt guards are ignored
entirely
**MCP Authorization**: Same as Authorization; CEL expressions not
checked for status either
**MCP Authentication**: If we cannot resolve JWKS we will get no JWKS
which will never validate a request. an invalid keys in ResourceMetadata
(should be impossible) are stripped
2026-03-23 11:24:14 -07:00
John Howard
59fc168e86
cel: catch struct usage (#1319)
fixes https://github.com/agentgateway/agentgateway/issues/1308
2026-03-23 10:50:49 -07:00
BHUKYA VENKATESH
7e12290560
perf: optimize timecaching and client string allocation (#1315)
This PR attempts to perform a couple of optimizations wrt connection
pooling.

Relates to #1155

Optimizations:

1. Handed now() down through the Timer trait to cache the current time
during intensive pool iterations, minimizing system calls. The current
setup calls Instant::now() for each connection in the pool to expire
existing connections and grab a valid one. This PR optimizes this by
caching the time at the start of the loop, so all expiration checks in
the request flow use the cached timestamp instead of making repeated
syscalls.
2. Converted the HOST header generation to use zero-copy Bytes, avoiding
extra string allocations. (Minor optimization)

---------

Co-authored-by: BV-Venky <venkateshcjjc@@gmail.com>
2026-03-23 10:32:17 -07:00
Jackson Greer
426995f513
feat(llm): azure default authentication (#1033)
Use default azure chain of credentials when the following auth
configuration is used.
```
policies:
    backendAuth:
        azure:
            implicit: {}
```
The chain is as follows:
```
EnvironmentCredential -> WorkloadIdentityCredential -> ManagedIdentityCredential -> DeveloperToolsCredential
```
and is based on the [Azure gosdk
chain](https://learn.microsoft.com/en-us/azure/developer/go/sdk/authentication/credential-chains#defaultazurecredential-overview).

Fixes #865
2026-03-23 10:28:09 -07:00
dependabot[bot]
594bf5aac3
build(deps): bump rustls-webpki from 0.103.9 to 0.103.10 (#1309)
Bumps [rustls-webpki](https://github.com/rustls/webpki) from 0.103.9 to
0.103.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rustls/webpki/releases">rustls-webpki's
releases</a>.</em></p>
<blockquote>
<h2>0.103.10</h2>
<p><strong>Correct selection of candidate CRLs by Distribution Point and
Issuing Distribution Point</strong>. If a certificate had more than one
<code>distributionPoint</code>, then only the first
<code>distributionPoint</code> would be considered against each CRL's
<code>IssuingDistributionPoint</code> <code>distributionPoint</code>,
and then the certificate's subsequent <code>distributionPoint</code>s
would be ignored.</p>
<p>The impact was that correct provided CRLs would not be consulted to
check revocation. With <code>UnknownStatusPolicy::Deny</code> (the
default) this would lead to incorrect but safe
<code>Error::UnknownRevocationStatus</code>. With
<code>UnknownStatusPolicy::Allow</code> this would lead to inappropriate
acceptance of revoked certificates.</p>
<p>This vulnerability is thought to be of limited impact. This is
because both the certificate and CRL are signed -- an attacker would
need to compromise a trusted issuing authority to trigger this bug. An
attacker with such capabilities could likely bypass revocation checking
through other more impactful means (such as publishing a valid, empty
CRL.)</p>
<p>More likely, this bug would be latent in normal use, and an attacker
could leverage faulty revocation checking to continue using a revoked
credential.</p>
<p>This vulnerability is identified by <a
href="https://github.com/rustls/webpki/security/advisories/GHSA-pwjx-qhcg-rvj4">GHSA-pwjx-qhcg-rvj4</a>.
Thank you to <a href="https://github.com/1seal"><code>@​1seal</code></a>
for the report.</p>
<h2>What's Changed</h2>
<ul>
<li>Freshen up rel-0.103 by <a
href="https://github.com/ctz"><code>@​ctz</code></a> in <a
href="https://redirect.github.com/rustls/webpki/pull/455">rustls/webpki#455</a></li>
<li>Prepare 0.103.10 by <a
href="https://github.com/ctz"><code>@​ctz</code></a> in <a
href="https://redirect.github.com/rustls/webpki/pull/458">rustls/webpki#458</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/rustls/webpki/compare/v/0.103.9...v/0.103.10">https://github.com/rustls/webpki/compare/v/0.103.9...v/0.103.10</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="348ce01c01"><code>348ce01</code></a>
Prepare 0.103.10</li>
<li><a
href="dbde592116"><code>dbde592</code></a>
crl: fix authoritative_for() support for multiple URIs</li>
<li><a
href="9c4838e612"><code>9c4838e</code></a>
avoid std::prelude imports</li>
<li><a
href="009ef667e3"><code>009ef66</code></a>
fix rust 1.94 ambiguous panic macro warnings</li>
<li><a
href="c41360d095"><code>c41360d</code></a>
build(deps): bump taiki-e/cache-cargo-install-action from 2 to 3</li>
<li><a
href="e401d0083d"><code>e401d00</code></a>
generate.py: reformat for black 2026.1.0</li>
<li><a
href="06cedecbf6"><code>06cedec</code></a>
Take semver-compatible deps</li>
<li>See full diff in <a
href="https://github.com/rustls/webpki/compare/v/0.103.9...v/0.103.10">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rustls-webpki&package-manager=cargo&previous-version=0.103.9&new-version=0.103.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/agentgateway/agentgateway/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 10:25:02 -07:00
John Howard
b505b09ea5
deps: try dependabot (#1303)
Set to do security releases only, except for cargo where we bump in a
group weekly. I don't trust the Go stuff given our hairy dependency tree
so will keep those manual.
2026-03-20 14:34:10 -07:00
Nina Polshakova
f0f27ad440
fix keycloak mcp auth (#1306)
Tested locally with config + mcp inspector + keycloak running locally in
kind:
```
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
binds:
- listeners:
  - routes:
    - backends:
      - mcp:
          targets:
          - name: everything
            stdio:
              args:
              - '@modelcontextprotocol/server-everything'
              cmd: npx
      matches:
      - path:
          exact: /keycloak/mcp
      - path:
          exact: /.well-known/oauth-protected-resource/keycloak/mcp
      - path:
          exact: /.well-known/oauth-authorization-server/keycloak/mcp
      - path:
          exact: /.well-known/oauth-authorization-server/keycloak/mcp/client-registration
      policies:
        cors:
          allowHeaders:
          - mcp-protocol-version
          - content-type
          allowOrigins:
          - '*'
          exposeHeaders:
          - Mcp-Session-Id
        mcpAuthentication:
          issuer: http://localhost:7080/realms/master
          audiences:
          - mcp_proxy
          jwks:
            url: http://localhost:7080/realms/master/protocol/openid-connect/certs
          provider:
            keycloak: {}
          resourceMetadata:
            resource: http://localhost:3000/keycloak/mcp
            scopesSupported:
            - email
            - openid
            bearerMethodsSupported:
            - header
            - body
            - query
            resourceDocumentation: http://localhost:3000/keycloak/docs
            resourcePolicyUri: http://localhost:3000/keycloak/policies
  port: 3000

```

<img width="1354" height="799" alt="Screenshot 2026-03-20 at 2 32 12 PM"
src="https://github.com/user-attachments/assets/5f1c5d6d-e3c6-455c-80bc-fffc2718210a"
/>

Fixes: https://github.com/agentgateway/agentgateway/issues/1294

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-20 18:41:23 +00:00
Markus Kobler
715299dac4
ui: bump monaco-editor dep (#1305) 2026-03-20 17:31:51 +00:00
John Howard
dab1d0492a
tool dependency update (#1302) 2026-03-20 10:12:32 -07:00
John Howard
49f6cadb3d
gha: print out CPU used (#1296) 2026-03-20 09:45:22 -07:00
John Howard
8b217ffc4c
Bump go, rust, npm, python deps (#1301) 2026-03-20 09:44:42 -07:00
John Howard
27aca3c2aa
cel: drop inline (#1300)
This doesn't make much sense since its recursive. This makes the binary
smaller and actually seems to be a slight improvement in benchmarks
2026-03-20 09:44:31 -07: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
John Howard
62ebad4092
gcp: fix auth when no ADC present (#1291) 2026-03-20 09:29:09 -07:00
John Howard
454bf45026
Misc refactoring of routes (#1292)
1. Avoid special handling of InternalName where we need to cut it and
   assume knowledge. Instead just pass what we need
2. Avoid excessive nesting of functions for route generation.
2026-03-20 09:28:59 -07:00
John Howard
409e962136
mcp: fix failOpen in k8s (#1299) 2026-03-20 09:17:00 -07:00
John Howard
829362b36a
Fix local regex path match and prefix rewrite (#1284)
Before you had to set the length of the regex which was obviously wrong.

For prefix, we didn't properly handle trailing / in the matcher
2026-03-20 09:04:49 -07:00
John Howard
907b335de5
Bump gtw to v1.5.1 and gie to v1.4.0 (#1238) 2026-03-20 08:50:09 -07:00
Steven Landow
880d8fb61f
refactor: make core wds collection pluggable (#1285)
refactor the core wds collection init to make it easier to
change/override when wee want to work around istio changes

additionally, removing some unused
WithWorkloadAddressProviderFunc/WithServiceAddressProviderFunc

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-19 09:48:52 -07:00
John Howard
4757715b70
local llm: automatically handle responses compaction (#1283) 2026-03-19 09:22:08 -07:00
John Howard
21a9f7334a
proto: unify helper functions for shared proto objects (#1279) 2026-03-19 09:16:42 -07:00
Nina Polshakova
b65b65a4fa
DNS lookup family (#1273)
You can use this either as an env:
```
DNS_LOOKUP_FAMILY=V4Only agentgateway -f config.yaml
```

Or with the config:
```
config:
  enableIpv6: false # restrict to only ipv4
  dns:
     lookupFamily: V4Only # Controls which DNS address families are queried. V4Only means only A records (IPv4), skipping AAAA (IPv6) lookups
     edns0: true #  Enables EDNS0 (Extension Mechanisms for DNS), which allows larger DNS responses and supports features like DNSSEC.
```

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-03-19 09:10:08 -07:00
John Howard
9f735ed5b4
tracing: use a stable scope name (#1278)
serviec.name is intended to change while scope name is more like the
library or SDK emitting it

Originally changed in
https://github.com/agentgateway/agentgateway/pull/712, this reverts back
2026-03-19 07:58:03 -07:00
John Howard
d8a3996074
ext authz: finish query param impl (#1272) 2026-03-18 16:54:03 -07:00
noot
d9b88d820b
fix: fix xds select loop potential deadlock (#1276)
Fix potential deadlock in select loop by not `await`ing inside select
branches; instead push the futures to `FuturesUnordered` and poll them
in their own branches.

Previously, each branch sent on the bounded `discovery_req_tx` channel.
If the channel was full then the branch would block until the channel
had room. the ADS server has the receiver side of the channel. If the
server was backlogged or shut down, then once the channel filled up the
send would block forever. If the server is expecting `response_stream`
to be consumed before reading from `discovery_req_rx` then this would
deadlock if the channel gets full, as `send()` would block and no other
branches would be able to make progress. Also `demand`s are publicly
exposed so a library consumer sending a bunch of demands could also
cause this to happen.

By not `await`ing in any of the select branches, the loop can still make
progress even if sending on the `discovery_req_tx` channel is blocked.
2026-03-18 23:50:00 +00:00
John Howard
aec87fc7e1
cel: add back serializing null values (#1277)
See https://github.com/agentgateway/agentgateway/issues/1262

In https://github.com/agentgateway/agentgateway/pull/877 we changed the
top level vars to be conditionally available. I think this was a
mistake, as can be seen in the issue.

One of things I had hoped this enabled was `has(jwt)` which doesn't work
anyways; has MUST have at least one field selection like `x.b`.
2026-03-18 16:34:10 -07:00
John Howard
2efacb8010
refactor: move protos to shared crate (#1271)
Primary goal here is to reuse the code for shared protos, but also some
good compile wins. 3s -> 2.5s incremental compile
2026-03-18 16:00:09 -07:00
John Howard
b658ec994c
embeddings: fix token counting for openai (#1275)
We had an e2e test but it didn't assert the token count
2026-03-18 15:52:10 -07:00
John Howard
9c29c1a4c4
cel: add cookie helper functions (#1269) 2026-03-18 15:49:21 -07:00
John Howard
4e5710de83
local llm: allow file API key (#1274) 2026-03-18 15:43:37 -07:00
Adam Gordon
4c281ebbc3
Add application/json Content-Type header to /v1/models response (#1258)
# What does this PR do?

When using the top-level llm configuration block, Agentgateway
synthesizes a default route for /v1/models and returns a hardcoded JSON
payload via the DirectResponse policy. However, this response was
missing the Content-Type: application/json header.
Without this header, strict OpenAI-compatible clients (like PyCharm's
LLM plugin, curl defaults, or strict HTTP clients) fail to parse the
response, throwing content-type or transformation errors.
This PR fixes the issue by injecting a ResponseHeaderModifier policy
directly into the synthesized model_list_route's inline_policies array,
ensuring the Content-Type: application/json header is properly attached
to the response before the DirectResponse short-circuits.

# Why is this important?

Ensures 100% compatibility with strict HTTP clients expecting standard
OpenAPI/OpenAI headers.
Allows developer tools like JetBrains IDEs to successfully fetch and
parse the available proxy models without resorting to manual bind
workarounds or intercepting external mock servers.

# Testing:

Compiled and tested locally using cargo check & cargo run.
Sent a GET /v1/models request against the llm listener port and verified
the Content-Type: application/json header is now present in the HTTP
response.

---------

Co-authored-by: Cortana Claw <cortana-bot@adamgordon.ca>
Co-authored-by: John Howard <john.howard@solo.io>
2026-03-18 15:02:20 -07:00
John Howard
c90990f210
cel: expose query parameter functions (#1268) 2026-03-18 13:00:48 -07:00
John Howard
9a390bd2bf
cel: add env as top level var (#1264) 2026-03-18 10:43:42 -07:00
John Howard
13a04ddee7
mcp: use agentgateway as server name instead of rmcp (#1267) 2026-03-18 10:35:30 -07:00
John Howard
99d1f208ec
local: set default path match (#1218)
Makes no sense that to set a header match, I need to also set a path
match
2026-03-18 09:30:36 -07:00
John Howard
4c481a3ce6
cel: add unvalidatedJwtPayload() function (#1243)
The wordy name is to make it clear its NOT validated. However, still can
be handy in some cases.
2026-03-18 09:30:23 -07:00
John Howard
d7ec01d42b
tracing: fix start time on span (#1254)
Fixes https://github.com/agentgateway/agentgateway/issues/1248
2026-03-18 08:57:18 -07:00
MaYuanyuan
2b4f64eb03
fix: omit null cached_tokens in ai response for better compatibility (#1261)
agentgateway currently sets cached_tokens to null when absent, breaking
clients that expect the field to be either a number or omitted. This PR
skips serialization when None to prevent unexpected null values in the
response.
2026-03-18 08:33:42 -07:00
John Howard
f6b2b51710
cel: add coalesce() function (#1242) 2026-03-17 18:30:50 -07:00
John Howard
f1d3cbad14
Local LLM config: sort configs by order (#1256)
For https://github.com/agentgateway/agentgateway/issues/1215
2026-03-17 13:35:08 -07:00
Nina Polshakova
a72d8bf5ef
DNS resolve offline fix (#1253)
Allows running agentgateway standalone when offline by looking up
entries in /etc/hosts. Before the proxy would not start in standalone
mode if it was offline:
```
❯ agentgateway -f config.yaml
Error: proto error: io error: no nameservers found in config
```

The hickory ResolveHosts has three options:
- Always (new behavior): Always check /etc/hosts first. If the hostname
is found there, use it; otherwise fall through to DNS.
- Never: Skip /etc/hosts entirely, always go straight to DNS. 
- Auto (old behavior): Only use /etc/hosts when the resolver is not
being used as a DNS forwarder.

So the fallback behavior now works like this:
1. read system DNS config (/etc/resolv.conf). If that fails → use Google
defaults (8.8.8.8, etc.) with default opts.
2. If system config parsed successfully but has no nameservers → use
Google defaults for nameservers, but keep the parsed opts
3. Regardless of which path was taken, CachedResolver::new forces
use_hosts_file = Always, so /etc/hosts is always consulted before DNS
queries

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-17 11:25:26 -07:00
apexlnc
772c618820
telemetry: make spans hierarchical and refine MCP telemetry (#1230)
## Summary

This PR changes agentgateway tracing from link-based upstream
relationships to explicit parent/child relationships when an incoming
`traceparent` is present.

It also:
- parents buffered `SpanWriter` spans under the request span
- switches to fresh explicit OTEL contexts (`Context::new()`) so
parenting is deterministic
- updates MCP telemetry mapping/naming to align with OTel GenAI/MCP
semantic conventions v1.40
- adds focused tests for request-span and `SpanWriter` topology

## Why

The current behavior shares the caller's `trace_id`, but uses span links
rather than `parent_span_id`, so the gateway span usually renders as a
sibling root instead of a child of the caller.

Before:

```text
trace abc
- caller-span
- gateway-span   (linked to caller-span)
```

After:

```text
trace abc
- caller-span
  - gateway-span
```

This same hierarchical model is now applied to buffered spans emitted
through `SpanWriter`.

This is an intentional observability behavior change:
- waterfalls become hierarchical instead of link-based
- parent/child queries in tracing backends will behave differently
- app/runtime behavior should remain the same

On the MCP side, this also aligns the emitted fields with the v1.40
conventions:
- `gen_ai.operation.name=execute_tool` only for `tools/call`
- resource reads emit `mcp.resource.uri`
- span names stay low-cardinality via `{method} {service_name}`

---------

Co-authored-by: John Howard <john.howard@solo.io>
2026-03-17 09:25:31 -07:00
Nina Polshakova
4da7b76372
Setup nightly releases (#1252)
Based on https://github.com/agentgateway/agentgateway/pull/1213

Tested on fork:
https://github.com/npolshakova/agentgateway/actions/workflows/nightly.yml

See sample published nightly build here:
https://github.com/npolshakova?tab=packages&repo_name=agentgateway

It currently uses this format as the version with the short sha
`0.0.0-alpha.7238053`. Let me know if we want to change this format to
something else!
<img width="657" height="75" alt="image"
src="https://github.com/user-attachments/assets/aeb3c017-8d5b-439f-89b1-7760f592fd25"
/>


```
docker pull ghcr.io/npolshakova/agentgateway/charts/agentgateway:v0.0.0-alpha.a7af494
```

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-03-17 11:59:17 -04:00
518 changed files with 36587 additions and 45571 deletions

83
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,83 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "05:00"
timezone: "America/Los_Angeles"
groups:
cargo-weekly:
patterns:
- "*"
ignore:
- dependency-name: "nom"
- dependency-name: "criterion"
open-pull-requests-limit: 1
# Disable regular version updates while still allowing Dependabot security PRs.
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "gomod"
directory: "/api"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "gomod"
directory: "/tools"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "npm"
directory: "/ui"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "docker"
directory: "/controller/hack/testbox"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "uv"
directory: "/examples/a2a/strands-agents"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 0

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Restore cache
uses: Andrej730/cache/restore@e294f7d180f76c94062d0251c60fe7362ce6667d
@ -28,7 +28,7 @@ jobs:
key: ${{ github.event.inputs.cache_key }}
- name: Upload cached folder as artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: cache-artifact
path: |

56
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Nightly Release
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch: {}
permissions:
contents: write
packages: write
id-token: write
jobs:
prepare:
if: github.repository == 'agentgateway/agentgateway'
runs-on: ubuntu-24.04
outputs:
has_commits: ${{ steps.check.outputs.has_commits }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Check for commits in the last 24 hours
id: check
run: |
LAST_COMMIT=$(git log -1 --format="%ct")
NOW=$(date +%s)
DIFF=$((NOW - LAST_COMMIT))
# 86400 = seconds in one day
if [ "$DIFF" -lt 86400 ]; then
echo "has_commits=true" >> $GITHUB_OUTPUT
echo "Recent commit found (${DIFF}s ago)"
else
echo "has_commits=false" >> $GITHUB_OUTPUT
echo "No recent commits (last commit was ${DIFF}s ago), skipping nightly release"
fi
- name: Compute nightly version
id: version
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "version=0.0.0-alpha.${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "Nightly version: 0.0.0-alpha.${SHORT_SHA}"
release:
needs: prepare
if: ${{ needs.prepare.outputs.has_commits == 'true' || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/release.yml
with:
version: ${{ needs.prepare.outputs.version }}
extra_tag: latest-dev
# Helm is special and requires a semver.
extra_helm_tag: 0.0.0-latest-dev
secrets: inherit

View File

@ -4,11 +4,9 @@ on:
push:
branches:
- "main"
- "howardjohn/pre-regression"
pull_request:
branches:
- "main"
- "howardjohn/pre-regression"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
@ -18,25 +16,137 @@ env:
CARGO_TERM_COLOR: always
CI: true
RUST_VERSION: "1.93.1"
GO_VERSION: "1.26.1"
GO_VERSION: "1.26.2"
jobs:
#### Controller jobs ####
controller-e2e:
runs-on: ubuntu-24.04
#### Proxy jobs ####
proxy-test:
strategy:
matrix:
include:
- os: blacksmith-4vcpu-ubuntu-2404
name: "Proxy Test"
- os: windows-2025
name: "Proxy Test (Windows)"
- os: macos-15
name: "Proxy Test (Mac)"
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
# Github cache is too tiny to handle the full matrix :-(
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
with:
# Github cache will restore from 'main' OR the current branch.
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-go@v6
- name: Start validation dependencies
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
run: tools/manage-validation-deps.sh start
- name: Test
run: make test
env:
KEYCLOAK_AVAILABLE: ${{ startsWith(matrix.os, 'blacksmith-') && '1' || '' }}
- name: Stop validation dependencies
if: ${{ always() && startsWith(matrix.os, 'blacksmith-') }}
run: tools/manage-validation-deps.sh stop
proxy-lint:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
# Github cache will restore from 'main' OR the current branch.
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Generation
run: make generate-schema check-clean-repo
- name: Lint
run: make lint
#### UI jobs ####
ui-lint:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
- name: Lint
run: |
npm ci
npm run lint
#### Controller jobs ####
controller-test:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
**/*.sum
.github/workflows/cache-lint
- name: Test
run: go test -race ./...
controller-lint:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
**/*.sum
.github/workflows/cache-test
- name: Lint
run: make -C controller analyze
- name: go mod tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum
- name: Gen
# TODO: the rest of codegen
run: make generate-apis check-clean-repo
controller-e2e:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check Runner Info
run: |
cat /sys/fs/cgroup/cpu.stat || true
cat /proc/pressure/cpu || true
lscpu || true
openssl speed -seconds 1 -bytes 256 sha256 || rtue
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
# Github cache will restore from 'main' OR the current branch.
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
@ -45,20 +155,6 @@ jobs:
- name: Set Path
run: |
echo "./tools" >> $GITHUB_PATH
- name: Fake cache
run: |
cargo build --profile ci
cargo clean -p agentgateway || true
cargo clean -p agentgateway-app || true
cargo clean -p cel || true
cargo clean -p agent-celx || true
cargo clean -p agent-core || true
cargo clean -p agent-hbone || true
cargo clean -p htpasswd-verify-fork || true
cargo clean -p hyper-util-fork || true
cargo clean -p agent-xds || true
echo "./tools" >> $GITHUB_PATH
- name: Setup
run: TEST_MODE=e2e ./controller/test/setup/setup-kind-ci.sh
- name: E2E
@ -66,13 +162,13 @@ jobs:
CGO_ENABLED=0 PERSIST_INSTALL=true go test -tags=e2e -v ./controller/test/e2e/tests -run '^TestAgentgatewayIntegration'
- name: Archive bug report directory on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: bug-report
path: ./controller/_test/bug_report/kind
retention-days: 2
- name: Upload cargo timings
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: cargo-timings-e2e
path: target/cargo-timings/cargo-timing*.html
@ -81,3 +177,64 @@ jobs:
run: |
echo '# E2E Timings\n'
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
controller-conformance:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
# We only read the cache from 'E2E' job, since they should have identical cache.
save-if: "false"
shared-key: "controller-e2e" # Pull E2E job's cache
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
**/*.sum
.github/workflows/cache-e2e
- name: Set Path
run: |
echo "./tools" >> $GITHUB_PATH
- name: Setup
run: TEST_MODE=conformance ./controller/test/setup/setup-kind-ci.sh
- name: Conformance
run: |
make -C controller all-conformance
- name: Debug Info
if: ${{ failure() }}
run: |
kubectl describe deployment -n agentgateway-system
kubectl get pods -n agentgateway-system
kubectl logs -n agentgateway-system -l app.kubernetes.io/name=agentgateway
- name: Upload cargo timings
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: cargo-timings-conformance
path: target/cargo-timings/cargo-timing*.html
retention-days: 2
- name: Summary
run: |
cat-yamls () {
local files=("$@")
local count=$#
for ((i=0; i<count-1; i++)); do
cat "${files[i]}"
echo -e "\n---"
done
if [ $count -gt 0 ]; then
cat "${files[count-1]}"
fi
}
echo -e '\n# Conformance Reports\n\n```yaml' >> $GITHUB_STEP_SUMMARY
cat-yamls ./controller/_test/conformance/*.yaml >> $GITHUB_STEP_SUMMARY
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
echo -e '# Conformance Timings\n' >> $GITHUB_STEP_SUMMARY
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY

View File

@ -13,12 +13,33 @@ on:
required: false
default: false
type: boolean
extra_helm_tag:
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
required: false
default: ''
type: string
workflow_call:
inputs:
version:
description: 'Version number (without v prefix)'
required: true
type: string
extra_tag:
description: 'Additional Docker image tag to push (e.g. latest-dev)'
required: false
default: ''
type: string
extra_helm_tag:
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
required: false
default: ''
type: string
env:
CARGO_TERM_COLOR: always
CI: true
RUST_VERSION: "1.93.1"
GO_VERSION: "1.26.1"
GO_VERSION: "1.26.2"
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/agentgateway
CONTROLLER_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/controller
# Note: /charts is added to this
@ -37,8 +58,8 @@ jobs:
id: version
run: |
# Determine version source
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${{ github.ref_name }}"
fi
@ -59,9 +80,9 @@ jobs:
matrix:
include:
- platform: linux/amd64
os: ubuntu-24.04
os: blacksmith-4vcpu-ubuntu-2404
- platform: linux/arm64
os: ubuntu-24.04-arm
os: blacksmith-4vcpu-ubuntu-2404-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
@ -72,23 +93,23 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
build-args: |
VERSION=${{ env.VERSION }}
@ -107,7 +128,7 @@ jobs:
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
@ -127,32 +148,33 @@ jobs:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@v3
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-linux-*
merge-multiple: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
@ -163,6 +185,10 @@ jobs:
- name: Sign the container image
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
@ -179,9 +205,9 @@ jobs:
matrix:
include:
- platform: linux/amd64
os: ubuntu-24.04
os: blacksmith-4vcpu-ubuntu-2404
- platform: linux/arm64
os: ubuntu-24.04-arm
os: blacksmith-4vcpu-ubuntu-2404-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
@ -192,24 +218,24 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}-musl
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
@ -229,7 +255,7 @@ jobs:
touch "${{ runner.temp }}/digests-musl/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: digests-musl-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests-musl/*
@ -249,32 +275,33 @@ jobs:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@v3
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/digests-musl
pattern: digests-musl*
merge-multiple: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests-musl
@ -285,6 +312,10 @@ jobs:
- name: Sign the container image
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}-musl
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
@ -304,7 +335,7 @@ jobs:
os: ubuntu-24.04
goarch: amd64
- platform: linux/arm64
os: ubuntu-24.04-arm
os: blacksmith-4vcpu-ubuntu-2404-arm
goarch: arm64
defaults:
run:
@ -318,17 +349,17 @@ jobs:
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
working-directory: .
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v6
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
@ -346,16 +377,16 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: controller/_output/pkg/agentgateway
file: controller/_output/pkg/agentgateway/Dockerfile.agentgateway
@ -375,7 +406,7 @@ jobs:
touch "${{ runner.temp }}/controller-digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: controller-digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/controller-digests/*
@ -395,10 +426,10 @@ jobs:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@v3
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/controller-digests
pattern: controller-digests-*
@ -412,22 +443,23 @@ jobs:
find . -type f
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/controller-digests
@ -438,6 +470,10 @@ jobs:
- name: Sign the container image
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
@ -454,7 +490,7 @@ jobs:
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Helm login to ${{ env.CHART_REGISTRY_IMAGE_BASE }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | ./tools/helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin
@ -463,39 +499,46 @@ jobs:
run: make -C controller release-charts
env:
IMAGE_REGISTRY: ${{ env.CHART_REGISTRY_IMAGE_BASE }}
EXTRA_HELM_TAG: ${{ inputs.extra_helm_tag }}
build:
if: ${{ github.event_name == 'push' || ! github.event.inputs.skip_gh_release }}
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
needs:
- setup
runs-on: ${{ matrix.os }}
permissions:
contents: read
env:
VERSION: ${{ needs.setup.outputs.version }}
strategy:
matrix:
include:
- os: ubuntu-24.04
- os: blacksmith-4vcpu-ubuntu-2404
target: x86_64-unknown-linux-musl
# Performance is horrendous on musl without jemalloc
features: jemalloc
- os: ubuntu-24.04-arm
name: linux
- os: blacksmith-4vcpu-ubuntu-2404-arm
target: aarch64-unknown-linux-musl
# TODO: arm64 build fails with jemalloc for some reason? https://github.com/tikv/jemallocator/issues/146
features: default
name: linux-arm
- os: macos-26
target: aarch64-apple-darwin
features: default
name: mac
- os: windows-2025
target: x86_64-pc-windows-msvc
features: default
name: windows
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- uses: actions/setup-node@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
targets: ${{ matrix.target }}
@ -505,8 +548,8 @@ jobs:
cd ui
npm install
npm run build
- name: Install musl-tools
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
- name: Prepare Linux target
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
@ -519,15 +562,15 @@ jobs:
run: |
git status
- name: Upload Artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: release-binary-${{ matrix.os }}
name: release-binary-${{ matrix.name }}
path: |
target/${{ matrix.target }}/release/agentgateway
target/${{ matrix.target }}/release/agentgateway.exe
release:
if: ${{ github.event_name == 'push' || ! github.event.inputs.skip_gh_release }}
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
needs:
- setup
- push-image
@ -535,14 +578,14 @@ jobs:
- push-controller-image
- push-helm-charts
- build
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
pattern: release-binary-*
@ -550,16 +593,16 @@ jobs:
run: |
ls -R
mkdir outputs
mv release-binary-macos-26/agentgateway outputs/agentgateway-darwin-arm64
mv release-binary-mac/agentgateway outputs/agentgateway-darwin-arm64
sha256sum outputs/agentgateway-darwin-arm64 > outputs/agentgateway-darwin-arm64.sha256
mv release-binary-ubuntu-24.04/agentgateway outputs/agentgateway-linux-amd64
mv release-binary-linux/agentgateway outputs/agentgateway-linux-amd64
sha256sum outputs/agentgateway-linux-amd64 > outputs/agentgateway-linux-amd64.sha256
mv release-binary-ubuntu-24.04-arm/agentgateway outputs/agentgateway-linux-arm64
mv release-binary-linux-arm/agentgateway outputs/agentgateway-linux-arm64
sha256sum outputs/agentgateway-linux-arm64 > outputs/agentgateway-linux-arm64.sha256
mv release-binary-windows-2025/agentgateway.exe outputs/agentgateway-windows-amd64.exe
mv release-binary-windows/agentgateway.exe outputs/agentgateway-windows-amd64.exe
sha256sum outputs/agentgateway-windows-amd64.exe > outputs/agentgateway-windows-amd64.exe.sha256
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
with:
files: outputs/agentgateway-*
tag_name: ${{ github.ref_name }}

863
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ members = [
"crates/celx",
"crates/core",
"crates/hbone",
"crates/protos",
"crates/xds",
"crates/xtask",
]
@ -24,6 +25,7 @@ default-members = [
"crates/celx",
"crates/core",
"crates/hbone",
"crates/protos",
"crates/xds",
]
@ -42,45 +44,47 @@ agent-xds = { path = "crates/xds" }
agentgateway = { path = "crates/agentgateway" }
cel = { path = "crates/cel-fork/cel" }
cel-derive = { path = "crates/cel-fork/cel-derive" }
protos = { path = "crates/protos" }
atomic_float = { version = "1.1.0", features = ["serde"] }
anyhow = "1.0"
arc-swap = "1.7.1"
arc-swap = "1.9"
arcstr = { version = "1.2", features = ["serde"] }
assert_matches = "1.5.0"
async-openai = { git = "https://github.com/64bit/async-openai", rev = "6e482db7185e3e186fe49bae0ec2f214fc822e4a", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
async-openai = { version = "0.34", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
async-stream = "0.3"
async-trait = "0.1"
aws-config = { version = "1.8.5", default-features = false, features = ["default-https-client", "rt-tokio"] }
aws-config = { version = "1.8", default-features = false, features = ["default-https-client", "rt-tokio"] }
aws-credential-types = "1.2"
aws-sigv4 = "1.3"
aws-smithy-eventstream = "0.60"
aws-smithy-types = "1.3"
aws-lc-rs = "1.15"
aws-lc-rs = "1.16"
axum = { version = "0.8", features = ["macros"] }
axum-core = "0.5"
axum-extra = { version = "0.12", features = ["json-lines", "typed-header"] }
# Disable default features to avoid pulling in native-tls and requiring openssl
# TODO: allow default features if we ever add an openssl feature
azure_identity = { version = "0.31", default-features = false }
azure_core = { version = "0.31", default-features = false }
typespec_client_core = { default-features = false, version = "0.10" }
azure_identity = { version = "0.33", default-features = false }
azure_core = { version = "0.33", default-features = false }
typespec_client_core = { default-features = false, version = "0.12" }
base64 = "0.22"
bcrypt = "0.18"
bytes = { version = "1.10", features = ["serde"] }
cookie = { version = "0.18", default-features = false }
bcrypt = "0.19"
bytes = { version = "1.11", features = ["serde"] }
chrono = { version = "0.4", features = ["serde"] }
clap = { version = "4.5", features = ["derive"] }
clocksource = "0.8"
clap = { version = "4.6", features = ["derive"] }
clocksource = "1.0"
crossbeam = "0.8"
divan = "0.1"
durationfmt = "0.1"
go-parse-duration = "0.1"
flurry = "0.5.2"
fs-err = { version = "3.1", features = ["tokio"] }
fs-err = { version = "3.3", features = ["tokio"] }
futures = "0.3"
futures-channel = "0.3"
futures-core = "0.3"
futures-util = "0.3"
google-cloud-auth = { version = "1.6", default-features = false, features = [
google-cloud-auth = { version = "1.8", default-features = false, features = [
"idtoken",
# They use AWS-LC which is what we want so its fine. If they changed we would need to switch
# To installing a global default which is annoying so prefer to do it this way.
@ -93,24 +97,24 @@ hex = "0.4"
hickory-resolver = { version = "0.25", features = ["serde"] }
htpasswd-verify-fork = { path = "crates/htpasswd-verify-fork" }
httpdate = "1.0"
http = "1.3"
http = "1.4"
http-body = "1"
http-body-util = "0.1.3"
hyper = { version = "1.6", features = ["full"] }
hyper = { version = "1.8", features = ["full"] }
hyper-rustls = "0.27"
hyper-util = { version = "0.1", features = ["full"] }
hyper-util-fork = { path = "crates/hyper-util-fork" }
include_dir = "0.7"
indexmap = { version = "2.9", features = ["serde"] }
insta = { version = "1.38", features = ["json", "redactions", "filters", "yaml"] }
ipnet = { version = "2.11", features = ["serde"] }
indexmap = { version = "2.13", features = ["serde"] }
insta = { version = "1.47", features = ["json", "redactions", "filters", "yaml"] }
ipnet = { version = "2.12", features = ["serde"] }
itertools = "0.14"
jsonwebtoken = { version = "10.3", features = ["aws_lc_rs"] }
lazy_static = "1.4"
lazy_static = "1.5"
libc = "0.2"
notify = "8.0"
notify = "8.2"
notify-debouncer-full = "0.7"
md-5 = "0.10"
md-5 = "0.11"
num_cpus = "1.17"
once_cell = "1.21"
openapiv3 = "2.2"
@ -123,7 +127,7 @@ parking_lot = "0.12"
percent-encoding = "2.3"
phonenumber = "0.3"
pin-project-lite = "0.2"
pingora-pool = "0.7"
pingora-pool = "0.8"
ppp = "2.3"
pprof = { version = "0.15", features = [
"protobuf",
@ -135,12 +139,12 @@ prometheus-client = "0.24"
prost = "0.14"
prost-build = "0.14"
prost-types = "0.14"
prost-wkt-types = { version = "0.7.0", features = ["vendored-protox"] }
prost-wkt-build = "0.7.0"
prost-wkt-types = { version = "0.7", features = ["vendored-protox"] }
prost-wkt-build = "0.7"
pwhash = "1"
rand = "0.10"
rcgen = { version = "0.14", default-features = false, features = ["pem", "x509-parser", "aws_lc_rs"] }
regex = "1.11"
regex = "1.12"
reqwest = { version = "0.13", default-features = false, features = [
"http2",
"charset",
@ -150,7 +154,7 @@ rstest = "0.26"
rustc_version = "0.4"
rustls = { version = "0.23", default-features = false, features = ["tls12", "aws_lc_rs"] }
rustls-native-certs = "0.8"
rustls-pki-types = "1.12"
rustls-pki-types = "1.14"
schemars = { version = "=1.0.4", git = "https://github.com/howardjohn/schemars", rev = "4364354fa41897a0c2001d891c0a9a38eafedb82", features = [
#schemars = { version = "1.0", features = [
"bytes1",
@ -166,16 +170,17 @@ serde-untagged = "0.1"
serde_json_path_to_error = "0.1"
serde_regex = "1.1"
serde_yaml = "0.9"
sha1 = "0.10"
sha1 = "0.11"
sha2 = "0.11"
shellexpand = "3.1"
socket2 = "0.6"
split-iter = "0.1"
sse-stream = "0.2"
stacker = "0.1"
tempfile = "3.20"
tempfile = "3.27"
thiserror = "2.0"
tiktoken-rs = "0.9"
tokio = { version = "1.48", features = ["full", "macros", "sync"] }
tokio = { version = "1.50", features = ["full", "macros", "sync"] }
tokio-rustls = { version = "0.26", default-features = false, features = ["aws_lc_rs"] }
tokio-stream = { version = "0.1", features = ["net", "sync"] }
tokio-test = "0.4"
@ -199,7 +204,7 @@ tracing-subscriber = { version = "0.3", features = [
"json",
] }
url = "2.5"
uuid = { version = "1.11", features = ["v4"] }
uuid = { version = "1.23", features = ["v4"] }
wiremock = { version = "0.6", features = ["tls"] }
x509-parser = { version = "0.18", default-features = false, features = ["verify-aws"] }
which = "8.0"
@ -210,12 +215,12 @@ crossbeam-channel = "0.5"
http-serde = "2.1"
itoa = "1.0"
serde_urlencoded = "0.7"
serde_with = { version = "3.14", features = [
serde_with = { version = "3.17", features = [
"schemars_1",
"macros",
"alloc",
], default-features = false }
value-bag = { version = "1.11", features = ["serde", "value-bag-serde1"] }
value-bag = { version = "1.12", features = ["serde", "value-bag-serde1"] }
time = "0.3"
tikv-jemallocator = { version = "0.6", features = [
"profiling",
@ -223,17 +228,17 @@ tikv-jemallocator = { version = "0.6", features = [
] }
jemalloc_pprof = { version = "0.8", features = ["symbolize"] }
protox = "0.9"
async-compression = { version = "0.4.27", features = [
async-compression = { version = "0.4", features = [
"brotli",
"zlib",
"gzip",
"zstd",
"tokio",
] }
core_affinity = "0.8.3"
frozen-collections = "0.8.0"
core_affinity = "0.8"
frozen-collections = "0.9"
heck = "0.5"
macro_rules_attribute = "0.2.2"
macro_rules_attribute = "0.2"
# Release optimized but without as many dependencies, suitable for incremental development
[profile.quick-release]

View File

@ -82,7 +82,7 @@ generate-schema:
# Code generation for xds apis
.PHONY: generate-apis
generate-apis:
@PATH="./common/tools:$(PATH)" buf generate --path crates/agentgateway/proto/resource.proto
@PATH="./common/tools:$(PATH)" buf generate --path crates/protos/proto/resource.proto
.PHONY: run-validation-deps
run-validation-deps:

View File

@ -29,7 +29,7 @@
---
**Agentgateway** is an open source data plane optimized for agentic AI connectivity within or across any agent framework or environment. Agentgateway provides drop-in security, observability, and governance for agent-to-agent and agent-to-tool communication and supports leading interoperable protocols, including [Agent2Agent (A2A)](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/) and [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction).
**Agentgateway** is an open source proxy built on AI-native protocols ([MCP](https://modelcontextprotocol.io/introduction) & [A2A](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/)) that provides drop-in security, observability, and governance for agent-to-LLM, agent-to-tool, and agent-to-agent communication across any framework and environment.
<br>
<div align="center">
@ -41,20 +41,31 @@
[![Agentgateway Intro Video](https://img.youtube.com/vi/SomP92JWPmE/hqdefault.jpg)](https://youtu.be/SomP92JWPmE)
## Key Features:
## Key Features
- [x] **Highly performant:** agentgateway is written in rust, and is designed from the ground up to handle any scale you can throw at it.
- [x] **Security First:** agentgateway includes a robust MCP/A2A focused RBAC system.
- [x] **Multi Tenant:** agentgateway supports multiple tenants, each with their own set of resources and users.
- [x] **Dynamic:** agentgateway supports dynamic configuration updates via xDS, without any downtime.
- [x] **Run Anywhere:** agentgateway can run anywhere with any agent framework, from a single machine to a large scale multi-tenant deployment.
- [x] **Legacy API Support:** agentgateway can transform legacy APIs into MCP resources. Currently supports OpenAPI. (gRPC coming soon)
- [x] **Kubernetes Native:** agentgateway includes a built-in Kubernetes controller for dynamic provisioning and management via the Kubernetes Gateway API.
- **LLM Gateway**<br>
Route traffic to major LLM providers (OpenAI, Anthropic, Gemini, Bedrock, and more) through a unified OpenAI-compatible API with budget and spend controls, prompt enrichment, load balancing, and failover.
- **MCP Gateway**<br>
Connect LLMs to tools and external data sources via MCP with tool federation, stdio/HTTP/SSE/Streamable HTTP transports, OpenAPI integration, and OAuth authentication.
- **A2A Gateway**<br>
Enable secure agent-to-agent communication using A2A, with capability discovery, modality negotiation, and task collaboration.
- **Inference Routing**<br>
Intelligent routing to self-hosted models using Kubernetes Inference Gateway extensions, with decisions based on GPU utilization, KV cache, LoRA adapters, and queue depth.
- **Guardrails**<br>
Multi-layered content filtering with regex, OpenAI moderation, AWS Bedrock Guardrails, Google Model Armor, and custom webhooks.
- **Security & Observability**<br>
Auth (JWT, API keys, OAuth), fine-grained RBAC with CEL policy engine, rate limiting, TLS, and OpenTelemetry metrics/logs/tracing.
<br>
## Getting Started
## Getting Started
To get started with agentgateway, please check out the [Getting Started Guide](https://agentgateway.dev/docs/quickstart).
- [Standalone Quickstart](https://agentgateway.dev/docs/quickstart) — Get started with agentgateway in minutes.
- [Kubernetes Quickstart](https://agentgateway.dev/docs/kubernetes/latest) — Deploy on Kubernetes using the built-in controller and Gateway API.
## Documentation
@ -69,6 +80,23 @@ Agentgateway has a built-in UI for you to explore agentgateway connecting agent-
<img alt="agentgateway UI" src="img/UI-homepage.png">
</div>
## Sponsors
<table>
<tr>
<td align="center" width="33.3%">
<a href="https://blacksmith.sh/">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith-light.svg">
<img src="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith.svg" alt="Blacksmith" height="48">
</picture>
</a>
</td>
</tr>
</table>
Thank you to our sponsors for helping to fund the development of agentgateway!
## Contributing
For instructions on how to contribute to the agentgateway project, see the [CONTRIBUTION.md](CONTRIBUTION.md) file.
@ -80,7 +108,7 @@ Recordings of the community meetings will be published on our [google drive](htt
## Roadmap
`agentgateway` is currently in active development. If you want a feature missing, open an issue in our [Github repo](https://github.com/agentgateway/agentgateway/issues).
`agentgateway` is currently in active development. If you'd like a feature that's missing, open an issue in our [GitHub repo](https://github.com/agentgateway/agentgateway/issues).
## Contributors

File diff suppressed because it is too large Load Diff

View File

@ -336,6 +336,17 @@ func (this *AzureDeveloperImplicit) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for AzureImplicit
func (this *AzureImplicit) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for AzureImplicit
func (this *AzureImplicit) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for RouteMatch
func (this *RouteMatch) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
@ -600,6 +611,17 @@ func (this *FrontendPolicySpec_TCP) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for FrontendPolicySpec_NetworkAuthorization
func (this *FrontendPolicySpec_NetworkAuthorization) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for FrontendPolicySpec_NetworkAuthorization
func (this *FrontendPolicySpec_NetworkAuthorization) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for FrontendPolicySpec_Logging
func (this *FrontendPolicySpec_Logging) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
@ -809,6 +831,17 @@ func (this *TrafficPolicySpec_JWT) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TrafficPolicySpec_JWT_MCP
func (this *TrafficPolicySpec_JWT_MCP) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for TrafficPolicySpec_JWT_MCP
func (this *TrafficPolicySpec_JWT_MCP) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TrafficPolicySpec_BasicAuthentication
func (this *TrafficPolicySpec_BasicAuthentication) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)

View File

@ -5,6 +5,10 @@ CEL is an expression language that can evaluate user-defined (at runtime) expres
A simple example of an expression that could be used for MCP authorization: `jwt.sub == "test-user" && mcp.tool.name == "add"`.
For post-request logging, tracing, and metrics CEL, MCP tool calls also expose payload fields such as
`mcp.methodName`, `mcp.sessionId`, `mcp.tool.arguments`, `mcp.tool.result`, and `mcp.tool.error`.
Request-time authorization keeps the `mcp` context identity-only, so those payload fields are absent during RBAC evaluation.
While CEL is not as powerful as alternatives like Lua or WASM, it is pretty fast and good enough for many use cases.
Agentgateway currently uses CEL for:

View File

@ -1,4 +1,4 @@
version: v1beta1
build:
roots:
- crates/agentgateway/proto
- crates/protos/proto

View File

@ -104,10 +104,6 @@ linters:
alias: gwv1a2
- pkg: sigs.k8s.io/gateway-api/apis/v1beta1
alias: gwv1b1
- pkg: github.com/envoyproxy/go-control-plane/envoy/config/(\w+)/(v[\w\d]+)
alias: envoy$1$2
- pkg: github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3
alias: envoytlsv3
- pkg: github.com/agentgateway/agentgateway/controller/api/annotations
alias: apiannotations
- pkg: github.com/agentgateway/agentgateway/controller/api/settings

View File

@ -461,6 +461,7 @@ HELM ?= helm
HELM_CHART_VERSION_NO_V ?= $(patsubst v%,%,$(VERSION))
HELM_CHART_VERSION_V ?= v$(HELM_CHART_VERSION_NO_V)
HELM_PACKAGE_ARGS ?= --version $(HELM_CHART_VERSION_NO_V) --app-version $(HELM_CHART_VERSION_NO_V)
EXTRA_HELM_TAG ?=
HELM_CHART_DIR_AGW=install/helm/agentgateway
HELM_CHART_DIR_AGW_CRD=install/helm/agentgateway-crds
HELM_ADDITIONAL_VALUES ?= hack/helm/dev.yaml
@ -490,18 +491,29 @@ release-charts: package-agentgateway-charts
mkdir -p $(TEST_ASSET_DIR); \
$(HELM) package --version $(HELM_CHART_VERSION_V) --app-version $(HELM_CHART_VERSION_V) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
$(HELM) repo index $(TEST_ASSET_DIR);
@if [ -n "$(EXTRA_HELM_TAG)" ]; then \
mkdir -p $(TEST_ASSET_DIR); \
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW); \
$(HELM) repo index $(TEST_ASSET_DIR); \
mkdir -p $(TEST_ASSET_DIR); \
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
$(HELM) repo index $(TEST_ASSET_DIR); \
fi
@for chart in $(CHART_NAMES); do \
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_NO_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
if [ -n "$(EXTRA_HELM_TAG)" ]; then \
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(EXTRA_HELM_TAG).tgz oci://$(IMAGE_REGISTRY)/charts; \
fi; \
done;
.PHONY: deploy-agentgateway-crd-chart
deploy-agentgateway-crd-chart: ## Deploy the agentgateway crd chart
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(VERSION).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(HELM_CHART_VERSION_NO_V).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
.PHONY: deploy-agentgateway-chart
deploy-agentgateway-chart: ## Deploy the agentgateway chart
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(VERSION).tgz \
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(HELM_CHART_VERSION_NO_V).tgz \
--namespace $(INSTALL_NAMESPACE) --create-namespace \
--set image.registry=$(IMAGE_REGISTRY) \
--set image.tag=$(VERSION) \

View File

@ -1,4 +1,7 @@
package annotations
// LegacyMCPServiceHTTPPath is the legacy annotation used to specify the HTTP path for the MCP service. Users should switch to MCPServiceHTTPPath.
const LegacyMCPServiceHTTPPath = "kgateway.dev/mcp-path"
// MCPServiceHTTPPath is the annotation used to specify the HTTP path for the MCP service
const MCPServiceHTTPPath = "kgateway.dev/mcp-path"
const MCPServiceHTTPPath = "agentgateway.dev/mcp-path"

View File

@ -161,13 +161,6 @@ type Settings struct {
// is deprecated in v2.1 and will not be supported in v2.2.
EnableInferExt bool `split_words:"true"`
// DefaultImageRegistry is the default image registry to use for the agentgateway image.
DefaultImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
// DefaultImageTag is the default image tag to use for the agentgateway image.
DefaultImageTag string `split_words:"true" default:""`
// DefaultImagePullPolicy is the default image pull policy to use for the agentgateway image.
DefaultImagePullPolicy string `split_words:"true" default:"IfNotPresent"`
// ProxyImageRegistry is the default image registry to use for the proxy image.
ProxyImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
// ProxyImageRepository is the default image repository to use for the proxy image.

View File

@ -27,9 +27,6 @@ func allEnvVarsSet() map[string]string {
"AGW_AGENTGATEWAY_XDS_SERVICE_PORT": "5678",
"AGW_NO_LISTENERS_DUMMY_PORT": "8443",
"AGW_ENABLE_INFER_EXT": "true",
"AGW_DEFAULT_IMAGE_REGISTRY": "custom-registry.io",
"AGW_DEFAULT_IMAGE_TAG": "v1.0.0",
"AGW_DEFAULT_IMAGE_PULL_POLICY": "Always",
"AGW_LOG_LEVEL": "debug",
"AGW_DISCOVERY_NAMESPACE_SELECTORS": `[{"matchLabels":{"app":"test"}}]`,
"AGW_ENABLE_BUILTIN_DEFAULT_METRICS": "true",
@ -74,9 +71,6 @@ func TestSettings(t *testing.T) {
AgentgatewayXdsServicePort: 9978,
NoListenersDummyPort: 443,
EnableInferExt: false,
DefaultImageRegistry: "cr.agentgateway.dev",
DefaultImageTag: "",
DefaultImagePullPolicy: "IfNotPresent",
LogLevel: "info",
DiscoveryNamespaceSelectors: "[]",
EnableBuiltinDefaultMetrics: false,
@ -105,9 +99,6 @@ func TestSettings(t *testing.T) {
AgentgatewayXdsServicePort: 5678,
NoListenersDummyPort: 8443,
EnableInferExt: true,
DefaultImageRegistry: "custom-registry.io",
DefaultImageTag: "v1.0.0",
DefaultImagePullPolicy: "Always",
LogLevel: "debug",
DiscoveryNamespaceSelectors: `[{"matchLabels":{"app":"test"}}]`,
EnableBuiltinDefaultMetrics: true,
@ -188,9 +179,6 @@ func TestSettings(t *testing.T) {
XdsServiceName: "agentgateway",
AgentgatewayXdsServicePort: 9978,
EnableInferExt: false,
DefaultImageRegistry: "cr.agentgateway.dev",
DefaultImageTag: "",
DefaultImagePullPolicy: "IfNotPresent",
NoListenersDummyPort: 443,
LogLevel: "info",
DiscoveryNamespaceSelectors: "[]",

View File

@ -41,6 +41,51 @@ spec:
matchExpressions:
- 'true'
---
_err: unknown fields
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-static-target-authentication
spec:
mcp:
targets:
- name: target
static:
host: example.com
port: 443
policies:
mcp:
authentication:
issuer: https://issuer.example.com/
jwks:
backendRef:
name: jwks
port: 443
jwksPath: /.well-known/jwks.json
---
_err: path and pathPrefix are mutually exclusive
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: path-and-pathprefix
spec:
ai:
provider:
openai: {}
path: /custom/path
pathPrefix: /custom
---
_err: pathPrefix requires host to be set
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: pathprefix-without-host
spec:
ai:
provider:
openai: {}
pathPrefix: /custom
---
_err: both host and port must be set together
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
@ -50,4 +95,47 @@ spec:
ai:
provider:
openai: {}
host: example.com
host: example.com
---
_err: exactly one of the fields in [host backendRef] must be set
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-backend-ref-missing-port
spec:
mcp:
targets:
- name: bad-ref
static:
host: mcp.example.com
backendRef:
name: mcp-service
port: 8080
---
_err: exactly one of the fields in [host backendRef] must be set
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-backend-ref-no-target
spec:
mcp:
targets:
- name: bad-ref
static:
port: 8080
---
_err: mcp target policies may not be used with backendRef
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-backend-ref-with-policies
spec:
mcp:
targets:
- name: bad-ref
static:
backendRef:
name: mcp-service
port: 8080
policies:
tls: {}

View File

@ -63,6 +63,20 @@ kind: AgentgatewayBackend
metadata:
name: mcp-full
spec:
policies:
mcp:
authorization:
action: Deny
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
authentication:
issuer: https://issuer.example.com/
jwks:
backendRef:
name: jwks
port: 443
jwksPath: /.well-known/jwks.json
mcp:
targets:
- name: everything
@ -71,12 +85,6 @@ spec:
port: 443
policies:
tls: {}
mcp:
authorization:
action: Deny
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
- name: k8s
selector:
namespaces:
@ -124,4 +132,36 @@ spec:
model: ollama
host: localhost
port: 8443
path: /custom
path: /custom
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-require
spec:
mcp:
targets:
- name: everything
static:
host: example.com
port: 443
policies:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-backend-ref
spec:
mcp:
targets:
- name: local-svc
static:
backendRef:
name: mcp-service
port: 8080

View File

@ -247,6 +247,39 @@ spec:
expression: 'request.headers["x-user"]'
unit: Minutes
---
_err: 'failureMode: Unsupported value'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: traffic-extauth-invalid-failure-mode
spec:
traffic:
extAuth:
backendRef:
name: auth-server
kind: Service
failureMode: IgnoreErrors
grpc: {}
---
_err: 'failureMode: Unsupported value'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: traffic-ratelimit-global-invalid-failure-mode
spec:
traffic:
rateLimit:
global:
backendRef:
name: ratelimit-service
kind: Service
failureMode: IgnoreErrors
domain: example.com
descriptors:
- entries:
- name: user
expression: 'request.headers["x-user"]'
---
_err: 'phase: Unsupported value'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
@ -261,6 +294,21 @@ spec:
- name: X-Test
value: '"test"'
---
_err: 'jwtAuthentication.mcp requires mode Strict'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: traffic-jwt-mcp-nonstrict
spec:
traffic:
jwtAuthentication:
mode: Optional
providers:
- issuer: https://example.com
jwks:
inline: '{"keys":[]}'
mcp: {}
---
_err: 'pseudo-headers must be one of'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
@ -386,6 +434,28 @@ spec:
- field: a
value: b
---
_err: 'traffic.jwtAuthentication may not be used with backend.mcp.authentication in the same policy'
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: jwt-and-mcp-authentication
spec:
traffic:
jwtAuthentication:
providers:
- issuer: https://example.com
jwks:
inline: '{"keys":[]}'
backend:
mcp:
authentication:
issuer: https://example.com
jwks:
backendRef:
kind: Service
name: jwks
jwksPath: /.well-known/jwks.json
---
_err: "targetRefs may only"
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy

View File

@ -308,6 +308,7 @@ spec:
name: auth-server
kind: AgentgatewayBackend
group: agentgateway.dev
failureMode: FailOpen
forwardBody:
maxSize: 1048576
---
@ -358,6 +359,7 @@ spec:
name: ratelimit-service
kind: Service
port: 8080
failureMode: FailOpen
domain: example.com
descriptors:
- entries:

View File

@ -7,16 +7,38 @@ import (
"testing"
"istio.io/istio/pkg/config/crd"
"istio.io/istio/pkg/lazy"
"istio.io/istio/pkg/test/util/assert"
"github.com/agentgateway/agentgateway/controller/pkg/utils/fsutils"
)
var validator = lazy.New(func() (*crd.Validator, error) {
return newAgentgatewayValidator(false)
})
var validatorSkipMissing = lazy.New(func() (*crd.Validator, error) {
return newAgentgatewayValidator(true)
})
func NewAgentgatewayValidator(t *testing.T) *crd.Validator {
v, err := validator.Get()
assert.NoError(t, err)
return v
}
func NewAgentgatewayValidatorSkipMissing(t *testing.T) *crd.Validator {
v, err := validatorSkipMissing.Get()
assert.NoError(t, err)
return v
}
func newAgentgatewayValidator(skipMissing bool) (*crd.Validator, error) {
root := fsutils.GetModuleRoot()
dirs := []string{}
agentgatewayDir, err := os.ReadDir(filepath.Join(root, "controller/install/helm/agentgateway-crds/templates/"))
assert.NoError(t, err)
if err != nil {
return nil, err
}
for _, d := range agentgatewayDir {
if strings.HasSuffix(d.Name(), ".yaml") {
dirs = append(dirs, filepath.Join(root, "controller/install/helm/agentgateway-crds/templates", d.Name()))
@ -26,7 +48,8 @@ func NewAgentgatewayValidator(t *testing.T) *crd.Validator {
dirs...,
)
if err != nil {
t.Fatal(err)
return nil, err
}
return v
v.SkipMissing = skipMissing
return v, nil
}

View File

@ -1,6 +1,7 @@
package agentgateway
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
)
@ -120,33 +121,35 @@ type StaticBackend struct {
// AIBackend specifies the AI backend configuration
// +kubebuilder:validation:ExactlyOneOf=provider;groups
type AIBackend struct {
// provider specifies configuration for how to reach the configured LLM provider.
// `provider` specifies configuration for how to reach the configured LLM
// provider.
// +optional
LLM *LLMProvider `json:"provider,omitempty"`
// groups specifies a list of groups in priority order where each group defines
// a set of LLM providers. The priority determines the priority of the backend endpoints chosen.
// Note: provider names must be unique across all providers in all priority groups. Backend policies
// may target a specific provider by name using targetRefs[].sectionName.
// `groups` specifies a list of groups in priority order where each group
// defines a set of LLM providers. The priority determines the priority of
// the backend endpoints chosen.
// Note: provider names must be unique across all providers in all priority
// groups. Backend policies may target a specific provider by name using
// `targetRefs[].sectionName`.
//
// Example configuration with two priority groups:
// ```yaml
// groups:
// - providers:
// - azureopenai:
// deploymentName: gpt-4o-mini
// apiVersion: 2024-02-15-preview
// endpoint: ai-gateway.openai.azure.com
// - providers:
// - azureopenai:
// deploymentName: gpt-4o-mini-2
// apiVersion: 2024-02-15-preview
// endpoint: ai-gateway-2.openai.azure.com
// policies:
// auth:
// secretRef:
// name: azure-secret
// ```
//
// groups:
// - providers:
// - azureopenai:
// deploymentName: gpt-4o-mini
// apiVersion: 2024-02-15-preview
// endpoint: ai-gateway.openai.azure.com
// - providers:
// - azureopenai:
// deploymentName: gpt-4o-mini-2
// apiVersion: 2024-02-15-preview
// endpoint: ai-gateway-2.openai.azure.com
// policies:
// auth:
// secretRef:
// name: azure-secret
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=8
// +optional
@ -170,9 +173,11 @@ type NamedLLMProvider struct {
// +required
Name gwv1.SectionName `json:"name"`
// policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
// in the top level AgentgatewayBackend. policies are merged on a field-level basis, with order: AgentgatewayPolicy <
// AgentgatewayBackend < AgentgatewayBackend LLM provider (this field).
// `policies` controls policies for communicating with this backend.
// Policies may also be set in `AgentgatewayPolicy`, or in the top-level
// `AgentgatewayBackend`. Policies are merged on a field-level basis, with
// order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend`
// LLM provider (this field).
// +optional
Policies *BackendWithAI `json:"policies,omitempty"`
@ -182,6 +187,8 @@ type NamedLLMProvider struct {
// LLMProvider specifies the target large language model provider that the backend should route requests to.
// +kubebuilder:validation:ExactlyOneOf=openai;azureopenai;anthropic;gemini;vertexai;bedrock
// +kubebuilder:validation:XValidation:rule="has(self.host) || has(self.port) ? has(self.host) && has(self.port) : true",message="both host and port must be set together"
// +kubebuilder:validation:XValidation:rule="!(has(self.path) && has(self.pathPrefix))",message="path and pathPrefix are mutually exclusive"
// +kubebuilder:validation:XValidation:rule="has(self.pathPrefix) ? has(self.host) : true",message="pathPrefix requires host to be set"
type LLMProvider struct {
// OpenAI provider
// +optional
@ -224,6 +231,12 @@ type LLMProvider struct {
// If not specified, the default path for the provider is used.
// +optional
Path LongString `json:"path,omitempty"`
// PathPrefix overrides the default base path prefix (e.g. "/v1") for upstream requests.
// Path translation for cross-format requests still applies using this prefix.
// Only supported for OpenAI and Anthropic providers.
// +optional
PathPrefix LongString `json:"pathPrefix,omitempty"`
}
// OpenAIConfig settings for the [OpenAI](https://developers.openai.com/api/docs/guides/streaming-responses) LLM provider.
@ -244,13 +257,14 @@ type AzureOpenAIConfig struct {
// The name of the Azure OpenAI model deployment to use.
// For more information, see the [Azure OpenAI model docs](https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/concepts/models-sold-directly-by-azure?view=foundry-classic).
// This is required if ApiVersion is not 'v1'. For v1, the model can be set in the request.
// This is required if `apiVersion` is not `v1`. For `v1`, the model can be
// set in the request.
// +optional
DeploymentName *ShortString `json:"deploymentName,omitempty"`
// The version of the Azure OpenAI API to use.
// For more information, see the [Azure OpenAI API version reference](https://learn.microsoft.com/en-us/azure/ai-foundry/?view=foundry-classicreference#api-specs).
// If unset, defaults to "v1"
// If unset, defaults to `v1`.
// +optional
ApiVersion *TinyString `json:"apiVersion,omitempty"`
}
@ -275,8 +289,10 @@ type VertexAIConfig struct {
ProjectId TinyString `json:"projectId"`
// The location of the Google Cloud Project that you use for the Vertex AI.
// +required
Region TinyString `json:"region"`
// Defaults to `global` if not specified.
// +optional
// +kubebuilder:default=global
Region TinyString `json:"region,omitempty"`
}
// AnthropicConfig settings for the [Anthropic](https://platform.claude.com/docs/en/release-notes/overview) LLM provider.
@ -289,7 +305,7 @@ type AnthropicConfig struct {
type BedrockConfig struct {
// Region is the AWS region to use for the backend.
// Defaults to us-east-1 if not specified.
// Defaults to `us-east-1` if not specified.
// +optional
// +kubebuilder:default=us-east-1
// +kubebuilder:validation:MinLength=1
@ -302,7 +318,8 @@ type BedrockConfig struct {
// +optional
Model *ShortString `json:"model,omitempty"`
// Guardrail configures the Guardrail policy to use for the backend. See <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>
// `guardrail` configures the Guardrail policy to use for the backend. See
// <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>.
// If not specified, the AWS Guardrail policy will not be used.
// +optional
Guardrail *AWSGuardrailConfig `json:"guardrail,omitempty"`
@ -318,11 +335,12 @@ type AWSGuardrailConfig struct {
GuardrailVersion ShortString `json:"version"`
}
// MCPBackend configures mcp backends
// MCPBackend configures `mcp` backends.
type MCPBackend struct {
// Targets is a list of MCPBackend targets to use for this backend.
// Policies targeting MCPBackend targets must use targetRefs[].sectionName
// to select the target by name.
// `targets` is a list of MCP targets to use for this backend. Policies
// targeting MCP targets must use `targetRefs[].sectionName` to select
// the target by name.
//
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MinItems=1
@ -331,14 +349,14 @@ type MCPBackend struct {
// +required
Targets []McpTargetSelector `json:"targets"`
// SessionRouting configures MCP session behavior for requests.
// Defaults to Stateful if not set.
// `sessionRouting` configures MCP session behavior for requests.
// Defaults to `Stateful` if not set.
// +optional
SessionRouting SessionRouting `json:"sessionRouting,omitempty"`
// FailureMode controls behavior when MCP targets fail to initialize or
// become unavailable at runtime. "FailOpen" skips failed targets and
// continues serving from healthy ones. "FailClosed" (default) fails the
// `failureMode` controls behavior when MCP targets fail to initialize or
// become unavailable at runtime. `FailOpen` skips failed targets and
// continues serving from healthy ones. `FailClosed` (default) fails the
// entire session if any target fails.
// +optional
FailureMode FailureMode `json:"failureMode,omitempty"`
@ -357,23 +375,26 @@ type FailureMode string
// McpTargetSelector defines the MCPBackend target to use for this backend.
// +kubebuilder:validation:ExactlyOneOf=selector;static
type McpTargetSelector struct {
// Name of the MCPBackend target.
// Name of the MCP target.
// +required
Name gwv1.SectionName `json:"name"`
// selector is a label selector is the selector to use to select Services.
// If policies are needed on a per-service basis, AgentgatewayPolicy can target the desired Service.
// `selector` is the label selector used to select `Service` resources.
// If policies are needed on a per-service basis, `AgentgatewayPolicy` can
// target the desired `Service`.
// +optional
Selector *McpSelector `json:"selector,omitempty"`
// static configures a static MCP destination. When connecting to in-cluster Services, it is recommended to use
// 'selector' instead.
// `static` configures a static MCP destination. When connecting to
// in-cluster `Service` resources, it is recommended to use `selector`
// instead.
// +optional
Static *McpTarget `json:"static,omitempty"`
}
const (
// Stateful mode creates an MCP session (via mcp-session-id) and internally
// `Stateful` mode creates an MCP session (via `mcp-session-id`) and
// internally
// ensures requests for that session are routed to a consistent backend replica.
Stateful SessionRouting = "Stateful"
Stateless SessionRouting = "Stateless"
@ -384,53 +405,69 @@ type SessionRouting string
// +kubebuilder:validation:AtLeastOneFieldSet
type McpSelector struct {
// namespace is the label selector in which namespaces Services should be selected from.
// If unset, only the namespace of the AgentgatewayBackend is searched.
// `namespace` is the label selector for namespaces that `Service`
// resources should be selected from. If unset, only the namespace of the
// `AgentgatewayBackend` is searched.
// +optional
Namespace *metav1.LabelSelector `json:"namespaces,omitempty"`
// services is the label selector for which Services should be selected.
// `services` is the label selector for which `Service` resources should be
// selected.
// +optional
Service *metav1.LabelSelector `json:"services,omitempty"`
}
// McpTarget defines a single MCPBackend target configuration.
// +kubebuilder:validation:ExactlyOneOf=host;backendRef
// +kubebuilder:validation:XValidation:rule="!has(self.backendRef) || !has(self.policies)",message="mcp target policies may not be used with backendRef"
type McpTarget struct {
// Host is the hostname or IP address of the MCPBackend target.
// +required
Host ShortString `json:"host"`
// Host is the hostname or IP address of the MCP target.
// +optional
Host *ShortString `json:"host,omitempty"`
// Port is the port number of the MCPBackend target.
// `backendRef` references a namespace-local `Service` resource by name.
// When set, this replaces `host` only; `port`, `path`, and `protocol`
// remain configured on this target.
// +optional
BackendRef *corev1.LocalObjectReference `json:"backendRef,omitempty"`
// Port is the port number of the MCP target.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// +required
Port int32 `json:"port"`
// Path is the URL path of the MCPBackend target endpoint.
// Defaults to "/sse" for SSE protocol or "/mcp" for StreamableHTTP protocol if not specified.
// Path is the URL path of the MCP target endpoint.
// Defaults to `"/sse"` for the `SSE` protocol or `"/mcp"` for the
// `StreamableHTTP` protocol if not specified.
// +optional
Path *LongString `json:"path,omitempty"`
// Protocol is the protocol to use for the connection to the MCPBackend target.
// Protocol is the protocol to use for the connection to the MCP
// target.
// +optional
Protocol *MCPProtocol `json:"protocol,omitempty"`
// policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
// in the top level AgentgatewayBackend. Policies are merged on a field-level basis, with order: AgentgatewayPolicy <
// AgentgatewayBackend < AgentgatewayBackend MCP (this field).
// `policies` controls policies for communicating with this backend.
// Policies may also be set in `AgentgatewayPolicy`, or in the top-level
// `AgentgatewayBackend`. Policies are merged on a field-level basis, with
// order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend` MCP (this field).
// This field may only be used with host-based static targets, not
// `backendRef`.
// +optional
Policies *BackendWithMCP `json:"policies,omitempty"`
Policies *BackendSimple `json:"policies,omitempty"`
}
// MCPProtocol defines the protocol to use for the MCPBackend target
// MCPProtocol defines the protocol to use for the `MCPBackend` target.
// +kubebuilder:validation:Enum=StreamableHTTP;SSE
type MCPProtocol string
const (
// MCPProtocolStreamableHTTP specifies Streamable HTTP must be used as the protocol
// MCPProtocolStreamableHTTP specifies that `StreamableHTTP` must be used as
// the protocol.
MCPProtocolStreamableHTTP MCPProtocol = "StreamableHTTP"
// MCPProtocolSSE specifies Server-Sent Events (SSE) must be used as the protocol
// MCPProtocolSSE specifies that Server-Sent Events (`SSE`) must be used as
// the protocol.
MCPProtocolSSE MCPProtocol = "SSE"
)

View File

@ -64,9 +64,9 @@ const (
)
type AgentgatewayParametersLogging struct {
// Logging level in standard RUST_LOG syntax, e.g. 'info', the default, or
// by module, comma-separated. E.g.,
// "rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn"
// Logging level in standard `RUST_LOG` syntax, for example `info` (the
// default), or a comma-separated per-module setting such as
// `rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn`.
// +optional
Level string `json:"level,omitempty"`
// +optional
@ -74,16 +74,16 @@ type AgentgatewayParametersLogging struct {
}
type AgentgatewayParametersConfigs struct {
// logging configuration for Agentgateway. By default, all logs are set to "info" level.
// `logging` configuration for Agentgateway. By default, all logs are set to
// `info` level.
// +optional
Logging *AgentgatewayParametersLogging `json:"logging,omitempty"`
// rawConfig provides an opaque mechanism to configure the agentgateway
// config file (the agentgateway binary has a '-f' option to specify a
// config file, and this is that file). This will be merged with
// configuration derived from typed fields like
// AgentgatewayParametersLogging.Format, and those typed fields will take
// precedence.
// `rawConfig` provides an opaque mechanism to configure the `agentgateway`
// config file. The `agentgateway` binary has a `-f` option to specify a
// config file, and this field supplies that file. This will be merged with
// configuration derived from typed fields like `logging.format`, and those
// typed fields will take precedence.
//
// Example:
//
@ -95,11 +95,11 @@ type AgentgatewayParametersConfigs struct {
// - policies:
// cors:
// allowOrigins:
// - "*"
// - "*"
// allowHeaders:
// - mcp-protocol-version
// - content-type
// - cache-control
// - mcp-protocol-version
// - content-type
// - cache-control
// backends:
// - mcp:
// targets:
@ -129,16 +129,16 @@ type AgentgatewayParametersConfigs struct {
// The container environment variables. These override any existing
// values. If you want to delete an environment variable entirely, use
// `$patch: delete` with AgentgatewayParametersOverlays instead. Note that
// `$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
// [variable
// expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
// does apply, but is highly discouraged -- to set dependent environment
// variables, you can use $(VAR_NAME), but it's highly
// discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
// variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
// `$$(VAR_NAME)` avoids expansion and results in a literal
// `$(VAR_NAME)`.
//
// If `SESSION_KEY` is specified, it takes precedence over the
// controller-managed per-Gateway session key Secret.
// controller-managed per-`Gateway` session key `Secret`.
//
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`
@ -150,10 +150,11 @@ type AgentgatewayParametersConfigs struct {
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// Shutdown delay configuration. How graceful planned or unplanned data
// Shutdown delay configuration. How graceful planned or unplanned data
// plane changes happen is in tension with how quickly rollouts of the data
// plane complete. How long a data plane pod must wait for shutdown to be
// perfectly graceful depends on how you have configured your Gateways.
// perfectly graceful depends on how you have configured your `Gateway`
// resources.
//
// +optional
Shutdown *ShutdownSpec `json:"shutdown,omitempty"`
@ -178,8 +179,8 @@ type IstioSpec struct {
// +kubebuilder:validation:XValidation:rule="self.min <= self.max",message="The 'min' value must be less than or equal to the 'max' value."
type ShutdownSpec struct {
// Minimum time (in seconds) to wait before allowing Agentgateway to
// terminate. Refer to the CONNECTION_MIN_TERMINATION_DEADLINE environment
// variable for details.
// terminate. Refer to the `CONNECTION_MIN_TERMINATION_DEADLINE`
// environment variable for details.
//
// +required
// +kubebuilder:validation:Minimum=0
@ -187,8 +188,8 @@ type ShutdownSpec struct {
Min int64 `json:"min"`
// Maximum time (in seconds) to wait before allowing Agentgateway to
// terminate. Refer to the TERMINATION_GRACE_PERIOD_SECONDS environment
// variable for details.
// terminate. Refer to the `TERMINATION_GRACE_PERIOD_SECONDS`
// environment variable for details.
//
// +required
// +kubebuilder:validation:Minimum=0
@ -197,29 +198,34 @@ type ShutdownSpec struct {
}
type AgentgatewayParametersOverlays struct {
// deployment allows specifying overrides for the generated Deployment resource.
// `deployment` allows specifying overrides for the generated
// `Deployment` resource.
// +optional
Deployment *shared.KubernetesResourceOverlay `json:"deployment,omitempty"`
// service allows specifying overrides for the generated Service resource.
// `service` allows specifying overrides for the generated `Service`
// resource.
// +optional
Service *shared.KubernetesResourceOverlay `json:"service,omitempty"`
// serviceAccount allows specifying overrides for the generated ServiceAccount resource.
// `serviceAccount` allows specifying overrides for the generated
// `ServiceAccount` resource.
// +optional
ServiceAccount *shared.KubernetesResourceOverlay `json:"serviceAccount,omitempty"`
// podDisruptionBudget allows creating a PodDisruptionBudget for the agentgateway proxy.
// If absent, no PDB is created. If present, a PDB is created with its selector
// automatically configured to target the agentgateway proxy Deployment.
// The metadata and spec fields from this overlay are applied to the generated PDB.
// `podDisruptionBudget` allows creating a `PodDisruptionBudget` for the
// agentgateway proxy. If absent, no PDB is created. If present, a PDB is
// created with its selector automatically configured to target the
// agentgateway proxy `Deployment`. The `metadata` and `spec` fields from
// this overlay are applied to the generated PDB.
// +optional
PodDisruptionBudget *shared.KubernetesResourceOverlay `json:"podDisruptionBudget,omitempty"`
// horizontalPodAutoscaler allows creating a HorizontalPodAutoscaler for the agentgateway proxy.
// If absent, no HPA is created. If present, an HPA is created with its scaleTargetRef
// automatically configured to target the agentgateway proxy Deployment.
// The metadata and spec fields from this overlay are applied to the generated HPA.
// `horizontalPodAutoscaler` allows creating a `HorizontalPodAutoscaler`
// for the agentgateway proxy. If absent, no HPA is created. If present, an
// HPA is created with its `scaleTargetRef` automatically configured to
// target the agentgateway proxy `Deployment`. The `metadata` and `spec`
// fields from this overlay are applied to the generated HPA.
// +optional
HorizontalPodAutoscaler *shared.KubernetesResourceOverlay `json:"horizontalPodAutoscaler,omitempty"`
}

View File

@ -12,13 +12,15 @@ import (
// Prompt enrichment allows you to add additional context to the prompt before sending it to the model.
// Unlike RAG or other dynamic context methods, prompt enrichment is static and is applied to every request.
//
// **Note**: Some providers, including Anthropic, do not support SYSTEM role messages, and instead have a dedicated
// system field in the input JSON. In this case, use the [`defaults` setting](#fielddefault) to set the system field.
// **Note**: Some providers, including Anthropic, do not support `SYSTEM`
// role messages, and instead have a dedicated `system` field in the input
// JSON. In this case, use the [`defaults` setting](#fielddefault) to set the
// `system` field.
//
// The following example prepends a system prompt of `Answer all questions in French.`
// and appends `Describe the painting as if you were a famous art critic from the 17th century.`
// to each request that is sent to the `openai` HTTPRoute.
// ```yaml
// The following example prepends a system prompt of
// `Answer all questions in French.` and appends
// `Describe the painting as if you were a famous art critic from the 17th century.`
// to each request that is sent to the `openai` `HTTPRoute`.
//
// name: openai-opt
// namespace: agentgateway-system
@ -37,8 +39,6 @@ import (
// append:
// - role: USER
// content: "Describe the painting as if you were a famous art critic from the 17th century."
//
// ```
type AIPromptEnrichment struct {
// A list of messages to be prepended to the prompt sent by the client.
// +optional
@ -61,7 +61,7 @@ type Message struct {
Content string `json:"content"`
}
// BuiltIn regex patterns for specific types of strings in prompts.
// Built-in regex patterns for specific types of strings in prompts.
// For example, if you specify `CreditCard`, any credit card numbers
// in the request or response are matched.
// +kubebuilder:validation:Enum=Ssn;CreditCard;PhoneNumber;Email;CaSin
@ -85,7 +85,8 @@ const (
)
// Action to take if a regex pattern is matched in a request or response.
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
// This setting applies only to request matches. `PromptguardResponse`
// matches are always masked by default.
// +kubebuilder:validation:Enum=Mask;Reject
type Action string
@ -110,7 +111,8 @@ type Regex struct {
Builtins []BuiltIn `json:"builtins,omitempty"`
// The action to take if a regex pattern is matched in a request or response.
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
// This setting applies only to request matches. `PromptguardResponse`
// matches are always masked by default.
// Defaults to `Mask`.
// +kubebuilder:default=Mask
// +optional
@ -139,7 +141,7 @@ type Webhook struct {
// +kubebuilder:validation:AtLeastOneFieldSet
type CustomResponse struct {
// A custom response message to return to the client. If not specified, defaults to
// "The request was rejected due to inappropriate content".
// `The request was rejected due to inappropriate content`.
// +kubebuilder:default="The request was rejected due to inappropriate content"
// +optional
Message string `json:"message,omitempty"`
@ -153,7 +155,8 @@ type CustomResponse struct {
}
type OpenAIModeration struct {
// model specifies the moderation model to use. For example, `omni-moderation`.
// `model` specifies the moderation model to use. For example,
// `omni-moderation`.
// +optional
Model *string `json:"model,omitempty"`
// policies controls policies for communicating with OpenAI.
@ -171,7 +174,8 @@ type BedrockGuardrails struct {
// +required
GuardrailVersion ShortString `json:"version"`
// Region is the AWS region where the guardrail is deployed (e.g., "us-west-2").
// Region is the AWS region where the guardrail is deployed (for example,
// `us-west-2`).
// +required
Region ShortString `json:"region"`
@ -190,8 +194,8 @@ type GoogleModelArmor struct {
// +required
ProjectID ShortString `json:"projectId"`
// Location is the Google Cloud location (e.g., "us-central1").
// Defaults to "us-central1" if not specified.
// Location is the Google Cloud location (for example, `us-central1`).
// Defaults to `us-central1` if not specified.
// +kubebuilder:default="us-central1"
// +optional
Location *ShortString `json:"location,omitempty"`
@ -206,7 +210,7 @@ type GoogleModelArmor struct {
// +kubebuilder:validation:ExactlyOneOf=regex;webhook;openAIModeration;bedrockGuardrails;googleModelArmor
type PromptguardRequest struct {
// A custom response message to return to the client. If not specified, defaults to
// "The request was rejected due to inappropriate content".
// `The request was rejected due to inappropriate content`.
// +optional
CustomResponse *CustomResponse `json:"response,omitempty"`
@ -218,16 +222,18 @@ type PromptguardRequest struct {
// +optional
Webhook *Webhook `json:"webhook,omitempty"`
// openAIModeration passes prompt data through the OpenAI Moderations endpoint.
// `openAIModeration` passes prompt data through the OpenAI Moderations
// endpoint.
// See https://developers.openai.com/api/reference/resources/moderations for more information.
// +optional
OpenAIModeration *OpenAIModeration `json:"openAIModeration,omitempty"`
// bedrockGuardrails configures AWS Bedrock Guardrails for prompt guarding.
// `bedrockGuardrails` configures AWS Bedrock Guardrails for prompt
// guarding.
// +optional
BedrockGuardrails *BedrockGuardrails `json:"bedrockGuardrails,omitempty"`
// googleModelArmor configures Google Model Armor for prompt guarding.
// `googleModelArmor` configures Google Model Armor for prompt guarding.
// +optional
GoogleModelArmor *GoogleModelArmor `json:"googleModelArmor,omitempty"`
}
@ -236,7 +242,7 @@ type PromptguardRequest struct {
// +kubebuilder:validation:ExactlyOneOf=regex;webhook;bedrockGuardrails;googleModelArmor
type PromptguardResponse struct {
// A custom response message to return to the client. If not specified, defaults to
// "The response was rejected due to inappropriate content".
// `The response was rejected due to inappropriate content`.
// +optional
CustomResponse *CustomResponse `json:"response,omitempty"`
@ -248,11 +254,12 @@ type PromptguardResponse struct {
// +optional
Webhook *Webhook `json:"webhook,omitempty"`
// bedrockGuardrails configures AWS Bedrock Guardrails for prompt guarding.
// `bedrockGuardrails` configures AWS Bedrock Guardrails for prompt
// guarding.
// +optional
BedrockGuardrails *BedrockGuardrails `json:"bedrockGuardrails,omitempty"`
// googleModelArmor configures Google Model Armor for prompt guarding.
// `googleModelArmor` configures Google Model Armor for prompt guarding.
// +optional
GoogleModelArmor *GoogleModelArmor `json:"googleModelArmor,omitempty"`
}
@ -263,24 +270,22 @@ type PromptguardResponse struct {
//
// This example rejects any request prompts that contain
// the string "credit card", and masks any credit card numbers in the response.
// ```yaml
// promptGuard:
//
// request:
// - response:
// message: "Rejected due to inappropriate content"
// regex:
// action: REJECT
// matches:
// - pattern: "credit card"
// name: "CC"
// response:
// - regex:
// builtins:
// - CREDIT_CARD
// action: MASK
// promptGuard:
// request:
// - response:
// message: "Rejected due to inappropriate content"
// regex:
// action: REJECT
// matches:
// - pattern: "credit card"
// name: "CC"
// response:
// - regex:
// builtins:
// - CREDIT_CARD
// action: MASK
//
// ```
// +kubebuilder:validation:AtLeastOneFieldSet
type AIPromptGuard struct {
// Prompt guards to apply to requests sent by the client.
@ -303,35 +308,29 @@ type AIPromptGuard struct {
// Defaults set here do _not_ override those user-provided values unless you explicitly set `override` to `true`.
//
// Example: Setting a default system field for Anthropic, which does not support system role messages:
// ```yaml
// defaults:
// - field: "system"
// value: "answer all questions in French"
//
// ```
// defaults:
// - field: "system"
// value: "answer all questions in French"
//
// Example: Setting a default temperature and overriding `max_tokens`:
// ```yaml
// defaults:
// - field: "temperature"
// value: "0.5"
// - field: "max_tokens"
// value: "100"
// override: true
//
// ```
// defaults:
// - field: "temperature"
// value: "0.5"
// - field: "max_tokens"
// value: "100"
// override: true
//
// Example: Setting custom lists fields:
// ```yaml
// defaults:
// - field: "custom_integer_list"
// value: [1,2,3]
//
// overrides:
// - field: "custom_string_list"
// value: ["one","two","three"]
// defaults:
// - field: "custom_integer_list"
// value: [1,2,3]
//
// ```
// overrides:
// - field: "custom_string_list"
// value: ["one","two","three"]
//
// Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD.
type FieldDefault struct {
@ -369,10 +368,9 @@ type FieldTransformation struct {
// Example:
//
// promptCaching:
// cacheSystem: true # Cache system prompts
// cacheMessages: true # Cache conversation history
// cacheTools: false # Don't cache tool definitions
// minTokens: 1024 # Only cache if ≥1024 tokens
// cacheSystem: true
// cacheMessages: true
// cacheTools: false
//
// Cost savings example:
// - Without caching: 10,000 tokens × $3/MTok = $0.03
@ -403,4 +401,13 @@ type PromptCachingConfig struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=1024
MinTokens int `json:"minTokens,omitempty"`
// CacheMessageOffset shifts the message cache point further back in the
// conversation. 0 (default) places it at the second-to-last message.
// Higher values move it N additional messages towards the start, clamped
// to bounds.
// +optional
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
CacheMessageOffset int `json:"cacheMessageOffset,omitempty"`
}

View File

@ -1218,27 +1218,6 @@ func (in *BackendWithAI) DeepCopy() *BackendWithAI {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BackendWithMCP) DeepCopyInto(out *BackendWithMCP) {
*out = *in
in.BackendSimple.DeepCopyInto(&out.BackendSimple)
if in.MCP != nil {
in, out := &in.MCP, &out.MCP
*out = new(BackendMCP)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendWithMCP.
func (in *BackendWithMCP) DeepCopy() *BackendWithMCP {
if in == nil {
return nil
}
out := new(BackendWithMCP)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BasicAuthentication) DeepCopyInto(out *BasicAuthentication) {
*out = *in
@ -1505,6 +1484,11 @@ func (in *Frontend) DeepCopyInto(out *Frontend) {
*out = new(FrontendTCP)
(*in).DeepCopyInto(*out)
}
if in.NetworkAuthorization != nil {
in, out := &in.NetworkAuthorization, &out.NetworkAuthorization
*out = new(shared.Authorization)
(*in).DeepCopyInto(*out)
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(FrontendTLS)
@ -1894,6 +1878,11 @@ func (in *JWTAuthentication) DeepCopyInto(out *JWTAuthentication) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.MCP != nil {
in, out := &in.MCP, &out.MCP
*out = new(JWTMCPConfig)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTAuthentication.
@ -1906,6 +1895,33 @@ func (in *JWTAuthentication) DeepCopy() *JWTAuthentication {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JWTMCPConfig) DeepCopyInto(out *JWTMCPConfig) {
*out = *in
if in.ResourceMetadata != nil {
in, out := &in.ResourceMetadata, &out.ResourceMetadata
*out = make(map[string]apiextensionsv1.JSON, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
}
if in.Provider != nil {
in, out := &in.Provider, &out.Provider
*out = new(McpIDP)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTMCPConfig.
func (in *JWTMCPConfig) DeepCopy() *JWTMCPConfig {
if in == nil {
return nil
}
out := new(JWTMCPConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JWTProvider) DeepCopyInto(out *JWTProvider) {
*out = *in
@ -2142,6 +2158,16 @@ func (in *McpSelector) DeepCopy() *McpSelector {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *McpTarget) DeepCopyInto(out *McpTarget) {
*out = *in
if in.Host != nil {
in, out := &in.Host, &out.Host
*out = new(ShortString)
**out = **in
}
if in.BackendRef != nil {
in, out := &in.BackendRef, &out.BackendRef
*out = new(corev1.LocalObjectReference)
**out = **in
}
if in.Path != nil {
in, out := &in.Path, &out.Path
*out = new(LongString)
@ -2154,7 +2180,7 @@ func (in *McpTarget) DeepCopyInto(out *McpTarget) {
}
if in.Policies != nil {
in, out := &in.Policies, &out.Policies
*out = new(BackendWithMCP)
*out = new(BackendSimple)
(*in).DeepCopyInto(*out)
}
}

View File

@ -29,34 +29,36 @@ type ObjectMetadata struct {
// Overlays are applied **after** all typed configuration fields have been processed.
// The full merge order is:
//
// 1. GatewayClass typed configuration fields (e.g., replicas, image settings from parametersRef)
// 2. Gateway typed configuration fields (from infrastructure.parametersRef)
// 3. GatewayClass overlays are applied
// 4. Gateway overlays are applied
// 1. `GatewayClass` typed configuration fields, for example replicas or image settings from `parametersRef`
// 2. `Gateway` typed configuration fields from `infrastructure.parametersRef`
// 3. `GatewayClass` overlays are applied
// 4. `Gateway` overlays are applied
//
// This ordering means Gateway-level configuration overrides GatewayClass-level configuration
// This ordering means `Gateway`-level configuration overrides
// `GatewayClass`-level configuration
// at each stage. For example, if both levels set the same label, the Gateway value wins.
type KubernetesResourceOverlay struct {
// metadata defines a subset of object metadata to be customized.
// Labels and annotations are merged with existing values. If both GatewayClass
// and Gateway parameters define the same label or annotation key, the Gateway
// value takes precedence (applied second).
// `metadata` defines a subset of object metadata to be customized.
// `labels` and `annotations` are merged with existing values. If both
// `GatewayClass` and `Gateway` parameters define the same label or
// annotation key, the `Gateway` value takes precedence (applied second).
// +optional
Metadata *ObjectMetadata `json:"metadata,omitempty"`
// Spec provides an opaque mechanism to configure the resource Spec.
// This field accepts a complete or partial Kubernetes resource spec (e.g., PodSpec, ServiceSpec)
// and will be merged with the generated configuration using **Strategic Merge Patch** semantics.
// `spec` provides an opaque mechanism to configure the resource spec.
// This field accepts a complete or partial Kubernetes resource spec, such
// as `PodSpec` or `ServiceSpec`, and will be merged with the generated
// configuration using **Strategic Merge Patch** semantics.
//
// # Application Order
//
// Overlays are applied after all typed configuration fields from both levels.
// The full merge order is:
//
// 1. GatewayClass typed configuration fields
// 2. Gateway typed configuration fields
// 3. GatewayClass overlays
// 4. Gateway overlays (can override all previous values)
// 1. `GatewayClass` typed configuration fields
// 2. `Gateway` typed configuration fields
// 3. `GatewayClass` overlays
// 4. `Gateway` overlays (can override all previous values)
//
// # Strategic Merge Patch & Deletion Guide
//
@ -67,7 +69,8 @@ type KubernetesResourceOverlay struct {
// Simple fields (strings, integers, booleans) in your config will overwrite the generated defaults.
//
// **2. Merging Lists (Append/Merge):**
// Lists with "merge keys" (like `containers` which merges on `name`, or `tolerations` which merges on `key`)
// Lists with "merge keys", like `containers` which merges on `name`, or
// `tolerations` which merges on `key`,
// will append your items to the generated list, or update existing items if keys match.
//
// **3. Deleting Fields or List Items ($patch: delete):**
@ -76,6 +79,7 @@ type KubernetesResourceOverlay struct {
// and is the recommended approach because it works with both client-side
// and server-side apply.
//
//
// spec:
// template:
// spec:
@ -86,11 +90,12 @@ type KubernetesResourceOverlay struct {
// nodeSelector:
// $patch: delete
// containers:
// # Be sure to use the correct proxy name here or you will add a container instead of modifying a container:
// - name: proxy-name
// # Delete container-level securityContext
// securityContext:
// $patch: delete
// # Be sure to use the correct proxy name here or you will add a
// # container instead of modifying a container.
// - name: proxy-name
// # Delete container-level securityContext
// securityContext:
// $patch: delete
//
// **4. Null Values (server-side apply only):**
// Setting a field to `null` can also remove it, but this ONLY works with
@ -99,6 +104,7 @@ type KubernetesResourceOverlay struct {
// the API server, so the deletion won't occur. Prefer `$patch: delete`
// for consistent behavior across both apply modes.
//
//
// spec:
// template:
// spec:
@ -108,6 +114,7 @@ type KubernetesResourceOverlay struct {
// To replace an entire map with your values (instead of merging), use `$patch: replace`.
// This removes all existing keys and replaces them with only your specified keys.
//
//
// spec:
// template:
// spec:
@ -118,18 +125,19 @@ type KubernetesResourceOverlay struct {
// **6. Replacing Lists Entirely ($patch: replace):**
// If you want to strictly define a list and ignore all generated defaults, use `$patch: replace`.
//
//
// service:
// spec:
// ports:
// - $patch: replace
// - name: http
// port: 80
// targetPort: 8080
// protocol: TCP
// - name: https
// port: 443
// targetPort: 8443
// protocol: TCP
// - $patch: replace
// - name: http
// port: 80
// targetPort: 8080
// protocol: TCP
// - name: https
// port: 443
// targetPort: 8443
// protocol: TCP
//
// +optional
// +kubebuilder:validation:Type=object

View File

@ -1,7 +1,7 @@
package shared
// PolicyConditionType is a type of condition for a policy. This type should be
// used with a Policy resource Status.Conditions field.
// used with a Policy resource `Status.Conditions` field.
type PolicyConditionType string
// PolicyConditionReason is a reason for a policy condition.
@ -10,44 +10,47 @@ type PolicyConditionReason string
const (
// PolicyConditionAccepted indicates whether the policy has been accepted or rejected, and why.
//
// Possible reasons for this condition to be True are:
// * Valid
// Possible reasons for this condition to be `True` are:
// * `Valid`
//
// Possible reasons for this condition to be False are:
// * Pending
// * Invalid
// Possible reasons for this condition to be `False` are:
// * `Pending`
// * `Invalid`
//
PolicyConditionAccepted PolicyConditionType = "Accepted"
// PolicyConditionAttached indicates whether the policy has attached to the targeted resources.
//
// Possible reasons for this condition to be True are:
// * Attached
// * Merged
// Possible reasons for this condition to be `True` are:
// * `Attached`
// * `Merged`
//
// Possible reasons for this condition to be False are:
// * Pending
// * Overridden
// Possible reasons for this condition to be `False` are:
// * `Pending`
// * `Overridden`
//
PolicyConditionAttached PolicyConditionType = "Attached"
// PolicyReasonValid is used with the "Accepted" condition when the policy
// PolicyReasonValid is used with the `Accepted` condition when the policy
// has been accepted by the system.
PolicyReasonValid PolicyConditionReason = "Valid"
// PolicyReasonInvalid is used with the "Accepted" or "Attached" condition when the policy
// is syntactically or semantically invalid.
// PolicyReasonInvalid is used with the `Accepted` or `Attached` condition
// when the policy is syntactically or semantically invalid.
PolicyReasonInvalid PolicyConditionReason = "Invalid"
// PolicyReasonAttached is used with the "Attached" condition when the
// PolicyReasonAttached is used with the `Attached` condition when the
// policy has been successfully attached to all the targeted resources.
PolicyReasonAttached PolicyConditionReason = "Attached"
// PolicyReasonPending is used with the "Accepted" or "Attached" condition when the policy has been referenced but not yet fully processed by the controller.
// PolicyReasonPending is used with the `Accepted` or `Attached` condition
// when the policy has been referenced but not yet fully processed by the
// controller.
PolicyReasonPending PolicyConditionReason = "Pending"
// PolicyReasonPartiallyValid is used with the "Accepted" condition when the policy has been accepted by the system,
// but some of the referenced resources are not valid.
// PolicyReasonPartiallyValid is used with the `Accepted` condition when the
// policy has been accepted by the system, but some of the referenced
// resources are not valid.
PolicyReasonPartiallyValid PolicyConditionReason = "PartiallyValid"
)

View File

@ -2,14 +2,22 @@ package shared
// Authorization defines the configuration for role-based access control.
type Authorization struct {
// Policy specifies the Authorization rule to evaluate.
// A policy matches when **any** of the conditions evaluates to true.
// `policy` specifies the authorization rule to evaluate.
//
// * For `Allow` rules: any policy allows the request.
// * For `Require` rules: all policies must match for the request to be allowed.
// * For `Deny` rules: any matching policy denies the request. Note: a CEL expression that fails to evaluate is not
// considered to match, making this a risky policy; prefer to use `Require`.
//
// The presence of at least one `Allow` rule triggers a deny-by-default policy, requiring at least 1 match to allow.
// With no rules, all requires are allowed.
// +required
Policy AuthorizationPolicy `json:"policy"`
// Action defines whether the rule allows or denies the request if matched.
// If unspecified, the default is "Allow".
// +kubebuilder:validation:Enum=Allow;Deny
// `action` defines whether the rule allows, denies, or requires the request if
// matched. If unspecified, the default is `Allow`.
// Require policies are conjunctive across merged policies: all require policies must match.
// +kubebuilder:validation:Enum=Allow;Deny;Require
// +kubebuilder:default=Allow
// +optional
Action AuthorizationPolicyAction `json:"action,omitempty"`
@ -21,10 +29,11 @@ type Authorization struct {
// +k8s:deepcopy-gen=false
type CELExpression string
// AuthorizationPolicy defines a single Authorization rule.
// AuthorizationPolicy defines a single authorization rule.
type AuthorizationPolicy struct {
// MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
// These expression should be in the form of a Common Expression Language (CEL) expression.
// These expressions should be in the form of a Common Expression Language
// (`CEL`) expression.
//
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=256
@ -32,12 +41,17 @@ type AuthorizationPolicy struct {
MatchExpressions []CELExpression `json:"matchExpressions"`
}
// AuthorizationPolicyAction defines the action to take when the RBACPolicies matches.
// AuthorizationPolicyAction defines the action to take when the
// `RBACPolicies` matches.
type AuthorizationPolicyAction string
const (
// AuthorizationPolicyActionAllow defines the action to take when the RBACPolicies matches.
// AuthorizationPolicyActionAllow defines the action to take when the
// `RBACPolicies` matches.
AuthorizationPolicyActionAllow AuthorizationPolicyAction = "Allow"
// AuthorizationPolicyActionDeny denies the action to take when the RBACPolicies matches.
// AuthorizationPolicyActionDeny denies the action to take when the
// `RBACPolicies` matches.
AuthorizationPolicyActionDeny AuthorizationPolicyAction = "Deny"
// AuthorizationPolicyActionRequire requires the action to take when the RBACPolicies matches.
AuthorizationPolicyActionRequire AuthorizationPolicyAction = "Require"
)

View File

@ -8,7 +8,7 @@ import (
// Control-plane Authorization rules not specific to policies:
// +kubebuilder:rbac:groups=authentication.k8s.io,resources=tokenreviews,verbs=create
// Select the object by Name and Namespace.
// Select the object by `name` and `namespace`.
// You can target only one object at a time.
type NamespacedObjectReference struct {
// The name of the target resource.
@ -21,7 +21,7 @@ type NamespacedObjectReference struct {
Namespace *gwv1.Namespace `json:"namespace,omitempty"`
}
// Select the object to attach the policy by Group, Kind, and Name.
// Select the object to attach the policy by `Group`, `Kind`, and `Name`.
// The object must be in the same namespace as the policy.
// You can target only one object at a time.
type LocalPolicyTargetReference struct {
@ -30,8 +30,7 @@ type LocalPolicyTargetReference struct {
// +required
Group gwv1.Group `json:"group"`
// The API kind of the target resource,
// such as Gateway or HTTPRoute.
// The API kind of the target resource, such as `Gateway` or `HTTPRoute`.
// +required
Kind gwv1.Kind `json:"kind"`
@ -40,7 +39,8 @@ type LocalPolicyTargetReference struct {
Name gwv1.ObjectName `json:"name"`
}
// Select the object to attach the policy by Group, Kind, Name and SectionName.
// Select the object to attach the policy by `Group`, `Kind`, `Name`, and
// `SectionName`.
// The object must be in the same namespace as the policy.
// You can target only one object at a time.
type LocalPolicyTargetReferenceWithSectionName struct {
@ -51,20 +51,17 @@ type LocalPolicyTargetReferenceWithSectionName struct {
SectionName *gwv1.SectionName `json:"sectionName,omitempty"`
}
// LocalPolicyTargetSelector selects the object to attach the policy by Group, Kind, and MatchLabels.
// LocalPolicyTargetSelector selects the object to attach the policy by
// `Group`, `Kind`, and `MatchLabels`.
// The object must be in the same namespace as the policy and match the
// specified labels.
// Do not use targetSelectors when reconciliation times are critical, especially if you
// have a large number of policies that target the same resource.
// Instead, use targetRefs to attach the policy.
type LocalPolicyTargetSelector struct {
// The API group of the target resource.
// For Kubernetes Gateway API resources, the group is `gateway.networking.k8s.io`.
// +required
Group gwv1.Group `json:"group"`
// The API kind of the target resource,
// such as Gateway or HTTPRoute.
// The API kind of the target resource, such as `Gateway` or `HTTPRoute`.
// +required
Kind gwv1.Kind `json:"kind"`
@ -73,12 +70,14 @@ type LocalPolicyTargetSelector struct {
MatchLabels map[string]string `json:"matchLabels"`
}
// LocalPolicyTargetSelectorWithSectionName the object to attach the policy by Group, Kind, MatchLabels, and optionally SectionName.
// LocalPolicyTargetSelectorWithSectionName selects the object to attach the
// policy by `Group`, `Kind`, `MatchLabels`, and optionally `SectionName`.
// The object must be in the same namespace as the policy and match the
// specified labels.
// Do not use targetSelectors when reconciliation times are critical, especially if you
// Do not use `targetSelectors` when reconciliation times are critical,
// especially if you
// have a large number of policies that target the same resource.
// Instead, use targetRefs to attach the policy.
// Instead, use `targetRefs` to attach the policy.
type LocalPolicyTargetSelectorWithSectionName struct {
LocalPolicyTargetSelector `json:",inline"`
@ -108,17 +107,17 @@ type PolicyAncestorStatus struct {
// ControllerName is a domain/path string that indicates the name of the
// controller that wrote this status. This corresponds with the
// controllerName field on GatewayClass.
// `controllerName` field on `GatewayClass`.
//
// Example: "example.net/gateway-controller".
// Example: `example.net/gateway-controller`.
//
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
// The format of this field is `DOMAIN "/" PATH`, where `DOMAIN` and `PATH` are
// valid Kubernetes names
// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
//
// Controllers MUST populate this field when writing status. Controllers should ensure that
// entries to status populated with their ControllerName are cleaned up when they are no
// longer necessary.
// Controllers MUST populate this field when writing status. Controllers
// should ensure that entries in status populated with their `ControllerName`
// are cleaned up when they are no longer necessary.
// +required
ControllerName string `json:"controllerName"`
@ -136,24 +135,24 @@ type PolicyAncestorStatus struct {
// +kubebuilder:validation:ExactlyOneOf=exact;prefix;suffix;contains;safeRegex
type StringMatcher struct {
// The input string must match exactly the string specified here.
// Example: abc matches the value abc
// Example: `abc` matches the value `abc`.
// +optional
Exact *string `json:"exact,omitempty"`
// The input string must have the prefix specified here.
// Note: empty prefix is not allowed, please use regex instead.
// Example: abc matches the value abc.xyz
// Example: `abc` matches the value `abc.xyz`.
// +optional
Prefix *string `json:"prefix,omitempty"`
// The input string must have the suffix specified here.
// Note: empty prefix is not allowed, please use regex instead.
// Example: abc matches the value xyz.abc
// Example: `abc` matches the value `xyz.abc`.
// +optional
Suffix *string `json:"suffix,omitempty"`
// The input string must contain the substring specified here.
// Example: abc matches the value xyz.abc.def
// Example: `abc` matches the value `xyz.abc.def`.
// +optional
Contains *string `json:"contains,omitempty"`

View File

@ -4,17 +4,19 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
type Timeouts struct {
// Request specifies a timeout for an individual request from the gateway to a backend.
// This spans between the point at which the entire downstream request (i.e. end-of-stream) has been
// This spans between the point at which the entire downstream request
// (i.e. end-of-stream) has been
// processed and when the backend response has been completely processed.
// A value of 0 effectively disables the timeout.
// It is specified as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "1s" or "500ms".
// A value of `0` effectively disables the timeout.
// It is specified as a sequence of decimal numbers, each with optional
// fraction and a unit suffix, such as `1s` or `500ms`.
// +optional
//
// +kubebuilder:validation:XValidation:rule="matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')",message="invalid duration value"
Request *metav1.Duration `json:"request,omitempty"`
// StreamIdle specifies a timeout for a requests' idle streams.
// A value of 0 effectively disables the timeout.
// A value of `0` effectively disables the timeout.
// +optional
//
// +kubebuilder:validation:XValidation:rule="matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')",message="invalid duration value"

View File

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/setup"
"github.com/agentgateway/agentgateway/controller/pkg/setup"
"github.com/agentgateway/agentgateway/controller/pkg/version"
)
@ -20,7 +20,7 @@ func main() {
fmt.Println(version.String())
return nil
}
s, err := setup.New()
s, err := setup.New(setup.Options{})
if err != nil {
return fmt.Errorf("error setting up agentgateway: %w", err)
}

View File

@ -1,341 +1,9 @@
#!/usr/bin/env bash
set -o pipefail
set -o nounset
set -o errexit
# The GIE EPP used in e2e tests
EPP_YAML_PATH="test/e2e/features/inferenceextension/testdata/epp.yaml"
# The base URLs for fetching CRDs
GIE_CRD_BASE="https://raw.githubusercontent.com/kubernetes-sigs/gateway-api-inference-extension"
GATEWAY_CRD_BASE="https://raw.githubusercontent.com/kubernetes-sigs/gateway-api"
# The Gateway API channel (experimental or stable)
CONFORMANCE_CHANNEL="${CONFORMANCE_CHANNEL:-experimental}"
if [ $# -ne 2 ]; then
echo "Usage: $0 {gie|gtw} REF"
echo " REF can be a tag (e.g. v1.3.0) or a commit SHA."
exit 2
fi
kind="$1"; shift
ref="$1"; shift
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "Bumping $kind to ref: $ref ..."
# Check the current module version
case "$kind" in
gie) module="sigs.k8s.io/gateway-api-inference-extension";;
gtw) module="sigs.k8s.io/gateway-api";;
*) echo "Unknown kind: $kind" >&2; exit 1;;
set -euo pipefail
[ $# -eq 2 ] || { echo "usage: $0 {gie|gtw} REF" >&2; exit 2; }
cd "$(dirname "${BASH_SOURCE[0]}")/.."
case "$1" in
gtw) kubectl kustomize "https://github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=$2" > pkg/kgateway/crds/gateway-crds.yaml ;;
gie) kubectl kustomize "https://github.com/kubernetes-sigs/gateway-api-inference-extension/config/crd?ref=$2" > pkg/kgateway/crds/inference-crds.yaml ;;
*) echo "usage: $0 {gie|gtw} REF" >&2; exit 2 ;;
esac
current_version="$(go list -m -f '{{.Version}}' "$module" 2>/dev/null || true)"
# Resolve desired ref to a module version (pseudo-version if ref is non-tag)
resolved_version="$(
go list -m -json "${module}@${ref}" 2>/dev/null \
| sed -n 's/.*"Version": *"\([^"]*\)".*/\1/p'
)"
if [ -z "${resolved_version}" ]; then
echo "ERROR: Could not resolve ${module}@${ref} to a module version."
echo " Verify the ref exists in the upstream repo."
exit 1
fi
echo "Current version: ${current_version:-<none>}"
echo "Desired version (resolved): ${resolved_version}"
# If already at the desired version, skip go get/mod tidy but still refresh CRDs.
skip_get=0
if [ -n "$current_version" ] && [ "$current_version" = "$resolved_version" ]; then
echo "Already at ${resolved_version} - skipping dependency bump, refreshing CRDs..."
skip_get=1
fi
if [ $skip_get -eq 0 ]; then
# Bump the module deps
echo "Running: go get ${module}@${ref}"
go get "${module}@${ref}"
echo "Running: go mod tidy"
go mod tidy
fi
# Update GIE_CRD_VERSION in files (for GIE bumps only) to the exact ref passed in.
update_gie_crd_version_line() {
# $1 = file path, $2 = mode ("mk" for Makefile-style, "sh" for shell)
local file="$1"
local mode="$2"
if [ ! -f "$file" ]; then
echo "WARN: $file not found, skipping"
return 0
fi
echo "Setting GIE_CRD_VERSION to '${ref}' in $file"
if [ "$mode" = "mk" ]; then
# If the var exists, replace its RHS (supports '=', '?=', '=').
if grep -Eq '^[[:space:]]*GIE_CRD_VERSION[[:space:]]*([?:]?=)' "$file"; then
sed -i.bak -E \
-e 's|^([[:space:]]*GIE_CRD_VERSION[[:space:]]*[?:]?=)[[:space:]]*.*$|\1 '"$ref"'|g' \
"$file"
rm -f "$file.bak"
else
# Append a sane default form if not present.
printf '\nGIE_CRD_VERSION ?= %s\n' "$ref" >> "$file"
fi
else
# Shell-style assignment; replace the whole line if present, else append.
if grep -Eq '^[[:space:]]*GIE_CRD_VERSION=' "$file"; then
sed -i.bak -E \
-e 's|^[[:space:]]*GIE_CRD_VERSION=.*$|GIE_CRD_VERSION="'"$ref"'"|g' \
"$file"
rm -f "$file.bak"
else
printf '\nGIE_CRD_VERSION="%s"\n' "$ref" >> "$file"
fi
fi
}
# Helper: derive image tag from module version.
# - For pseudo-versions that end with '...-YYYYMMDDHHMMSS-<sha>', produce 'vYYYYMMDD-<sha7>'
# - Otherwise (e.g., semver tag), use the version itself as the image tag.
derive_image_tag() {
local ver="$1"
# Match the trailing timestamp + sha anywhere at the end (robust for different pseudo-version bases)
if [[ "$ver" =~ ([0-9]{14})-([0-9a-f]{7,40})$ ]]; then
local ts="${BASH_REMATCH[1]}"
local sha="${BASH_REMATCH[2]}"
# Use YYYYMMDD and first 7 chars of sha
echo "v${ts:0:8}-${sha:0:7}"
else
# Fall back to the version string itself (for true tags like v1.0.0 or v1.0.0-rc.2)
echo "$ver"
fi
}
# Update e2e EPP image tag (GIE only)
if [ "$kind" = gie ]; then
img_tag="$(derive_image_tag "$resolved_version")"
echo "Updating EPP image tag in $EPP_YAML_PATH to ${img_tag} (from module version: ${resolved_version})"
# macOS/BSD-safe inline edit
sed -i.bak -E \
-e "s|(gateway-api-inference-extension/epp:)[^[:space:]\"]+|\1${img_tag}|g" \
"$root/$EPP_YAML_PATH"
rm -f "$root/$EPP_YAML_PATH.bak"
# Also update GIE_CRD_VERSION to the ref we were given (tag or SHA).
update_gie_crd_version_line "$root/Makefile" "mk"
if [ -f "$root/hack/kind/setup-kind.sh" ]; then
update_gie_crd_version_line "$root/hack/kind/setup-kind.sh" "sh"
elif [ -f "$root/kind/setup-kind.sh" ]; then
update_gie_crd_version_line "$root/kind/setup-kind.sh" "sh"
else
echo "WARN: No setup-kind.sh found under hack/kind or kind/, skipping"
fi
fi
update_make_var_line() {
local file="$1"
local var="$2"
local val="$3"
if [ ! -f "$file" ]; then
echo "WARN: $file not found, skipping"
return 0
fi
echo "Setting ${var} to '${val}' in ${file}"
if grep -Eq "^[[:space:]]*${var}[[:space:]]*([?:]?=)" "$file"; then
sed -i.bak -E \
-e "s|^([[:space:]]*${var}[[:space:]]*[?:]?=)[[:space:]]*.*$|\1 ${val}|g" \
"$file"
rm -f "$file.bak"
else
printf '\n%s ?= %s\n' "$var" "$val" >> "$file"
fi
}
update_nightly_gateway_api_matrix_versions() {
local file="$1"
local old="$2"
local new="$3"
if [ ! -f "$file" ]; then
echo "WARN: $file not found, skipping"
return 0
fi
# Escape dots for ERE (good enough for vX.Y.Z / -rc.N)
local old_esc="${old//./\\.}"
echo "Updating nightly-tests gateway-api matrix: ${old} -> ${new} in ${file}"
sed -i.bak -E \
-e "s|(version:[[:space:]]*')${old_esc}(')|\1${new}\2|g" \
"$file"
rm -f "$file.bak"
}
# Fetch and store the CRDs
crd_dir="$root/pkg/kgateway/crds"
mkdir -p "$crd_dir"
if [ "$kind" = gie ]; then
# Build a single all-in-one CRD file.
outfile="${crd_dir}/inference-crds.yaml"
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
# Known CRDs/sources
declare -a SOURCES=(
"${GIE_CRD_BASE}/${ref}/config/crd/bases/inference.networking.k8s.io_inferencepools.yaml"
"${GIE_CRD_BASE}/${ref}/config/crd/bases/inference.networking.x-k8s.io_inferenceobjectives.yaml"
)
tmpout="$(mktemp)"
: > "$tmpout"
for url in "${SOURCES[@]}"; do
fname="$tmpdir/$(basename "$url")"
echo "Fetching $url"
curl -fsS "$url" -o "$fname"
{
echo "# Source: $url"
cat "$fname"
echo "---"
} >> "$tmpout"
done
# Remove the trailing '---' and any trailing blank lines
# shellcheck disable=SC2016
awk '{
lines[NR]=$0
} END {
# drop trailing separators/blank lines
i=NR
while (i>0 && (lines[i] ~ /^---[[:space:]]*$/ || lines[i] ~ /^[[:space:]]*$/)) { i-- }
for (j=1; j<=i; j++) print lines[j]
}' "$tmpout" > "${tmpout}.trim"
mv -f "${tmpout}.trim" "$outfile"
rm -f "$tmpout"
echo "Wrote GIE all-in-one CRDs to $outfile"
elif [ "$kind" = gtw ]; then
# Gateway API CRDs
# Use release assets when ref resolves to a non-pseudo version (tags incl. -rc.*),
# otherwise iterate files from the repo for pseudo-versions (timestamps/SHAs).
out_all="${crd_dir}/gateway-crds.yaml"
is_pseudo=0
if [[ "$resolved_version" =~ ([0-9]{14})-([0-9a-f]{7,40})$ ]]; then
is_pseudo=1
fi
# Read current pinned conformance version from the Makefile (so we only replace “latest”)
current_conf="$(
sed -nE 's/^[[:space:]]*CONFORMANCE_VERSION[[:space:]]*[?:]?=[[:space:]]*([^[:space:]#]+).*$/\1/p' \
"$root/Makefile" | head -n1
)"
if [ $is_pseudo -eq 0 ]; then
# Update Makefile pin
update_make_var_line "$root/Makefile" "CONFORMANCE_VERSION" "$resolved_version"
# Update nightly-tests “latest” entries (the ones matching current_conf)
if [ -n "${current_conf:-}" ]; then
update_nightly_gateway_api_matrix_versions \
"$root/.github/workflows/nightly-tests.yaml" \
"$current_conf" \
"$resolved_version"
else
echo "WARN: Could not parse current CONFORMANCE_VERSION from Makefile; skipping workflow update"
fi
else
echo "WARN: Gateway API resolved to pseudo-version (${resolved_version}); leaving CONFORMANCE_VERSION and nightly matrix unchanged"
fi
if [ $is_pseudo -eq 0 ]; then
# Try to download prebuilt install manifest from the GitHub release
if [ "${CONFORMANCE_CHANNEL}" = "experimental" ]; then
asset="experimental-install.yaml"
else
asset="standard-install.yaml"
fi
release_url="https://github.com/kubernetes-sigs/gateway-api/releases/download/${resolved_version}/${asset}"
echo "Attempting to fetch Gateway API release asset: ${release_url}"
tmp_release="$(mktemp)"
if curl -fLSs "${release_url}" -o "${tmp_release}"; then
# Extra safety: ensure non-empty before replacing
if [ -s "${tmp_release}" ]; then
mv -f "${tmp_release}" "${out_all}"
echo "Wrote Gateway (${CONFORMANCE_CHANNEL}) CRDs to ${out_all} from release asset"
else
echo "Release asset downloaded but empty; falling back to repo iteration for ${ref}"
rm -f "${tmp_release}"
is_pseudo=1
fi
else
echo "Release asset not available (or download failed); falling back to repo iteration for ${ref}"
rm -f "${tmp_release}"
is_pseudo=1
fi
fi
if [ $is_pseudo -eq 1 ]; then
# Fallback for pseudo-versions (or when release asset unavailable):
# fetch all YAMLs under config/crd/${CONFORMANCE_CHANNEL} and concatenate.
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
archive_url="https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/${ref}"
echo "Downloading Gateway API archive: $archive_url"
curl -fsSL "$archive_url" -o "$tmpdir/gtw.tar.gz"
echo "Extracting archive..."
tar -xzf "$tmpdir/gtw.tar.gz" -C "$tmpdir"
srcdir="$(echo "$tmpdir"/gateway-api-*/config/crd/${CONFORMANCE_CHANNEL})"
if [ ! -d "$srcdir" ]; then
echo "ERROR: Could not find extracted CRD directory: $srcdir"
exit 1
fi
tmp_all="$(mktemp)"
: > "$tmp_all"
echo "Building all-in-one CRD file at ${out_all} from ${srcdir}"
# Concatenate in a stable order and include both x-k8s.io and k8s.io groups.
for f in $(ls "$srcdir"/*.yaml | sort); do
base="$(basename "$f")"
echo "# Source: ${GATEWAY_CRD_BASE}/${ref}/config/crd/${CONFORMANCE_CHANNEL}/${base}" >> "$tmp_all"
cat "$f" >> "$tmp_all"
echo "---" >> "$tmp_all"
done
# Trim trailing separators/blank lines
awk '{
lines[NR]=$0
} END {
i=NR
while (i>0 && (lines[i] ~ /^---[[:space:]]*$/ || lines[i] ~ /^[[:space:]]*$/)) { i-- }
for (j=1; j<=i; j++) print lines[j]
}' "$tmp_all" > "${out_all}"
rm -f "$tmp_all"
echo "Wrote Gateway (${CONFORMANCE_CHANNEL}) all-in-one CRDs to $out_all"
fi
# Final sanity: if ${out_all} exists but is empty, fail loudly
if [ -e "${out_all}" ] && [ ! -s "${out_all}" ]; then
echo "ERROR: ${out_all} is empty after CRD refresh. Please check the logs above."
exit 1
fi
fi
echo "$kind bumped to ${resolved_version} (ref: ${ref}) successfully!"

View File

@ -153,7 +153,7 @@ func generateCRDs(paths []string, outputDir string, maxDescLen int, crdVersion s
kubeKinds := crd.FindKubeKinds(parser, metav1Pkg)
if len(kubeKinds) == 0 {
return nil
return fmt.Errorf("found zero Kubernetes kinds for paths: %s", strings.Join(paths, ", "))
}
for _, groupKind := range kubeKinds {

View File

@ -3,7 +3,7 @@ package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
embedded "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
"github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
)
// +kubebuilder:object:root=true

View File

@ -1,10 +1,10 @@
Name|Version|License
---|---|---
[semver/v3](https://github.com/Masterminds/semver)|v3.4.0|MIT License
[anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go)|v1.26.0|MIT License
[anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go)|v1.27.1|MIT License
[retry-go/v4](https://github.com/avast/retry-go)|v4.7.0|MIT License
[xds/go](https://github.com/cncf/xds)|v0.0.0-20260202195803-dba9d589def2|Apache License 2.0
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260308004542-b60714bc2ea3|Apache License 2.0
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260402053555-4e9843ddb8d0|Apache License 2.0
[ghodss/yaml](https://github.com/ghodss/yaml)|v1.0.1-0.20190212211648-25d852aebe32|MIT License
[go-jose/v4](https://github.com/go-jose/go-jose)|v4.1.3|Apache License 2.0
[go-logr/logr](https://github.com/go-logr/logr)|v1.4.3|Apache License 2.0
@ -15,10 +15,10 @@ Name|Version|License
[grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)|v1.4.0|Apache License 2.0
[kagent-dev/mockllm](https://github.com/kagent-dev/mockllm)|v0.0.5|Apache License 2.0
[kelseyhightower/envconfig](https://github.com/kelseyhightower/envconfig)|v1.4.0|MIT License
[modelcontextprotocol/go-sdk](https://github.com/modelcontextprotocol/go-sdk)|v1.4.0|Apache License 2.0
[modelcontextprotocol/go-sdk](https://github.com/modelcontextprotocol/go-sdk)|v1.4.1|Apache License 2.0
[ginkgo/v2](https://github.com/onsi/ginkgo)|v2.28.1|MIT License
[onsi/gomega](https://github.com/onsi/gomega)|v1.39.1|MIT License
[openai-go/v3](https://github.com/openai/openai-go)|v3.24.0|Apache License 2.0
[openai-go/v3](https://github.com/openai/openai-go)|v3.29.0|Apache License 2.0
[prometheus/client_golang](https://github.com/prometheus/client_golang)|v1.23.2|Apache License 2.0
[prometheus/client_model](https://github.com/prometheus/client_model)|v0.6.2|Apache License 2.0
[prometheus/common](https://github.com/prometheus/common)|v0.67.5|Apache License 2.0
@ -27,29 +27,29 @@ Name|Version|License
[go.opencensus.io](https://go.opencensus.io)|v0.24.0|Apache License 2.0
[go.uber.org/atomic](https://go.uber.org/atomic)|v1.11.0|MIT License
[go.uber.org/zap](https://go.uber.org/zap)|v1.27.1|MIT License
[x/net](https://golang.org/x/net)|v0.51.0|BSD 3-clause "New" or "Revised" License
[x/sync](https://golang.org/x/sync)|v0.19.0|BSD 3-clause "New" or "Revised" License
[x/time](https://golang.org/x/time)|v0.14.0|BSD 3-clause "New" or "Revised" License
[x/tools](https://golang.org/x/tools)|v0.42.0|BSD 3-clause "New" or "Revised" License
[googleapis/rpc](https://google.golang.org/genproto/googleapis/rpc)|v0.0.0-20260226221140-a57be14db171|Apache License 2.0
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.79.1|Apache License 2.0
[x/net](https://golang.org/x/net)|v0.52.0|BSD 3-clause "New" or "Revised" License
[x/sync](https://golang.org/x/sync)|v0.20.0|BSD 3-clause "New" or "Revised" License
[x/time](https://golang.org/x/time)|v0.15.0|BSD 3-clause "New" or "Revised" License
[x/tools](https://golang.org/x/tools)|v0.43.0|BSD 3-clause "New" or "Revised" License
[googleapis/rpc](https://google.golang.org/genproto/googleapis/rpc)|v0.0.0-20260319201613-d00831a3d3e7|Apache License 2.0
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.79.3|Apache License 2.0
[google.golang.org/protobuf](https://google.golang.org/protobuf)|v1.36.11|BSD 3-clause "New" or "Revised" License
[helm/v3](https://helm.sh/helm/v3)|v3.20.0|Apache License 2.0
[istio.io/api](https://istio.io/api)|v1.29.0-alpha.0.0.20260310163805-1e4fee88597d|Apache License 2.0
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260310170739-44d7c6ab3a5b|Apache License 2.0
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260311173339-67ad6fb5ba6a|Apache License 2.0
[k8s.io/api](https://k8s.io/api)|v0.35.2|Apache License 2.0
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.2|Apache License 2.0
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.2|Apache License 2.0
[k8s.io/client-go](https://k8s.io/client-go)|v0.35.2|Apache License 2.0
[klog/v2](https://k8s.io/klog/v2)|v2.130.1|Apache License 2.0
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20260210185600-b8788abfbbc2|Apache License 2.0
[sigs.k8s.io/controller-runtime](https://sigs.k8s.io/controller-runtime)|v0.23.1|Apache License 2.0
[helm/v3](https://helm.sh/helm/v3)|v3.20.1|Apache License 2.0
[istio.io/api](https://istio.io/api)|v1.29.0-alpha.0.0.20260315093121-ce7e56c13e1d|Apache License 2.0
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260315093321-a99807642da7|Apache License 2.0
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260407051556-b9f70d130eb6|Apache License 2.0
[k8s.io/api](https://k8s.io/api)|v0.35.3|Apache License 2.0
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.3|Apache License 2.0
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.3|Apache License 2.0
[k8s.io/client-go](https://k8s.io/client-go)|v0.35.3|Apache License 2.0
[klog/v2](https://k8s.io/klog/v2)|v2.140.0|Apache License 2.0
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20260319190234-28399d86e0b5|Apache License 2.0
[sigs.k8s.io/controller-runtime](https://sigs.k8s.io/controller-runtime)|v0.23.3|Apache License 2.0
[sigs.k8s.io/controller-tools](https://sigs.k8s.io/controller-tools)|v0.20.1|Apache License 2.0
[sigs.k8s.io/gateway-api](https://sigs.k8s.io/gateway-api)|v1.5.0|Apache License 2.0
[sigs.k8s.io/gateway-api-inference-extension](https://sigs.k8s.io/gateway-api-inference-extension)|v1.4.0-rc.2|Apache License 2.0
[gateway-api-inference-extension/conformance](https://sigs.k8s.io/gateway-api-inference-extension/conformance)|v0.0.0-20260310170806-b32dfd041324|Apache License 2.0
[gateway-api/conformance](https://sigs.k8s.io/gateway-api/conformance)|v1.5.1-0.20260302214453-c33c5449a202|Apache License 2.0
[sigs.k8s.io/gateway-api](https://sigs.k8s.io/gateway-api)|v1.5.1|Apache License 2.0
[sigs.k8s.io/gateway-api-inference-extension](https://sigs.k8s.io/gateway-api-inference-extension)|v1.4.0|Apache License 2.0
[gateway-api-inference-extension/conformance](https://sigs.k8s.io/gateway-api-inference-extension/conformance)|v0.0.0-20260319184001-6e787dd396f0|Apache License 2.0
[gateway-api/conformance](https://sigs.k8s.io/gateway-api/conformance)|v1.5.1|Apache License 2.0
[sigs.k8s.io/yaml](https://sigs.k8s.io/yaml)|v1.6.0|MIT License
[cmd/goimports](https://golang.org/x/tools/cmd/goimports)|latest|MIT License
[gogo/protobuf](https://github.com/gogo/protobuf)|latest|MIT License

View File

@ -56,15 +56,16 @@ spec:
description: spec defines the desired state of AgentgatewayParameters.
properties:
deployment:
description: deployment allows specifying overrides for the generated
Deployment resource.
description: |-
`deployment` allows specifying overrides for the generated
`Deployment` resource.
properties:
metadata:
description: |-
metadata defines a subset of object metadata to be customized.
Labels and annotations are merged with existing values. If both GatewayClass
and Gateway parameters define the same label or annotation key, the Gateway
value takes precedence (applied second).
`metadata` defines a subset of object metadata to be customized.
`labels` and `annotations` are merged with existing values. If both
`GatewayClass` and `Gateway` parameters define the same label or
annotation key, the `Gateway` value takes precedence (applied second).
properties:
annotations:
additionalProperties:
@ -86,55 +87,56 @@ spec:
type: object
type: object
spec:
description: "Spec provides an opaque mechanism to configure the
resource Spec.\nThis field accepts a complete or partial Kubernetes
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
with the generated configuration using **Strategic Merge Patch**
semantics.\n\n# Application Order\n\nOverlays are applied after
all typed configuration fields from both levels.\nThe full merge
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
Gateway typed configuration fields\n 3. GatewayClass overlays\n
4. Gateway overlays (can override all previous values)\n\n#
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
allows you to override individual fields, merge lists, or delete
items\nwithout needing to provide the entire resource definition.\n\n**1.
Replacing Values (Scalars):**\nSimple fields (strings, integers,
booleans) in your config will overwrite the generated defaults.\n\n**2.
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
`containers` which merges on `name`, or `tolerations` which
merges on `key`)\nwill append your items to the generated list,
or update existing items if keys match.\n\n**3. Deleting Fields
or List Items ($patch: delete):**\nTo remove a field or list
item from the generated resource, use the\n`$patch: delete`
directive. This works for both map fields and list items,\nand
description: "`spec` provides an opaque mechanism to configure
the resource spec.\nThis field accepts a complete or partial
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
and will be merged with the generated\nconfiguration using **Strategic
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
are applied after all typed configuration fields from both levels.\nThe
full merge order is:\n\n 1. `GatewayClass` typed configuration
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
overlays\n 4. `Gateway` overlays (can override all previous
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
merge strategy allows you to override individual fields, merge
lists, or delete items\nwithout needing to provide the entire
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
fields (strings, integers, booleans) in your config will overwrite
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
with \"merge keys\", like `containers` which merges on `name`,
or\n`tolerations` which merges on `key`,\nwill append your items
to the generated list, or update existing items if keys match.\n\n**3.
Deleting Fields or List Items ($patch: delete):**\nTo remove
a field or list item from the generated resource, use the\n`$patch:
delete` directive. This works for both map fields and list items,\nand
is the recommended approach because it works with both client-side\nand
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ # Delete pod-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
\ $patch: delete\n\t containers:\n\t # Be
sure to use the correct proxy name here or you will add a container
instead of modifying a container:\n\t - name: proxy-name\n\t
\ # Delete container-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\n**4. Null Values (server-side
apply only):**\nSetting a field to `null` can also remove it,
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
With regular client-side\n`kubectl apply`, null values are stripped
by kubectl before reaching\nthe API server, so the deletion
won't occur. Prefer `$patch: delete`\nfor consistent behavior
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ nodeSelector: null # Removes nodeSelector (server-side
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
replace an entire map with your values (instead of merging),
use `$patch: replace`.\nThis removes all existing keys and replaces
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
($patch: replace):**\nIf you want to strictly define a list
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
name: http\n\t port: 80\n\t targetPort: 8080\n\t
\ protocol: TCP\n\t - name: https\n\t port:
443\n\t targetPort: 8443\n\t protocol: TCP"
\ $patch: delete\n\t containers:\n\t # Be sure
to use the correct proxy name here or you will add a\n\t #
container instead of modifying a container.\n\t - name:
proxy-name\n\t # Delete container-level securityContext\n\t
\ securityContext:\n\t $patch: delete\n\n**4.
Null Values (server-side apply only):**\nSetting a field to
`null` can also remove it, but this ONLY works with\n`kubectl
apply --server-side` or equivalent. With regular client-side\n`kubectl
apply`, null values are stripped by kubectl before reaching\nthe
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
consistent behavior across both apply modes.\n\n\tspec:\n\t
\ template:\n\t spec:\n\t nodeSelector: null # Removes
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
Entirely ($patch: replace):**\nTo replace an entire map with
your values (instead of merging), use `$patch: replace`.\nThis
removes all existing keys and replaces them with only your specified
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
Replacing Lists Entirely ($patch: replace):**\nIf you want to
strictly define a list and ignore all generated defaults, use
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
TCP"
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
@ -142,16 +144,16 @@ spec:
description: |-
The container environment variables. These override any existing
values. If you want to delete an environment variable entirely, use
`$patch: delete` with AgentgatewayParametersOverlays instead. Note that
`$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
[variable
expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
does apply, but is highly discouraged -- to set dependent environment
variables, you can use $(VAR_NAME), but it's highly
discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
`$$(VAR_NAME)` avoids expansion and results in a literal
`$(VAR_NAME)`.
If `SESSION_KEY` is specified, it takes precedence over the
controller-managed per-Gateway session key Secret.
controller-managed per-`Gateway` session key `Secret`.
items:
description: EnvVar represents an environment variable present in
a Container.
@ -309,17 +311,18 @@ spec:
type: array
horizontalPodAutoscaler:
description: |-
horizontalPodAutoscaler allows creating a HorizontalPodAutoscaler for the agentgateway proxy.
If absent, no HPA is created. If present, an HPA is created with its scaleTargetRef
automatically configured to target the agentgateway proxy Deployment.
The metadata and spec fields from this overlay are applied to the generated HPA.
`horizontalPodAutoscaler` allows creating a `HorizontalPodAutoscaler`
for the agentgateway proxy. If absent, no HPA is created. If present, an
HPA is created with its `scaleTargetRef` automatically configured to
target the agentgateway proxy `Deployment`. The `metadata` and `spec`
fields from this overlay are applied to the generated HPA.
properties:
metadata:
description: |-
metadata defines a subset of object metadata to be customized.
Labels and annotations are merged with existing values. If both GatewayClass
and Gateway parameters define the same label or annotation key, the Gateway
value takes precedence (applied second).
`metadata` defines a subset of object metadata to be customized.
`labels` and `annotations` are merged with existing values. If both
`GatewayClass` and `Gateway` parameters define the same label or
annotation key, the `Gateway` value takes precedence (applied second).
properties:
annotations:
additionalProperties:
@ -341,55 +344,56 @@ spec:
type: object
type: object
spec:
description: "Spec provides an opaque mechanism to configure the
resource Spec.\nThis field accepts a complete or partial Kubernetes
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
with the generated configuration using **Strategic Merge Patch**
semantics.\n\n# Application Order\n\nOverlays are applied after
all typed configuration fields from both levels.\nThe full merge
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
Gateway typed configuration fields\n 3. GatewayClass overlays\n
4. Gateway overlays (can override all previous values)\n\n#
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
allows you to override individual fields, merge lists, or delete
items\nwithout needing to provide the entire resource definition.\n\n**1.
Replacing Values (Scalars):**\nSimple fields (strings, integers,
booleans) in your config will overwrite the generated defaults.\n\n**2.
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
`containers` which merges on `name`, or `tolerations` which
merges on `key`)\nwill append your items to the generated list,
or update existing items if keys match.\n\n**3. Deleting Fields
or List Items ($patch: delete):**\nTo remove a field or list
item from the generated resource, use the\n`$patch: delete`
directive. This works for both map fields and list items,\nand
description: "`spec` provides an opaque mechanism to configure
the resource spec.\nThis field accepts a complete or partial
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
and will be merged with the generated\nconfiguration using **Strategic
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
are applied after all typed configuration fields from both levels.\nThe
full merge order is:\n\n 1. `GatewayClass` typed configuration
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
overlays\n 4. `Gateway` overlays (can override all previous
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
merge strategy allows you to override individual fields, merge
lists, or delete items\nwithout needing to provide the entire
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
fields (strings, integers, booleans) in your config will overwrite
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
with \"merge keys\", like `containers` which merges on `name`,
or\n`tolerations` which merges on `key`,\nwill append your items
to the generated list, or update existing items if keys match.\n\n**3.
Deleting Fields or List Items ($patch: delete):**\nTo remove
a field or list item from the generated resource, use the\n`$patch:
delete` directive. This works for both map fields and list items,\nand
is the recommended approach because it works with both client-side\nand
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ # Delete pod-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
\ $patch: delete\n\t containers:\n\t # Be
sure to use the correct proxy name here or you will add a container
instead of modifying a container:\n\t - name: proxy-name\n\t
\ # Delete container-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\n**4. Null Values (server-side
apply only):**\nSetting a field to `null` can also remove it,
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
With regular client-side\n`kubectl apply`, null values are stripped
by kubectl before reaching\nthe API server, so the deletion
won't occur. Prefer `$patch: delete`\nfor consistent behavior
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ nodeSelector: null # Removes nodeSelector (server-side
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
replace an entire map with your values (instead of merging),
use `$patch: replace`.\nThis removes all existing keys and replaces
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
($patch: replace):**\nIf you want to strictly define a list
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
name: http\n\t port: 80\n\t targetPort: 8080\n\t
\ protocol: TCP\n\t - name: https\n\t port:
443\n\t targetPort: 8443\n\t protocol: TCP"
\ $patch: delete\n\t containers:\n\t # Be sure
to use the correct proxy name here or you will add a\n\t #
container instead of modifying a container.\n\t - name:
proxy-name\n\t # Delete container-level securityContext\n\t
\ securityContext:\n\t $patch: delete\n\n**4.
Null Values (server-side apply only):**\nSetting a field to
`null` can also remove it, but this ONLY works with\n`kubectl
apply --server-side` or equivalent. With regular client-side\n`kubectl
apply`, null values are stripped by kubectl before reaching\nthe
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
consistent behavior across both apply modes.\n\n\tspec:\n\t
\ template:\n\t spec:\n\t nodeSelector: null # Removes
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
Entirely ($patch: replace):**\nTo replace an entire map with
your values (instead of merging), use `$patch: replace`.\nThis
removes all existing keys and replaces them with only your specified
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
Replacing Lists Entirely ($patch: replace):**\nIf you want to
strictly define a list and ignore all generated defaults, use
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
TCP"
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
@ -432,8 +436,9 @@ spec:
type: string
type: object
logging:
description: logging configuration for Agentgateway. By default, all
logs are set to "info" level.
description: |-
`logging` configuration for Agentgateway. By default, all logs are set to
`info` level.
properties:
format:
description: The default logging format is text.
@ -443,24 +448,25 @@ spec:
type: string
level:
description: |-
Logging level in standard RUST_LOG syntax, e.g. 'info', the default, or
by module, comma-separated. E.g.,
"rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn"
Logging level in standard `RUST_LOG` syntax, for example `info` (the
default), or a comma-separated per-module setting such as
`rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn`.
type: string
type: object
podDisruptionBudget:
description: |-
podDisruptionBudget allows creating a PodDisruptionBudget for the agentgateway proxy.
If absent, no PDB is created. If present, a PDB is created with its selector
automatically configured to target the agentgateway proxy Deployment.
The metadata and spec fields from this overlay are applied to the generated PDB.
`podDisruptionBudget` allows creating a `PodDisruptionBudget` for the
agentgateway proxy. If absent, no PDB is created. If present, a PDB is
created with its selector automatically configured to target the
agentgateway proxy `Deployment`. The `metadata` and `spec` fields from
this overlay are applied to the generated PDB.
properties:
metadata:
description: |-
metadata defines a subset of object metadata to be customized.
Labels and annotations are merged with existing values. If both GatewayClass
and Gateway parameters define the same label or annotation key, the Gateway
value takes precedence (applied second).
`metadata` defines a subset of object metadata to be customized.
`labels` and `annotations` are merged with existing values. If both
`GatewayClass` and `Gateway` parameters define the same label or
annotation key, the `Gateway` value takes precedence (applied second).
properties:
annotations:
additionalProperties:
@ -482,71 +488,73 @@ spec:
type: object
type: object
spec:
description: "Spec provides an opaque mechanism to configure the
resource Spec.\nThis field accepts a complete or partial Kubernetes
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
with the generated configuration using **Strategic Merge Patch**
semantics.\n\n# Application Order\n\nOverlays are applied after
all typed configuration fields from both levels.\nThe full merge
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
Gateway typed configuration fields\n 3. GatewayClass overlays\n
4. Gateway overlays (can override all previous values)\n\n#
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
allows you to override individual fields, merge lists, or delete
items\nwithout needing to provide the entire resource definition.\n\n**1.
Replacing Values (Scalars):**\nSimple fields (strings, integers,
booleans) in your config will overwrite the generated defaults.\n\n**2.
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
`containers` which merges on `name`, or `tolerations` which
merges on `key`)\nwill append your items to the generated list,
or update existing items if keys match.\n\n**3. Deleting Fields
or List Items ($patch: delete):**\nTo remove a field or list
item from the generated resource, use the\n`$patch: delete`
directive. This works for both map fields and list items,\nand
description: "`spec` provides an opaque mechanism to configure
the resource spec.\nThis field accepts a complete or partial
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
and will be merged with the generated\nconfiguration using **Strategic
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
are applied after all typed configuration fields from both levels.\nThe
full merge order is:\n\n 1. `GatewayClass` typed configuration
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
overlays\n 4. `Gateway` overlays (can override all previous
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
merge strategy allows you to override individual fields, merge
lists, or delete items\nwithout needing to provide the entire
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
fields (strings, integers, booleans) in your config will overwrite
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
with \"merge keys\", like `containers` which merges on `name`,
or\n`tolerations` which merges on `key`,\nwill append your items
to the generated list, or update existing items if keys match.\n\n**3.
Deleting Fields or List Items ($patch: delete):**\nTo remove
a field or list item from the generated resource, use the\n`$patch:
delete` directive. This works for both map fields and list items,\nand
is the recommended approach because it works with both client-side\nand
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ # Delete pod-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
\ $patch: delete\n\t containers:\n\t # Be
sure to use the correct proxy name here or you will add a container
instead of modifying a container:\n\t - name: proxy-name\n\t
\ # Delete container-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\n**4. Null Values (server-side
apply only):**\nSetting a field to `null` can also remove it,
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
With regular client-side\n`kubectl apply`, null values are stripped
by kubectl before reaching\nthe API server, so the deletion
won't occur. Prefer `$patch: delete`\nfor consistent behavior
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ nodeSelector: null # Removes nodeSelector (server-side
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
replace an entire map with your values (instead of merging),
use `$patch: replace`.\nThis removes all existing keys and replaces
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
($patch: replace):**\nIf you want to strictly define a list
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
name: http\n\t port: 80\n\t targetPort: 8080\n\t
\ protocol: TCP\n\t - name: https\n\t port:
443\n\t targetPort: 8443\n\t protocol: TCP"
\ $patch: delete\n\t containers:\n\t # Be sure
to use the correct proxy name here or you will add a\n\t #
container instead of modifying a container.\n\t - name:
proxy-name\n\t # Delete container-level securityContext\n\t
\ securityContext:\n\t $patch: delete\n\n**4.
Null Values (server-side apply only):**\nSetting a field to
`null` can also remove it, but this ONLY works with\n`kubectl
apply --server-side` or equivalent. With regular client-side\n`kubectl
apply`, null values are stripped by kubectl before reaching\nthe
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
consistent behavior across both apply modes.\n\n\tspec:\n\t
\ template:\n\t spec:\n\t nodeSelector: null # Removes
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
Entirely ($patch: replace):**\nTo replace an entire map with
your values (instead of merging), use `$patch: replace`.\nThis
removes all existing keys and replaces them with only your specified
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
Replacing Lists Entirely ($patch: replace):**\nIf you want to
strictly define a list and ignore all generated defaults, use
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
TCP"
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
rawConfig:
description: "rawConfig provides an opaque mechanism to configure
the agentgateway\nconfig file (the agentgateway binary has a '-f'
option to specify a\nconfig file, and this is that file). This
will be merged with\nconfiguration derived from typed fields like\nAgentgatewayParametersLogging.Format,
and those typed fields will take\nprecedence.\n\nExample:\n\n\trawConfig:\n\t
\ binds:\n\t - port: 3000\n\t listeners:\n\t - routes:\n\t
\ - policies:\n\t cors:\n\t allowOrigins:\n\t
\ - \"*\"\n\t allowHeaders:\n\t -
mcp-protocol-version\n\t - content-type\n\t -
cache-control\n\t backends:\n\t - mcp:\n\t targets:\n\t
\ - name: everything\n\t stdio:\n\t cmd:
npx\n\t args: [\"@modelcontextprotocol/server-everything\"]"
description: "`rawConfig` provides an opaque mechanism to configure
the `agentgateway`\nconfig file. The `agentgateway` binary has a
`-f` option to specify a\nconfig file, and this field supplies that
file. This will be merged with\nconfiguration derived from typed
fields like `logging.format`, and those\ntyped fields will take
precedence.\n\nExample:\n\n\trawConfig:\n\t binds:\n\t - port:
3000\n\t listeners:\n\t - routes:\n\t - policies:\n\t
\ cors:\n\t allowOrigins:\n\t - \"*\"\n\t
\ allowHeaders:\n\t - mcp-protocol-version\n\t
\ - content-type\n\t - cache-control\n\t backends:\n\t
\ - mcp:\n\t targets:\n\t - name: everything\n\t
\ stdio:\n\t cmd: npx\n\t args:
[\"@modelcontextprotocol/server-everything\"]"
type: object
x-kubernetes-preserve-unknown-fields: true
resources:
@ -612,15 +620,16 @@ spec:
type: object
type: object
service:
description: service allows specifying overrides for the generated
Service resource.
description: |-
`service` allows specifying overrides for the generated `Service`
resource.
properties:
metadata:
description: |-
metadata defines a subset of object metadata to be customized.
Labels and annotations are merged with existing values. If both GatewayClass
and Gateway parameters define the same label or annotation key, the Gateway
value takes precedence (applied second).
`metadata` defines a subset of object metadata to be customized.
`labels` and `annotations` are merged with existing values. If both
`GatewayClass` and `Gateway` parameters define the same label or
annotation key, the `Gateway` value takes precedence (applied second).
properties:
annotations:
additionalProperties:
@ -642,68 +651,70 @@ spec:
type: object
type: object
spec:
description: "Spec provides an opaque mechanism to configure the
resource Spec.\nThis field accepts a complete or partial Kubernetes
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
with the generated configuration using **Strategic Merge Patch**
semantics.\n\n# Application Order\n\nOverlays are applied after
all typed configuration fields from both levels.\nThe full merge
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
Gateway typed configuration fields\n 3. GatewayClass overlays\n
4. Gateway overlays (can override all previous values)\n\n#
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
allows you to override individual fields, merge lists, or delete
items\nwithout needing to provide the entire resource definition.\n\n**1.
Replacing Values (Scalars):**\nSimple fields (strings, integers,
booleans) in your config will overwrite the generated defaults.\n\n**2.
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
`containers` which merges on `name`, or `tolerations` which
merges on `key`)\nwill append your items to the generated list,
or update existing items if keys match.\n\n**3. Deleting Fields
or List Items ($patch: delete):**\nTo remove a field or list
item from the generated resource, use the\n`$patch: delete`
directive. This works for both map fields and list items,\nand
description: "`spec` provides an opaque mechanism to configure
the resource spec.\nThis field accepts a complete or partial
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
and will be merged with the generated\nconfiguration using **Strategic
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
are applied after all typed configuration fields from both levels.\nThe
full merge order is:\n\n 1. `GatewayClass` typed configuration
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
overlays\n 4. `Gateway` overlays (can override all previous
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
merge strategy allows you to override individual fields, merge
lists, or delete items\nwithout needing to provide the entire
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
fields (strings, integers, booleans) in your config will overwrite
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
with \"merge keys\", like `containers` which merges on `name`,
or\n`tolerations` which merges on `key`,\nwill append your items
to the generated list, or update existing items if keys match.\n\n**3.
Deleting Fields or List Items ($patch: delete):**\nTo remove
a field or list item from the generated resource, use the\n`$patch:
delete` directive. This works for both map fields and list items,\nand
is the recommended approach because it works with both client-side\nand
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ # Delete pod-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
\ $patch: delete\n\t containers:\n\t # Be
sure to use the correct proxy name here or you will add a container
instead of modifying a container:\n\t - name: proxy-name\n\t
\ # Delete container-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\n**4. Null Values (server-side
apply only):**\nSetting a field to `null` can also remove it,
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
With regular client-side\n`kubectl apply`, null values are stripped
by kubectl before reaching\nthe API server, so the deletion
won't occur. Prefer `$patch: delete`\nfor consistent behavior
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ nodeSelector: null # Removes nodeSelector (server-side
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
replace an entire map with your values (instead of merging),
use `$patch: replace`.\nThis removes all existing keys and replaces
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
($patch: replace):**\nIf you want to strictly define a list
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
name: http\n\t port: 80\n\t targetPort: 8080\n\t
\ protocol: TCP\n\t - name: https\n\t port:
443\n\t targetPort: 8443\n\t protocol: TCP"
\ $patch: delete\n\t containers:\n\t # Be sure
to use the correct proxy name here or you will add a\n\t #
container instead of modifying a container.\n\t - name:
proxy-name\n\t # Delete container-level securityContext\n\t
\ securityContext:\n\t $patch: delete\n\n**4.
Null Values (server-side apply only):**\nSetting a field to
`null` can also remove it, but this ONLY works with\n`kubectl
apply --server-side` or equivalent. With regular client-side\n`kubectl
apply`, null values are stripped by kubectl before reaching\nthe
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
consistent behavior across both apply modes.\n\n\tspec:\n\t
\ template:\n\t spec:\n\t nodeSelector: null # Removes
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
Entirely ($patch: replace):**\nTo replace an entire map with
your values (instead of merging), use `$patch: replace`.\nThis
removes all existing keys and replaces them with only your specified
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
Replacing Lists Entirely ($patch: replace):**\nIf you want to
strictly define a list and ignore all generated defaults, use
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
TCP"
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
serviceAccount:
description: serviceAccount allows specifying overrides for the generated
ServiceAccount resource.
description: |-
`serviceAccount` allows specifying overrides for the generated
`ServiceAccount` resource.
properties:
metadata:
description: |-
metadata defines a subset of object metadata to be customized.
Labels and annotations are merged with existing values. If both GatewayClass
and Gateway parameters define the same label or annotation key, the Gateway
value takes precedence (applied second).
`metadata` defines a subset of object metadata to be customized.
`labels` and `annotations` are merged with existing values. If both
`GatewayClass` and `Gateway` parameters define the same label or
annotation key, the `Gateway` value takes precedence (applied second).
properties:
annotations:
additionalProperties:
@ -725,70 +736,72 @@ spec:
type: object
type: object
spec:
description: "Spec provides an opaque mechanism to configure the
resource Spec.\nThis field accepts a complete or partial Kubernetes
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
with the generated configuration using **Strategic Merge Patch**
semantics.\n\n# Application Order\n\nOverlays are applied after
all typed configuration fields from both levels.\nThe full merge
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
Gateway typed configuration fields\n 3. GatewayClass overlays\n
4. Gateway overlays (can override all previous values)\n\n#
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
allows you to override individual fields, merge lists, or delete
items\nwithout needing to provide the entire resource definition.\n\n**1.
Replacing Values (Scalars):**\nSimple fields (strings, integers,
booleans) in your config will overwrite the generated defaults.\n\n**2.
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
`containers` which merges on `name`, or `tolerations` which
merges on `key`)\nwill append your items to the generated list,
or update existing items if keys match.\n\n**3. Deleting Fields
or List Items ($patch: delete):**\nTo remove a field or list
item from the generated resource, use the\n`$patch: delete`
directive. This works for both map fields and list items,\nand
description: "`spec` provides an opaque mechanism to configure
the resource spec.\nThis field accepts a complete or partial
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
and will be merged with the generated\nconfiguration using **Strategic
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
are applied after all typed configuration fields from both levels.\nThe
full merge order is:\n\n 1. `GatewayClass` typed configuration
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
overlays\n 4. `Gateway` overlays (can override all previous
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
merge strategy allows you to override individual fields, merge
lists, or delete items\nwithout needing to provide the entire
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
fields (strings, integers, booleans) in your config will overwrite
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
with \"merge keys\", like `containers` which merges on `name`,
or\n`tolerations` which merges on `key`,\nwill append your items
to the generated list, or update existing items if keys match.\n\n**3.
Deleting Fields or List Items ($patch: delete):**\nTo remove
a field or list item from the generated resource, use the\n`$patch:
delete` directive. This works for both map fields and list items,\nand
is the recommended approach because it works with both client-side\nand
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ # Delete pod-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
\ $patch: delete\n\t containers:\n\t # Be
sure to use the correct proxy name here or you will add a container
instead of modifying a container:\n\t - name: proxy-name\n\t
\ # Delete container-level securityContext\n\t securityContext:\n\t
\ $patch: delete\n\n**4. Null Values (server-side
apply only):**\nSetting a field to `null` can also remove it,
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
With regular client-side\n`kubectl apply`, null values are stripped
by kubectl before reaching\nthe API server, so the deletion
won't occur. Prefer `$patch: delete`\nfor consistent behavior
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
\ nodeSelector: null # Removes nodeSelector (server-side
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
replace an entire map with your values (instead of merging),
use `$patch: replace`.\nThis removes all existing keys and replaces
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
($patch: replace):**\nIf you want to strictly define a list
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
name: http\n\t port: 80\n\t targetPort: 8080\n\t
\ protocol: TCP\n\t - name: https\n\t port:
443\n\t targetPort: 8443\n\t protocol: TCP"
\ $patch: delete\n\t containers:\n\t # Be sure
to use the correct proxy name here or you will add a\n\t #
container instead of modifying a container.\n\t - name:
proxy-name\n\t # Delete container-level securityContext\n\t
\ securityContext:\n\t $patch: delete\n\n**4.
Null Values (server-side apply only):**\nSetting a field to
`null` can also remove it, but this ONLY works with\n`kubectl
apply --server-side` or equivalent. With regular client-side\n`kubectl
apply`, null values are stripped by kubectl before reaching\nthe
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
consistent behavior across both apply modes.\n\n\tspec:\n\t
\ template:\n\t spec:\n\t nodeSelector: null # Removes
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
Entirely ($patch: replace):**\nTo replace an entire map with
your values (instead of merging), use `$patch: replace`.\nThis
removes all existing keys and replaces them with only your specified
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
Replacing Lists Entirely ($patch: replace):**\nIf you want to
strictly define a list and ignore all generated defaults, use
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
TCP"
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
shutdown:
description: |-
Shutdown delay configuration. How graceful planned or unplanned data
Shutdown delay configuration. How graceful planned or unplanned data
plane changes happen is in tension with how quickly rollouts of the data
plane complete. How long a data plane pod must wait for shutdown to be
perfectly graceful depends on how you have configured your Gateways.
perfectly graceful depends on how you have configured your `Gateway`
resources.
properties:
max:
description: |-
Maximum time (in seconds) to wait before allowing Agentgateway to
terminate. Refer to the TERMINATION_GRACE_PERIOD_SECONDS environment
variable for details.
terminate. Refer to the `TERMINATION_GRACE_PERIOD_SECONDS`
environment variable for details.
format: int64
maximum: 31536000
minimum: 0
@ -796,8 +809,8 @@ spec:
min:
description: |-
Minimum time (in seconds) to wait before allowing Agentgateway to
terminate. Refer to the CONNECTION_MIN_TERMINATION_DEADLINE environment
variable for details.
terminate. Refer to the `CONNECTION_MIN_TERMINATION_DEADLINE`
environment variable for details.
format: int64
maximum: 31536000
minimum: 0

View File

@ -44,6 +44,14 @@ spec:
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- else }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
{{- end }}
image: "{{ .Values.controller.image.registry | default .Values.image.registry }}/{{ .Values.controller.image.repository }}:{{ include "agentgateway.imageTag" (.Values.controller.image.tag | default .Values.image.tag | default .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.controller.image.pullPolicy | default .Values.image.pullPolicy }}
@ -104,9 +112,30 @@ spec:
- name: AGW_DISCOVERY_NAMESPACE_SELECTORS
value: {{ .Values.discoveryNamespaceSelectors | toJson | quote }}
{{- if .Values.controller.extraEnv }}
{{- range $key, $value := .Values.controller.extraEnv }}
{{- $extraEnv := .Values.controller.extraEnv }}
{{- range $key := keys $extraEnv | sortAlpha }}
{{- $value := index $extraEnv $key }}
- name: {{ $key }}
{{- if kindIs "map" $value }}
{{- $hasValue := hasKey $value "value" }}
{{- $hasValueFrom := hasKey $value "valueFrom" }}
{{- if and $hasValue $hasValueFrom }}
{{- fail (printf "controller.extraEnv.%s cannot set both value and valueFrom" $key) }}
{{- else if $hasValue }}
value: {{ get $value "value" | quote }}
{{- else if $hasValueFrom }}
{{- $valueFrom := get $value "valueFrom" }}
{{- if not $valueFrom }}
{{- fail (printf "controller.extraEnv.%s.valueFrom must be non-empty" $key) }}
{{- end }}
valueFrom:
{{- toYaml $valueFrom | nindent 16 }}
{{- else }}
{{- fail (printf "controller.extraEnv.%s must set either value or valueFrom" $key) }}
{{- end }}
{{- else }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.inferenceExtension.enabled }}

View File

@ -112,6 +112,16 @@ controller:
# -- Traffic distribution.
trafficDistribution: ""
# -- Add extra environment variables to the controller container.
# Supports either a direct scalar value:
# extraEnv:
# LOG_FORMAT: json
# Or Kubernetes valueFrom sources:
# extraEnv:
# API_TOKEN:
# valueFrom:
# secretKeyRef:
# name: agentgateway-secrets
# key: apiToken
extraEnv: {}
# -- Configure TLS settings for the xDS gRPC servers.
xds:

View File

@ -9,7 +9,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/admin"
"github.com/agentgateway/agentgateway/controller/pkg/admin"
)
func TestSnapshotResponseDataMarshalJSONString(t *testing.T) {

View File

@ -12,18 +12,16 @@ import (
"istio.io/istio/pkg/kube/krt"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/controller"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/controller"
"github.com/agentgateway/agentgateway/controller/pkg/version"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) error {
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) {
// serverHandlers defines the custom handlers that the Admin Server will support
serverHandlers := getServerHandlers(ctx, setupOpts.KrtDebugger)
startHandlers(ctx, serverHandlers)
return nil
}
// use a function for the profile descriptions so that every time the admin page is displayed, it can show
@ -81,7 +79,7 @@ func startHandlers(ctx context.Context, addHandlers ...func(mux *http.ServeMux,
mux.HandleFunc("/", idx)
mux.HandleFunc("/snapshots/", idx)
server := &http.Server{
Addr: fmt.Sprintf("localhost:%d", wellknown.KgatewayAdminPort),
Addr: fmt.Sprintf("localhost:%d", wellknown.AdminPort),
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
}

View File

@ -41,6 +41,7 @@ func NewConfigMapSyncer(client apiclient.Client, storePrefix, deploymentNamespac
cmCollection := krt.NewFilteredInformer[*corev1.ConfigMap](client,
kclient.Filter{
ObjectFilter: client.ObjectFilter(),
Namespace: deploymentNamespace,
LabelSelector: JwksStoreLabelSelector(storePrefix)},
krtOptions.ToOptions("config_map_syncer/ConfigMaps")...)

View File

@ -9,7 +9,7 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/common"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
)
// JwksStore is a top-level abstraction that relies on jwksCache and jwksFetcher to
@ -34,7 +34,7 @@ type JwksStore struct {
l sync.Mutex
}
func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *collections.CommonCollections, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
func BuildJwksStore(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
logger.Info("creating jwks store")
jwksCache := NewJwksCache()
@ -43,7 +43,7 @@ func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *colle
jwksCache: jwksCache,
jwksChanges: jwksChanges,
jwksFetcher: NewJwksFetcher(jwksCache),
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, commonCols.KrtOpts),
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, krtOpts),
cmNameToJwks: make(map[string]string),
}
BuildJwksConfigMapNamespacedNameFunc(storePrefix, deploymentNamespace)

View File

@ -13,9 +13,9 @@ import (
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
type JwksUrlBuilder interface {
@ -191,7 +191,7 @@ func GetTLSConfig(
certPool := x509.NewCertPool()
for _, ref := range btls.CACertificateRefs {
nn := types.NamespacedName{
Name: string(ref.Name),
Name: ref.Name,
Namespace: namespace,
}
cfgmap := krt.FetchOne(krtctx, cfgmaps, krt.FilterObjectName(nn))

View File

@ -164,8 +164,7 @@ func TestRemoteJwksUrlBuilder(t *testing.T) {
}
func setup(t *testing.T, paths []string) plugins.PolicyCtx {
val := apitests.NewAgentgatewayValidator(t)
val.SkipMissing = true
val := apitests.NewAgentgatewayValidatorSkipMissing(t)
mockObjs := []any{}
for _, f := range paths {
data := file.AsStringOrFail(t, f)

View File

@ -13,8 +13,8 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// JwksStorePolicyController watches AgentgatewayPolicies and Backends. When a resource containing

View File

@ -12,12 +12,13 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
a2aProtocol = "kgateway.dev/a2a"
legacyA2aProtocol = "kgateway.dev/a2a"
a2aProtocol = "agentgateway.dev/a2a"
)
// NewA2APlugin creates a new A2A policy plugin
@ -48,7 +49,8 @@ func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service,
}).UnsortedList()
for _, port := range svc.Spec.Ports {
if port.AppProtocol != nil && *port.AppProtocol == a2aProtocol {
// support legacy kgateway.dev/a2a and agentgateway.dev/a2a
if port.AppProtocol != nil && (*port.AppProtocol == a2aProtocol || *port.AppProtocol == legacyA2aProtocol) {
logger.Debug("found A2A service", "service", svc.Name, "namespace", svc.Namespace, "port", port.Port)
hostname := fmt.Sprintf("%s.%s.svc.%s", svc.Name, svc.Namespace, clusterDomain)
policy := &api.Policy{

View File

@ -275,7 +275,7 @@ func processGoogleModelArmor(ctx PolicyCtx, namespace string, armor *agentgatewa
// Set location with default value if not specified
if armor.Location != nil {
pgArmor.Location = ptr.Of(string(*armor.Location))
pgArmor.Location = ptr.Of(*armor.Location)
} else {
pgArmor.Location = ptr.Of("us-central1")
}

View File

@ -12,6 +12,7 @@ import (
"istio.io/istio/pkg/ptr"
"istio.io/istio/pkg/slices"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
@ -19,9 +20,8 @@ import (
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
@ -49,7 +49,7 @@ func TranslateInlineBackendPolicy(
},
Spec: agentgateway.AgentgatewayPolicySpec{Backend: policy},
}
res, err := translateBackendPolicyToAgw(ctx, dummy, nil)
res, err := translateBackendPolicyToAgw(ctx, dummy)
return slices.MapFilter(res, func(e *api.Policy) **api.BackendPolicySpec {
return ptr.Of(e.GetBackend())
}), err
@ -58,7 +58,6 @@ func TranslateInlineBackendPolicy(
func translateBackendPolicyToAgw(
ctx PolicyCtx,
policy *agentgateway.AgentgatewayPolicy,
policyTarget *api.PolicyTarget,
) ([]*api.Policy, error) {
backend := policy.Spec.Backend
if backend == nil {
@ -68,113 +67,65 @@ func translateBackendPolicyToAgw(
var errs []error
policyName := getBackendPolicyName(policy.Namespace, policy.Name)
appendPolicy := func(kind string) func(*api.Policy, error) {
return func(p *api.Policy, err error) {
if err != nil {
name := fmt.Sprintf("%s %s", kind, policyName)
logger.Error("error processing policy", "policy", name, "error", err)
errs = append(errs, err)
}
if p != nil {
agwPolicies = append(agwPolicies, p)
}
}
}
if s := backend.HTTP; s != nil {
pol := translateBackendHTTP(policy, policyTarget)
agwPolicies = append(agwPolicies, pol)
appendPolicy("backendHTTP")(translateBackendHTTP(policy), nil)
}
if s := backend.Tunnel; s != nil {
pol, err := translateBackendTunnel(ctx, policy, policyTarget)
if err != nil {
logger.Error("error processing backend tunnel", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendTunnel")(translateBackendTunnel(ctx, policy))
}
if s := backend.TLS; s != nil {
pol, err := translateBackendTLS(ctx, policy, policyTarget)
if err != nil {
logger.Error("error processing backend TLS", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendTLS")(translateBackendTLS(ctx, policy))
}
if s := backend.TCP; s != nil {
pol, err := translateBackendTCP(ctx, policy, policyName, policyTarget)
if err != nil {
logger.Error("error processing backend TCP", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendTCP")(translateBackendTCP(ctx, policy, policyName))
}
if s := backend.Health; s != nil {
pol, err := translateBackendHealthPolicy(policy, policyTarget)
if err != nil {
logger.Error("error processing backend health policy", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendHealth")(translateBackendHealthPolicy(policy))
}
if s := backend.Transformation; s != nil {
pol, err := translateBackendTransformation(policy, policyTarget)
if err != nil {
logger.Error("error processing backend transformation", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendTransformation")(translateBackendTransformation(policy))
}
if s := backend.MCP; s != nil {
if backend.MCP.Authorization != nil {
pol := translateBackendMCPAuthorization(policy, policyTarget)
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendMCPAuthorization")(translateBackendMCPAuthorization(policy))
}
if backend.MCP.Authentication != nil {
pol, err := translateBackendMCPAuthentication(ctx, policy, policyTarget)
if err != nil {
logger.Error("error processing backend mcp auth", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendMCPAuthentication")(translateBackendMCPAuthentication(ctx, policy))
}
}
if s := backend.AI; s != nil {
pol, err := translateBackendAI(ctx, policy, policyName, policyTarget)
if err != nil {
logger.Error("error processing backend AI", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendAI")(translateBackendAI(ctx, policy, policyName))
}
if s := backend.Auth; s != nil {
pol, err := translateBackendAuth(ctx, policy, policyName, policyTarget)
if err != nil {
logger.Error("error processing backend Auth", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("backendAuth")(translateBackendAuth(ctx, policy, policyName))
}
return agwPolicies, errors.Join(errs...)
}
func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
var errs []error
healthPolicy := policy.Spec.Backend.Health
@ -208,7 +159,9 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy, targe
var unhealthyCondition string
if healthPolicy.UnhealthyCondition != nil {
unhealthyCondition = string(*healthPolicy.UnhealthyCondition)
unhealthyCondition = *castCELPtr(healthPolicy.UnhealthyCondition, func(expr shared.CELExpression) {
errs = append(errs, fmt.Errorf("backend health unhealthyCondition is not a valid CEL expression: %s", expr))
})
}
p := &api.BackendPolicySpec_Health{
@ -216,9 +169,8 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy, targe
Eviction: evictionProto,
}
evictPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + healthPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + healthPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_Health_{
@ -231,14 +183,13 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy, targe
return evictPolicy, errors.Join(errs...)
}
func translateBackendTCP(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) (*api.Policy, error) {
func translateBackendTCP(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
// TODO
return nil, nil
}
func translateBackendTransformation(
policy *agentgateway.AgentgatewayPolicy,
target *api.PolicyTarget,
) (*api.Policy, error) {
var errs []error
transformation := policy.Spec.Backend.Transformation
@ -253,9 +204,8 @@ func translateBackendTransformation(
}
tp := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + backendTransformationSuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + backendTransformationSuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_Transformation{
@ -273,7 +223,7 @@ func translateBackendTransformation(
return tp, errors.Join(errs...)
}
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
var errs []error
tls := policy.Spec.Backend.TLS
@ -290,7 +240,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy,
if scrt == nil {
errs = append(errs, fmt.Errorf("secret %s not found", nn))
} else {
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
errs = append(errs, fmt.Errorf("secret %v contains invalid certificate: %v", nn, err))
}
p.Cert = scrt.Data[corev1.TLSCertKey]
@ -312,7 +262,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy,
errs = append(errs, fmt.Errorf("ConfigMap %s not found", nn))
continue
}
pem, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
pem, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
if err != nil {
errs = append(errs, fmt.Errorf("error extracting CA cert from ConfigMap %s: %w", nn, err))
continue
@ -322,10 +272,9 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy,
}
sb.WriteString(pem)
}
// TODO: if none, submit something to make agentgateway reject requests instead of fail open.
if sb.Len() > 0 {
p.Root = []byte(sb.String())
}
// If we have a root set here, set it
// This may send an empty root, so that we trust nothing rather than system certs.
p.Root = []byte(sb.String())
}
if len(tls.VerifySubjectAltNames) > 0 {
@ -347,9 +296,8 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy,
}
tlsPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + tlsPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + tlsPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_BackendTls{
@ -366,7 +314,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy,
return tlsPolicy, errors.Join(errs...)
}
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) *api.Policy {
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
http := policy.Spec.Backend.HTTP
p := &api.BackendPolicySpec_BackendHTTP{}
if v := http.Version; v != nil {
@ -381,9 +329,8 @@ func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy, target *api.P
p.RequestTimeout = durationpb.New(rt.Duration)
}
tp := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + backendHttpPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + backendHttpPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_BackendHttp{
@ -399,18 +346,14 @@ func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy, target *api.P
return tp
}
func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
tunnel := policy.Spec.Backend.Tunnel
proxy, err := buildBackendRef(ctx, tunnel.BackendRef, policy.Namespace)
if err != nil {
return nil, err
}
tunnelPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + backendTunnelPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + backendTunnelPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_BackendTunnel_{
@ -426,32 +369,38 @@ func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPoli
"policy", policy.Name,
"agentgateway_policy", tunnelPolicy.Name)
return tunnelPolicy, nil
return tunnelPolicy, err
}
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) *api.Policy {
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
backend := policy.Spec.Backend
if backend == nil || backend.MCP == nil || backend.MCP.Authorization == nil {
return nil
return nil, nil
}
auth := backend.MCP.Authorization
var allowPolicies, denyPolicies []string
var errs []error
var allowPolicies, denyPolicies, requirePolicies []string
policies := castCELSlice(auth.Policy.MatchExpressions, func(expr shared.CELExpression) {
errs = append(errs, fmt.Errorf("backend MCP authorization matchExpression is not a valid CEL expression: %s", expr))
})
if auth.Action == shared.AuthorizationPolicyActionDeny {
denyPolicies = append(denyPolicies, cast(auth.Policy.MatchExpressions)...)
denyPolicies = append(denyPolicies, policies...)
} else if auth.Action == shared.AuthorizationPolicyActionRequire {
requirePolicies = append(requirePolicies, policies...)
} else {
allowPolicies = append(allowPolicies, cast(auth.Policy.MatchExpressions)...)
allowPolicies = append(allowPolicies, policies...)
}
mcpPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + mcpAuthorizationPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: policy.Namespace + "/" + policy.Name + mcpAuthorizationPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_McpAuthorization_{
McpAuthorization: &api.BackendPolicySpec_McpAuthorization{
Allow: allowPolicies,
Deny: denyPolicies,
Allow: allowPolicies,
Deny: denyPolicies,
Require: requirePolicies,
},
},
},
@ -462,27 +411,41 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy, t
"policy", policy.Name,
"agentgateway_policy", mcpPolicy.Name)
return mcpPolicy
return mcpPolicy, errors.Join(errs...)
}
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
backend := policy.Spec.Backend
if backend == nil || backend.MCP == nil || backend.MCP.Authentication == nil {
return nil, nil
}
authnPolicy := backend.MCP.Authentication
if authnPolicy == nil {
return nil, nil
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
authnPolicy := policy.Spec.Backend.MCP.Authentication
mcpAuthn, err := translateMCPAuthenticationSpec(ctx, types.NamespacedName{
Namespace: policy.Namespace,
Name: policy.Name,
}, authnPolicy)
mcpAuthnPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_McpAuthentication_{
McpAuthentication: mcpAuthn,
},
},
},
}
idp := api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
if authnPolicy.McpIDP != nil {
if *authnPolicy.McpIDP == agentgateway.Keycloak {
idp = api.BackendPolicySpec_McpAuthentication_KEYCLOAK
} else if *authnPolicy.McpIDP == agentgateway.Auth0 {
idp = api.BackendPolicySpec_McpAuthentication_AUTH0
}
}
logger.Debug("generated MCP authentication policy",
"policy", policy.Name,
"agentgateway_policy", mcpAuthnPolicy.Name)
return mcpAuthnPolicy, err
}
func translateMCPAuthenticationSpec(
ctx PolicyCtx,
policy types.NamespacedName,
authnPolicy *agentgateway.MCPAuthentication,
) (*api.BackendPolicySpec_McpAuthentication, error) {
idp := translateMcpIDP(authnPolicy.McpIDP)
// default mode is Strict
mode := api.BackendPolicySpec_McpAuthentication_STRICT
@ -494,20 +457,70 @@ func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.Agent
mode = api.BackendPolicySpec_McpAuthentication_OPTIONAL
}
var errs []error
jwksUrl, _, err := jwks_url.JwksUrlBuilderFactory().BuildJwksUrlAndTlsConfig(ctx.Krt, policy.Name, policy.Namespace, &authnPolicy.JWKS)
if err != nil {
logger.Error("failed resolving jwks url", "error", err)
return nil, err
errs = append(errs, err)
}
var translatedInlineJwks string
if err == nil {
translatedInlineJwks, err = resolveRemoteJWKSInline(ctx, jwksUrl)
}
translatedInlineJwks, err := resolveRemoteJWKSInline(ctx, jwksUrl)
if err != nil {
logger.Error("failed resolving jwks", "jwks_uri", jwksUrl, "error", err)
errs = append(errs, err)
}
extraResourceMetadata, metadataErr := translateMCPResourceMetadata(authnPolicy.ResourceMetadata)
if metadataErr != nil {
errs = append(errs, metadataErr)
}
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
Issuer: authnPolicy.Issuer,
Audiences: authnPolicy.Audiences,
Provider: idp,
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
Extra: extraResourceMetadata,
},
JwksInline: translatedInlineJwks,
Mode: mode,
}
return mcpAuthn, errors.Join(errs...)
}
func translateJWTMCPConfig(mcp *agentgateway.JWTMCPConfig) (*api.TrafficPolicySpec_JWT_MCP, error) {
extraResourceMetadata, err := translateMCPResourceMetadata(mcp.ResourceMetadata)
if err != nil {
return nil, err
}
return &api.TrafficPolicySpec_JWT_MCP{
Provider: translateMcpIDP(mcp.Provider),
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
Extra: extraResourceMetadata,
},
}, nil
}
func translateMcpIDP(provider *agentgateway.McpIDP) api.BackendPolicySpec_McpAuthentication_McpIDP {
if provider == nil {
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
}
if *provider == agentgateway.Keycloak {
return api.BackendPolicySpec_McpAuthentication_KEYCLOAK
}
if *provider == agentgateway.Auth0 {
return api.BackendPolicySpec_McpAuthentication_AUTH0
}
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
}
func translateMCPResourceMetadata(resourceMetadata map[string]apiextensionsv1.JSON) (map[string]*structpb.Value, error) {
var errs []error
var extraResourceMetadata map[string]*structpb.Value
for k, v := range authnPolicy.ResourceMetadata {
for k, v := range resourceMetadata {
if extraResourceMetadata == nil {
extraResourceMetadata = make(map[string]*structpb.Value)
}
@ -522,39 +535,11 @@ func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.Agent
extraResourceMetadata[k] = proto
}
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
Issuer: authnPolicy.Issuer,
Audiences: authnPolicy.Audiences,
Provider: idp,
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
Extra: extraResourceMetadata,
},
JwksInline: translatedInlineJwks,
Mode: mode,
}
mcpAuthnPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_McpAuthentication_{
McpAuthentication: mcpAuthn,
},
},
},
}
logger.Debug("generated MCP authentication policy",
"policy", policy.Name,
"agentgateway_policy", mcpAuthnPolicy.Name)
return mcpAuthnPolicy, errors.Join(errs...)
return extraResourceMetadata, errors.Join(errs...)
}
// translateBackendAI processes AI configuration and creates corresponding Agw policies
func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolicy, name string, policyTarget *api.PolicyTarget) (*api.Policy, error) {
func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
var errs []error
aiSpec := agwPolicy.Spec.Backend.AI
@ -637,6 +622,9 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
CacheTools: aiSpec.PromptCaching.CacheTools,
}
translatedAIPolicy.PromptCaching.MinTokens = ptr.Of(uint32(aiSpec.PromptCaching.MinTokens)) //nolint:gosec // G115: MinTokens is validated by kubebuilder to be >= 0
if aiSpec.PromptCaching.CacheMessageOffset > 0 {
translatedAIPolicy.PromptCaching.CacheMessageOffset = ptr.Of(uint32(aiSpec.PromptCaching.CacheMessageOffset)) //nolint:gosec // G115: CacheMessageOffset is validated by kubebuilder to be >= 0
}
}
if aiSpec.Routes != nil {
@ -648,9 +636,8 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
}
aiPolicy := &api.Policy{
Key: name + aiPolicySuffix + attachmentName(policyTarget),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, agwPolicy),
Target: policyTarget,
Key: name + aiPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, agwPolicy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_Ai_{
@ -667,15 +654,12 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
return aiPolicy, errors.Join(errs...)
}
func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) (*api.Policy, error) {
func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
var errs []error
auth := policy.Spec.Backend.Auth
if auth == nil {
return nil, nil
}
var translatedAuth *api.BackendAuthPolicy
var kindErrs []error
if auth.InlineKey != nil && *auth.InlineKey != "" {
translatedAuth = &api.BackendAuthPolicy{
@ -688,6 +672,11 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
secret, err := kubeutils.GetSecret(ctx.Collections.Secrets, ctx.Krt, auth.SecretRef.Name, policy.Namespace)
if err != nil {
errs = append(errs, err)
translatedAuth = &api.BackendAuthPolicy{
Kind: &api.BackendAuthPolicy_Key{
Key: &api.Key{},
},
}
} else {
if authKey, ok := kubeutils.GetSecretAuth(secret); ok {
translatedAuth = &api.BackendAuthPolicy{
@ -697,16 +686,25 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
}
} else {
errs = append(errs, fmt.Errorf("secret %s/%s missing Authorization value", policy.Namespace, auth.SecretRef.Name))
translatedAuth = &api.BackendAuthPolicy{
Kind: &api.BackendAuthPolicy_Key{
Key: &api.Key{},
},
}
}
}
} else if auth.AWS != nil {
awsAuth, err := buildAwsAuthPolicy(ctx.Krt, auth.AWS, ctx.Collections.Secrets, policy.Namespace)
translatedAuth = awsAuth
errs = append(errs, err)
if err != nil {
errs = append(errs, err)
}
} else if auth.Azure != nil {
azureAuth, err := buildAzureAuthPolicy(ctx.Krt, auth.Azure, ctx.Collections.Secrets, policy.Namespace)
translatedAuth = azureAuth
errs = append(errs, err)
if err != nil {
errs = append(errs, err)
}
} else if auth.GCP != nil {
translatedAuth = buildGcpAuthPolicy(auth.GCP)
} else if auth.Passthrough != nil {
@ -717,14 +715,9 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
}
}
if translatedAuth == nil {
return nil, errors.Join(errs...)
}
authPolicy := &api.Policy{
Key: name + backendauthPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + backendauthPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_Auth{
@ -737,7 +730,7 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
"policy", policy.Name,
"agentgateway_policy", authPolicy.Name)
return authPolicy, errors.Join(errs...)
return authPolicy, errors.Join(append(errs, kindErrs...)...)
}
// translateRouteType converts kgateway RouteType to agentgateway proto RouteType
@ -769,52 +762,39 @@ func translateRouteType(rt agentgateway.RouteType) api.BackendPolicySpec_Ai_Rout
func buildAwsAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AwsAuth, secrets krt.Collection[*corev1.Secret], namespace string) (*api.BackendAuthPolicy, error) {
var errs []error
if auth == nil {
logger.Warn("using implicit AWS auth for AI backend")
return &api.BackendAuthPolicy{
Kind: &api.BackendAuthPolicy_Aws{
Aws: &api.Aws{
Kind: &api.Aws_Implicit{
Implicit: &api.AwsImplicit{},
},
},
},
}, nil
}
if auth.SecretRef.Name == "" {
logger.Warn("not using any auth for AWS - it's most likely not what you want")
return nil, nil
}
// Get secret using the SecretIndex
secret, err := kubeutils.GetSecret(secrets, krtctx, auth.SecretRef.Name, namespace)
if err != nil {
// Return nil auth policy if secret not found - this will be handled upstream
// TODO(npolshak): Add backend status errors https://github.com/kgateway-dev/kgateway/issues/11966
return nil, err
}
var accessKeyId, secretAccessKey string
var sessionToken *string
// Extract access key
if value, exists := kubeutils.GetSecretValue(secret, wellknown.AccessKey); !exists {
errs = append(errs, errors.New("accessKey is missing or not a valid string"))
// Get secret using the SecretIndex
secret, err := kubeutils.GetSecret(secrets, krtctx, auth.SecretRef.Name, namespace)
if err != nil {
errs = append(errs, err)
} else {
accessKeyId = value
}
// Extract access key
if value, exists := kubeutils.GetSecretValue(secret, wellknown.AccessKey); !exists {
errs = append(errs, errors.New("accessKey is missing or not a valid string"))
} else {
accessKeyId = value
}
// Extract secret key
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SecretKey); !exists {
errs = append(errs, errors.New("secretKey is missing or not a valid string"))
} else {
secretAccessKey = value
}
// Extract secret key
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SecretKey); !exists {
errs = append(errs, errors.New("secretKey is missing or not a valid string"))
} else {
secretAccessKey = value
}
// Extract session token (optional)
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SessionToken); exists {
sessionToken = ptr.Of(value)
// Extract session token (optional)
if secret != nil {
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SessionToken); exists {
sessionToken = ptr.Of(value)
}
}
}
return &api.BackendAuthPolicy{
@ -835,19 +815,6 @@ func buildAwsAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AwsAuth, s
func buildAzureAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AzureAuth, secrets krt.Collection[*corev1.Secret], namespace string) (*api.BackendAuthPolicy, error) {
var errs []error
if auth == nil {
logger.Warn("using implicit Azure auth for AI backend")
return &api.BackendAuthPolicy{
Kind: &api.BackendAuthPolicy_Azure{
Azure: &api.Azure{
Kind: &api.Azure_DeveloperImplicit{
DeveloperImplicit: &api.AzureDeveloperImplicit{},
},
},
},
}, nil
}
if auth.SecretRef.Name != "" {
return buildAzureClientSecret(secrets, krtctx, auth, namespace, errs)
}
@ -892,34 +859,31 @@ func buildAzureAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AzureAut
}
func buildAzureClientSecret(secrets krt.Collection[*corev1.Secret], krtctx krt.HandlerContext, auth *agentgateway.AzureAuth, namespace string, errs []error) (*api.BackendAuthPolicy, error) {
var clientID, tenantID, clientSecret string
secret, err := kubeutils.GetSecret(secrets, krtctx, auth.SecretRef.Name, namespace)
if err != nil {
// Return nil auth policy if secret not found - this will be handled upstream
// TODO(npolshak): Add backend status errors https://github.com/kgateway-dev/kgateway/issues/11966
return nil, err
}
var clientID, tenantID, clientSecret string
// Extract client ID
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientID); !exists {
errs = append(errs, errors.New("clientID is missing or not a valid string"))
errs = append(errs, err)
} else {
clientID = value
}
// Extract client ID
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientID); !exists {
errs = append(errs, errors.New("clientID is missing or not a valid string"))
} else {
clientID = value
}
// Extract tenant ID
if value, exists := kubeutils.GetSecretValue(secret, wellknown.TenantID); !exists {
errs = append(errs, errors.New("tenantID is missing or not a valid string"))
} else {
tenantID = value
}
// Extract tenant ID
if value, exists := kubeutils.GetSecretValue(secret, wellknown.TenantID); !exists {
errs = append(errs, errors.New("tenantID is missing or not a valid string"))
} else {
tenantID = value
}
// Extract client secret
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientSecret); !exists {
errs = append(errs, errors.New("clientSecret is missing or not a valid string"))
} else {
clientSecret = value
// Extract client secret
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientSecret); !exists {
errs = append(errs, errors.New("clientSecret is missing or not a valid string"))
} else {
clientSecret = value
}
}
return &api.BackendAuthPolicy{

View File

@ -20,8 +20,8 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// NewBackendTLSPlugin creates a new BackendTLSPolicy plugin
@ -45,7 +45,7 @@ func NewBackendTLSPlugin(agw *AgwCollections) AgwPlugin {
st, o := krt.NewStatusManyCollection(agw.BackendTLSPolicies, func(krtctx krt.HandlerContext, btls *gwv1.BackendTLSPolicy) (*gwv1.PolicyStatus, []AgwPolicy) {
return translatePoliciesForBackendTLS(krtctx, agw.ControllerName, input.References, agw.ConfigMaps, agw.Secrets, agw.Services, backendTLSTarget, agw.Gateways, btls)
}, agw.KrtOpts.ToOptions("agentgateway/BackendTLSPolicy")...)
return convertStatusCollection(st), o
return ConvertStatusCollection(st), o
},
},
},
@ -130,16 +130,14 @@ func translatePoliciesForBackendTLS(
}
}
backendTLSPoliciesForThisTarget := krt.FetchOne(krtctx, targetIndex, krt.FilterKey(tgtRef.String()))
if backendTLSPoliciesForThisTarget != nil {
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
Reason: string(gwv1.PolicyReasonConflicted),
Message: err.Error(),
}
// We cannot send this policy to agentgateway, as it would not know the priority logic.
continue
backendTLSPoliciesForThisTarget := krtutil.FetchIndexObjects(krtctx, targetIndex, tgtRef)
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
Reason: string(gwv1.PolicyReasonConflicted),
Message: err.Error(),
}
// We cannot send this policy to agentgateway, as it would not know the priority logic.
continue
}
switch string(target.Kind) {
@ -211,7 +209,7 @@ func translatePoliciesForBackendTLS(
if scrt == nil {
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
} else {
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
} else {
res.Cert = scrt.Data[corev1.TLSCertKey]
@ -254,9 +252,9 @@ func translatePoliciesForBackendTLS(
func checkConflicted(
btls *gwv1.BackendTLSPolicy,
target gwv1.LocalPolicyTargetReferenceWithSectionName,
allMatches *krt.IndexObject[utils.TypedNamespacedName, *gwv1.BackendTLSPolicy],
allMatches []*gwv1.BackendTLSPolicy,
) error {
for _, m := range allMatches.Objects {
for _, m := range allMatches {
if m.UID == btls.UID {
// This is ourself, skip it
continue
@ -353,7 +351,7 @@ func getBackendTLSCACert(
}
return nil, fmt.Errorf("certificate reference not found: %v", ref)
}
caCert, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
caCert, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
if err != nil {
conds[string(gwv1.BackendTLSPolicyReasonResolvedRefs)].error = &ConfigError{
Reason: string(gwv1.BackendTLSPolicyReasonInvalidCACertificateRef),

View File

@ -7,6 +7,7 @@ import (
"istio.io/istio/pkg/kube/kclient"
"istio.io/istio/pkg/kube/krt"
"istio.io/istio/pkg/kube/kubetypes"
"istio.io/istio/pkg/ptr"
corev1 "k8s.io/api/core/v1"
discovery "k8s.io/api/discovery/v1"
inf "sigs.k8s.io/gateway-api-inference-extension/api/v1"
@ -14,18 +15,23 @@ import (
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
apisettings "github.com/agentgateway/agentgateway/controller/api/settings"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
kgwversioned "github.com/agentgateway/agentgateway/controller/pkg/client/clientset/versioned"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
type AgwCollections struct {
OurClient kgwversioned.Interface
Client apiclient.Client
KrtOpts krtutil.KrtOptions
Settings apisettings.Settings
GatewaysForDeployer krt.Collection[collections.GatewayForDeployer]
// Core Kubernetes resources
Namespaces krt.Collection[*corev1.Namespace]
@ -76,82 +82,108 @@ type AgwCollections struct {
// Collections that rely on plugins aren't initialized here,
// and InitPlugins must be called.
func NewAgwCollections(
commoncol *collections.CommonCollections,
krtOptions krtutil.KrtOptions,
client apiclient.Client,
agwControllerName string,
settings apisettings.Settings,
systemNamespace string,
clusterID string,
) (*AgwCollections, error) {
filter := kclient.Filter{ObjectFilter: client.ObjectFilter()}
gateways := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](
client, wellknown.GatewayGVR, filter), krtOptions.ToOptions("informer/Gateways")...)
gatewayClasses := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](
client, wellknown.GatewayClassGVR, filter), krtOptions.ToOptions("informer/GatewayClasses")...)
listenerSets := krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](
client, wellknown.ListenerSetGVR, kubetypes.StandardInformer, filter), krtOptions.ToOptions("informer/ListenerSets")...)
byParentRefIndex := krtpkg.UnnamedIndex(listenerSets, func(in *gwv1.ListenerSet) []collections.TargetRefIndexKey {
pRef := in.Spec.ParentRef
ns := ptr.OrDefault(pRef.Namespace, gwv1.Namespace(in.GetNamespace()))
// lookup by the root object
return []collections.TargetRefIndexKey{{
Group: wellknown.GatewayGroup,
Kind: wellknown.GatewayKind,
Name: string(pRef.Name),
Namespace: string(ns),
// this index intentionally doesn't include sectionName
}}
})
agwCollections := &AgwCollections{
Client: commoncol.Client,
KrtOpts: commoncol.KrtOpts,
ControllerName: agwControllerName,
SystemNamespace: systemNamespace,
IstioNamespace: commoncol.Settings.IstioNamespace,
IstioRevision: commoncol.Settings.IstioRevision,
ClusterID: clusterID,
Client: client,
KrtOpts: krtOptions,
Settings: settings,
GatewaysForDeployer: krt.NewCollection(gateways, collections.GatewaysForDeployerTransformationFunc(gatewayClasses, listenerSets, byParentRefIndex, agwControllerName)),
ControllerName: agwControllerName,
SystemNamespace: systemNamespace,
IstioNamespace: settings.IstioNamespace,
IstioRevision: settings.IstioRevision,
ClusterID: clusterID,
// Core Kubernetes resources
Namespaces: krt.NewInformer[*corev1.Namespace](commoncol.Client, commoncol.KrtOpts.ToOptions("informer/Namespaces")...),
Nodes: krt.NewFilteredInformer[*corev1.Node](commoncol.Client, kclient.Filter{
ObjectFilter: commoncol.Client.ObjectFilter(),
}, commoncol.KrtOpts.ToOptions("informer/Nodes")...),
Pods: krt.NewFilteredInformer[*corev1.Pod](commoncol.Client, kclient.Filter{
Namespaces: krt.NewInformer[*corev1.Namespace](client, krtOptions.ToOptions("informer/Namespaces")...),
Nodes: krt.NewFilteredInformer[*corev1.Node](client, kclient.Filter{
ObjectFilter: client.ObjectFilter(),
}, krtOptions.ToOptions("informer/Nodes")...),
Pods: krt.NewFilteredInformer[*corev1.Pod](client, kclient.Filter{
ObjectTransform: istiokube.StripPodUnusedFields,
ObjectFilter: commoncol.Client.ObjectFilter(),
}, commoncol.KrtOpts.ToOptions("informer/Pods")...),
ObjectFilter: client.ObjectFilter(),
}, krtOptions.ToOptions("informer/Pods")...),
Secrets: krt.WrapClient(
kclient.NewFiltered[*corev1.Secret](commoncol.Client, kubetypes.Filter{
ObjectFilter: commoncol.Client.ObjectFilter(),
kclient.NewFiltered[*corev1.Secret](client, kubetypes.Filter{
FieldSelector: apiclient.SecretsFieldSelector,
ObjectFilter: client.ObjectFilter(),
}),
),
ConfigMaps: krt.WrapClient(
kclient.NewFiltered[*corev1.ConfigMap](commoncol.Client, kubetypes.Filter{
ObjectFilter: commoncol.Client.ObjectFilter(),
kclient.NewFiltered[*corev1.ConfigMap](client, kubetypes.Filter{
ObjectFilter: client.ObjectFilter(),
}),
commoncol.KrtOpts.ToOptions("informer/ConfigMaps")...,
krtOptions.ToOptions("informer/ConfigMaps")...,
),
Services: krt.WrapClient(
kclient.NewFiltered[*corev1.Service](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/Services")...),
kclient.NewFiltered[*corev1.Service](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/Services")...),
EndpointSlices: krt.WrapClient(
kclient.NewFiltered[*discovery.EndpointSlice](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/EndpointSlices")...),
kclient.NewFiltered[*discovery.EndpointSlice](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/EndpointSlices")...),
// Istio resources
WorkloadEntries: krt.WrapClient(
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](commoncol.Client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/WorkloadEntries")...),
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/WorkloadEntries")...),
ServiceEntries: krt.WrapClient(
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](commoncol.Client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/ServiceEntries")...),
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/ServiceEntries")...),
// Gateway API resources
GatewayClasses: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](commoncol.Client, wellknown.GatewayClassGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GatewayClasses")...),
Gateways: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](commoncol.Client, wellknown.GatewayGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/Gateways")...),
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](commoncol.Client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/HTTPRoutes")...),
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](commoncol.Client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GRPCRoutes")...),
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](commoncol.Client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TLSRoutes")...),
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](commoncol.Client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/BackendTLSPolicies")...),
ListenerSets: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](commoncol.Client, gvr.ListenerSet, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ListenerSets")...),
GatewayClasses: gatewayClasses,
Gateways: gateways,
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/HTTPRoutes")...),
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/GRPCRoutes")...),
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TLSRoutes")...),
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/BackendTLSPolicies")...),
ListenerSets: listenerSets,
// Gateway API alpha
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](commoncol.Client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TCPRoutes")...),
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](commoncol.Client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ReferenceGrants")...),
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TCPRoutes")...),
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/ReferenceGrants")...),
// BackendTrafficPolicy?
// inference extensions need to be enabled so control plane has permissions to watch resource. Disable by default
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, commoncol.KrtOpts.ToOptions("disable/inferencepools")...),
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, krtOptions.ToOptions("disable/inferencepools")...),
// agentgateway-specific CRDs
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](commoncol.Client),
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](commoncol.Client),
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](client),
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](client),
}
if commoncol.Settings.EnableInferExt {
if settings.EnableInferExt {
// inference extensions cluster watch permissions are controlled by enabling EnableInferExt
inferencePoolGVR := wellknown.InferencePoolGVK.GroupVersion().WithResource("inferencepools")
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](commoncol.Client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/InferencePools")...)
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/InferencePools")...)
}
agwCollections.SetupIndexes()
@ -162,3 +194,7 @@ func (c *AgwCollections) SetupIndexes() {
c.SecretsByNamespace = krt.NewNamespaceIndex(c.Secrets)
c.ServicesByNamespace = krt.NewNamespaceIndex(c.Services)
}
func (c *AgwCollections) HasSynced() bool {
return c.GatewaysForDeployer.HasSynced()
}

View File

@ -6,15 +6,16 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
"istio.io/istio/pkg/ptr"
"istio.io/istio/pkg/slices"
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
frontendTcpPolicySuffix = ":frontend-tcp"
frontendNetworkAuthzSuffix = ":frontend-network-authz"
frontendTlsPolicySuffix = ":frontend-tls"
frontendHttpPolicySuffix = ":frontend-http"
frontendLoggingPolicySuffix = ":frontend-logging"
@ -24,7 +25,6 @@ const (
func translateFrontendPolicyToAgw(
policyCtx PolicyCtx,
policy *agentgateway.AgentgatewayPolicy,
policyTarget *api.PolicyTarget,
) ([]*api.Policy, error) {
frontend := policy.Spec.Frontend
if frontend == nil {
@ -34,60 +34,61 @@ func translateFrontendPolicyToAgw(
var errs []error
policyName := getFrontendPolicyName(policy.Namespace, policy.Name)
appendPolicy := func(kind string) func(*api.Policy, error) {
return func(p *api.Policy, err error) {
if err != nil {
name := fmt.Sprintf("%s %s", kind, policyName)
logger.Error("error processing policy", "policy", name, "error", err)
errs = append(errs, err)
}
if p != nil {
agwPolicies = append(agwPolicies, p)
}
}
}
if s := frontend.HTTP; s != nil {
pol := translateFrontendHTTP(policy, policyName, policyTarget)
agwPolicies = append(agwPolicies, pol)
appendPolicy("http")(translateFrontendHTTP(policy, policyName), nil)
}
if s := frontend.TLS; s != nil {
pol := translateFrontendTLS(policy, policyName, policyTarget)
agwPolicies = append(agwPolicies, pol)
appendPolicy("tls")(translateFrontendTLS(policy, policyName), nil)
}
if s := frontend.TCP; s != nil {
pol := translateFrontendTCP(policy, policyName, policyTarget)
agwPolicies = append(agwPolicies, pol)
appendPolicy("tcp")(translateFrontendTCP(policy, policyName), nil)
}
if s := frontend.NetworkAuthorization; s != nil {
appendPolicy("networkAuthorization")(translateFrontendNetworkAuthorization(policy, policyName), nil)
}
if s := frontend.AccessLog; s != nil {
pol, err := translateFrontendAccessLog(policyCtx, policy, policyName, policyTarget)
if err != nil {
logger.Error("error processing access log", "err", err)
errs = append(errs, err)
}
agwPolicies = append(agwPolicies, pol)
appendPolicy("accessLog")(translateFrontendAccessLog(policyCtx, policy, policyName))
}
if s := frontend.Tracing; s != nil {
pol, err := translateFrontendTracing(policyCtx, policy, policyName, policyTarget)
if err != nil {
logger.Error("error processing tracing", "err", err)
errs = append(errs, err)
}
if pol != nil {
agwPolicies = append(agwPolicies, pol)
}
appendPolicy("tracing")(translateFrontendTracing(policyCtx, policy, policyName))
}
return agwPolicies, errors.Join(errs...)
}
func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) (*api.Policy, error) {
func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
tracing := policy.Spec.Frontend.Tracing
if tracing == nil {
return nil, nil
}
var errs []error
provider, err := buildBackendRef(ctx, tracing.BackendRef, policy.Namespace)
if err != nil {
return nil, fmt.Errorf("failed to translate tracing backend ref: %v", err)
errs = append(errs, fmt.Errorf("failed to translate tracing backend ref: %v", err))
}
var addAttributes []*api.FrontendPolicySpec_TracingAttribute
var rmAttributes []string
if tracing.Attributes != nil {
for _, add := range tracing.Attributes.Add {
if !isCEL(add.Expression) {
errs = append(errs, fmt.Errorf("frontend tracing attribute %q is not a valid CEL expression: %s", add.Name, add.Expression))
}
addAttributes = append(addAttributes, &api.FrontendPolicySpec_TracingAttribute{
Name: add.Name,
Value: string(add.Expression),
@ -101,6 +102,9 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
var addResources []*api.FrontendPolicySpec_TracingAttribute
if tracing.Resources != nil {
for _, add := range tracing.Resources {
if !isCEL(add.Expression) {
errs = append(errs, fmt.Errorf("frontend tracing resource %q is not a valid CEL expression: %s", add.Name, add.Expression))
}
addResources = append(addResources, &api.FrontendPolicySpec_TracingAttribute{
Name: add.Name,
Value: string(add.Expression),
@ -110,17 +114,21 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
var randomSampling *string
if tracing.RandomSampling != nil {
randomSampling = ptr.Of(string(*tracing.RandomSampling))
randomSampling = castCELPtr(tracing.RandomSampling, func(expr shared.CELExpression) {
errs = append(errs, fmt.Errorf("frontend tracing randomSampling is not a valid CEL expression: %s", expr))
})
}
var clientSampling *string
if tracing.ClientSampling != nil {
clientSampling = ptr.Of(string(*tracing.ClientSampling))
clientSampling = castCELPtr(tracing.ClientSampling, func(expr shared.CELExpression) {
errs = append(errs, fmt.Errorf("frontend tracing clientSampling is not a valid CEL expression: %s", expr))
})
}
var path *string
if tracing.Path != nil {
path = ptr.Of(string(*tracing.Path))
path = ptr.Of(*tracing.Path)
}
var protocol api.FrontendPolicySpec_Tracing_Protocol
@ -131,13 +139,12 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
protocol = api.FrontendPolicySpec_Tracing_HTTP
default:
// default to HTTP
protocol = api.FrontendPolicySpec_Tracing_HTTP
protocol = api.FrontendPolicySpec_Tracing_GRPC
}
tracingPolicy := &api.Policy{
Key: name + frontendTracingPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + frontendTracingPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_Tracing_{Tracing: &api.FrontendPolicySpec_Tracing{
@ -156,34 +163,41 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
logger.Debug("generated tracing policy",
"policy", policy.Name,
"agentgateway_policy", tracingPolicy.Name,
"target", target)
"agentgateway_policy", tracingPolicy.Name)
return tracingPolicy, nil
return tracingPolicy, errors.Join(errs...)
}
func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) (*api.Policy, error) {
func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
logging := policy.Spec.Frontend.AccessLog
spec := &api.FrontendPolicySpec_Logging{}
var errs []error
if f := logging.Filter; f != nil {
spec.Filter = (*string)(f)
spec.Filter = castCELPtr(f, func(expr shared.CELExpression) {
errs = append(errs, fmt.Errorf("frontend accessLog filter is not a valid CEL expression: %s", expr))
})
}
if a := logging.Attributes; a != nil {
fields := make([]*api.FrontendPolicySpec_Logging_Field, 0, len(a.Add))
for _, add := range a.Add {
if !isCEL(add.Expression) {
errs = append(errs, fmt.Errorf("frontend accessLog field %q is not a valid CEL expression: %s", add.Name, add.Expression))
}
fields = append(fields, &api.FrontendPolicySpec_Logging_Field{
Name: add.Name,
Expression: string(add.Expression),
})
}
f := &api.FrontendPolicySpec_Logging_Fields{
Remove: a.Remove,
Add: slices.Map(a.Add, func(e agentgateway.AttributeAdd) *api.FrontendPolicySpec_Logging_Field {
return &api.FrontendPolicySpec_Logging_Field{
Name: e.Name,
Expression: string(e.Expression),
}
}),
Add: fields,
}
spec.Fields = f
}
if otlp := logging.Otlp; otlp != nil {
provider, err := buildBackendRef(ctx, otlp.BackendRef, policy.Namespace)
if err != nil {
return nil, fmt.Errorf("failed to translate access log OTLP backend ref: %v", err)
errs = append(errs, fmt.Errorf("failed to translate access log OTLP backend ref: %v", err))
}
var protocol api.FrontendPolicySpec_Logging_OtlpAccessLog_Protocol
@ -198,7 +212,7 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
var path *string
if otlp.Path != nil {
path = ptr.Of(string(*otlp.Path))
path = ptr.Of(*otlp.Path)
}
spec.OtlpAccessLog = &api.FrontendPolicySpec_Logging_OtlpAccessLog{
@ -209,9 +223,8 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
}
loggingPolicy := &api.Policy{
Key: name + frontendLoggingPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + frontendLoggingPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_Logging_{
@ -223,13 +236,12 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
logger.Debug("generated logging policy",
"policy", policy.Name,
"agentgateway_policy", loggingPolicy.Name,
"target", target)
"agentgateway_policy", loggingPolicy.Name)
return loggingPolicy, nil
return loggingPolicy, errors.Join(errs...)
}
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) *api.Policy {
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
tcp := policy.Spec.Frontend.TCP
spec := &api.FrontendPolicySpec_TCP{}
if ka := tcp.KeepAlive; ka != nil {
@ -246,9 +258,8 @@ func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string,
}
tcpPolicy := &api.Policy{
Key: name + frontendTcpPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + frontendTcpPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_Tcp{
@ -260,17 +271,50 @@ func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string,
logger.Debug("generated tcp policy",
"policy", policy.Name,
"agentgateway_policy", tcpPolicy.Name,
"target", target)
"agentgateway_policy", tcpPolicy.Name)
return tcpPolicy
}
func translateFrontendNetworkAuthorization(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
auth := policy.Spec.Frontend.NetworkAuthorization
var allowPolicies, denyPolicies, requirePolicies []string
if auth.Action == shared.AuthorizationPolicyActionDeny {
denyPolicies = append(denyPolicies, cast(auth.Policy.MatchExpressions)...)
} else if auth.Action == shared.AuthorizationPolicyActionRequire {
requirePolicies = append(requirePolicies, cast(auth.Policy.MatchExpressions)...)
} else {
allowPolicies = append(allowPolicies, cast(auth.Policy.MatchExpressions)...)
}
pol := &api.Policy{
Key: name + frontendNetworkAuthzSuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_NetworkAuthorization_{
NetworkAuthorization: &api.FrontendPolicySpec_NetworkAuthorization{
Allow: allowPolicies,
Deny: denyPolicies,
Require: requirePolicies,
},
},
},
},
}
logger.Debug("generated frontend network authorization policy",
"policy", policy.Name,
"agentgateway_policy", pol.Name)
return pol
}
func castUint32[T ~int32](ka *T) *uint32 {
return ptr.Of((uint32)(*ka))
}
func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) *api.Policy {
func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
tls := policy.Spec.Frontend.TLS
spec := &api.FrontendPolicySpec_TLS{}
if ka := tls.HandshakeTimeout; ka != nil {
@ -336,9 +380,8 @@ func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string,
}
tlsPolicy := &api.Policy{
Key: name + frontendTlsPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + frontendTlsPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_Tls{
@ -350,13 +393,12 @@ func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string,
logger.Debug("generated tls policy",
"policy", policy.Name,
"agentgateway_policy", tlsPolicy.Name,
"target", target)
"agentgateway_policy", tlsPolicy.Name)
return tlsPolicy
}
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) *api.Policy {
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
http := policy.Spec.Frontend.HTTP
spec := &api.FrontendPolicySpec_HTTP{}
if v := http.MaxBufferSize; v != nil {
@ -385,9 +427,8 @@ func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string,
}
httpPolicy := &api.Policy{
Key: name + frontendHttpPolicySuffix + attachmentName(target),
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Target: target,
Key: name + frontendHttpPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Frontend{
Frontend: &api.FrontendPolicySpec{
Kind: &api.FrontendPolicySpec_Http{
@ -399,8 +440,7 @@ func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string,
logger.Debug("generated http policy",
"policy", policy.Name,
"agentgateway_policy", httpPolicy.Name,
"target", target)
"agentgateway_policy", httpPolicy.Name)
return httpPolicy
}

View File

@ -17,8 +17,8 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
@ -35,7 +35,7 @@ func NewInferencePlugin(agw *AgwCollections) AgwPlugin {
status, policyCol := krt.NewStatusManyCollection(agw.InferencePools, func(krtctx krt.HandlerContext, infPool *inf.InferencePool) (*inf.InferencePoolStatus, []AgwPolicy) {
return translatePoliciesForInferencePool(krtctx, agw.ControllerName, input.References, agw.Services, infPool)
}, agw.KrtOpts.ToOptions("agentgateway/InferencePools")...)
return convertStatusCollection(status), policyCol
return ConvertStatusCollection(status), policyCol
},
},
},
@ -136,9 +136,9 @@ func validateInferencePoolEndpointPickerRef(krtctx krt.HandlerContext, pool *inf
kind := epr.Kind
if kind == "" {
// InferencePool defaults this field to Service.
kind = inf.Kind(wellknown.ServiceKind)
kind = wellknown.ServiceKind
}
if kind != inf.Kind(wellknown.ServiceKind) {
if kind != wellknown.ServiceKind {
errs = append(errs, fmt.Sprintf("endpointPickerRef.kind must be %q, got %q", wellknown.ServiceKind, kind))
}
@ -254,8 +254,8 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
return []inf.ParentReference{}
}
return []inf.ParentReference{{
Kind: inf.Kind(defaultInferencePoolStatusKind),
Name: inf.ObjectName(defaultInferencePoolStatusName),
Kind: defaultInferencePoolStatusKind,
Name: defaultInferencePoolStatusName,
}}
}
@ -274,7 +274,7 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
for _, g := range gateways {
refs = append(refs, inf.ParentReference{
Group: ptr.Of(inf.Group(wellknown.GatewayGroup)),
Kind: inf.Kind(wellknown.GatewayKind),
Kind: wellknown.GatewayKind,
Namespace: inf.Namespace(g.Namespace),
Name: inf.ObjectName(g.Name),
})

View File

@ -1,7 +1,6 @@
package plugins
import (
"context"
"sort"
"istio.io/istio/pilot/pkg/util/protoconv"
@ -13,16 +12,18 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
)
// AgwResourceStatusSyncHandler defines a function that handles status syncing for a specific resource type in AgentGateway
type AgwResourceStatusSyncHandler func(ctx context.Context, client apiclient.Client, namespacedName types.NamespacedName, status any) error
type PolicyPluginInput struct {
References ReferenceIndex
}
type BackendPlugin struct {
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[ir.AgwResource])
BuildReferences func() krt.Collection[*PolicyAttachment]
}
type PolicyPlugin struct {
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy])
BuildReferences func(input PolicyPluginInput) krt.Collection[*PolicyAttachment]
@ -54,24 +55,10 @@ func (p AgwPolicy) ResourceName() string {
}
type AddResourcesPlugin struct {
Binds krt.Collection[ir.AgwResource]
Listeners krt.Collection[ir.AgwResource]
Routes krt.Collection[ir.AgwResource]
}
// AddBinds extracts all bind resources from the collection
func (p *AddResourcesPlugin) AddBinds() krt.Collection[ir.AgwResource] {
return p.Binds
}
// AddListeners extracts all routes resources from the collection
func (p *AddResourcesPlugin) AddListeners() krt.Collection[ir.AgwResource] {
return p.Listeners
}
// AddRoutes extracts all routes resources from the collection
func (p *AddResourcesPlugin) AddRoutes() krt.Collection[ir.AgwResource] {
return p.Routes
Binds krt.Collection[ir.AgwResource]
Listeners krt.Collection[ir.AgwResource]
Routes krt.Collection[ir.AgwResource]
AncestorBackends krt.Collection[*utils.AncestorBackend]
}
func ResourceName[T config.Namer](o T) *api.ResourceName {

View File

@ -1,14 +1,211 @@
package plugins
import (
"istio.io/istio/pkg/kube/krt"
"istio.io/istio/pkg/util/sets"
"k8s.io/apimachinery/pkg/types"
"fmt"
"strings"
"istio.io/istio/pkg/kube/krt"
"istio.io/istio/pkg/ptr"
"istio.io/istio/pkg/util/sets"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
type ReferenceTypes struct {
PolicyTargets func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool)
PolicyBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
RouteBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
}
type BackendReferenceErrorReason string
const (
BackendReferenceErrorReasonBackendNotFound BackendReferenceErrorReason = "BackendNotFound"
BackendReferenceErrorReasonInvalidKind BackendReferenceErrorReason = "InvalidKind"
BackendReferenceErrorReasonUnsupportedValue BackendReferenceErrorReason = "UnsupportedValue"
)
type BackendReferenceError struct {
Reason BackendReferenceErrorReason
Message string
}
func (e *BackendReferenceError) Error() string {
return e.Message
}
func DefaultReferenceTypes(agw *AgwCollections) ReferenceTypes {
return ReferenceTypes{
// AgentgatewayPolicy targets
PolicyTargets: func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
key := namespace + "/" + string(name)
switch gk {
case wellknown.GatewayGVK.GroupKind():
return []*api.PolicyTarget{{
Kind: utils.GatewayTarget(namespace, string(name), sectionName),
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
case wellknown.HTTPRouteGVK.GroupKind():
return []*api.PolicyTarget{{
Kind: utils.RouteTarget(namespace, string(name), wellknown.HTTPRouteGVK.Kind, sectionName),
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
case wellknown.GRPCRouteGVK.GroupKind():
return []*api.PolicyTarget{{
Kind: utils.RouteTarget(namespace, string(name), wellknown.GRPCRouteGVK.Kind, sectionName),
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
case wellknown.AgentgatewayBackendGVK.GroupKind():
return []*api.PolicyTarget{{
Kind: utils.BackendTarget(namespace, string(name), sectionName),
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
case wellknown.ServiceGVK.GroupKind():
return []*api.PolicyTarget{{
Kind: utils.ServiceTarget(namespace, string(name), sectionName),
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
}
return nil, false
},
// AgentgatewayPolicy targets to backends (for things like ext_authz, etc)
PolicyBackend: func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
ns := string(ptr.OrDefault(namespace, gwv1.Namespace(defaultNamespace)))
switch gk {
case wellknown.ServiceGVK.GroupKind():
if strings.Contains(string(name), ".") {
return nil, &BackendReferenceError{
Reason: BackendReferenceErrorReasonUnsupportedValue,
Message: "service name invalid; the name of the Service, not the hostname",
}
}
key := ns + "/" + string(name)
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key)))
if svc == nil {
return nil, &BackendReferenceError{
Reason: BackendReferenceErrorReasonBackendNotFound,
Message: fmt.Sprintf("unable to find the Service %v", key),
}
}
if port == nil {
return nil, &BackendReferenceError{
Reason: BackendReferenceErrorReasonUnsupportedValue,
Message: "port is required for Service targets",
}
}
return &api.BackendReference{
Kind: &api.BackendReference_Service_{
Service: &api.BackendReference_Service{
Hostname: kubeutils.GetServiceHostname(string(name), ns),
Namespace: ns,
},
},
Port: uint32(*port), //nolint:gosec // G115: validated 1-65535
}, nil
case wellknown.AgentgatewayBackendGVK.GroupKind():
key := ns + "/" + string(name)
be := ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key)))
if be == nil {
return nil, &BackendReferenceError{
Reason: BackendReferenceErrorReasonBackendNotFound,
Message: fmt.Sprintf("unable to find the Backend %v", key),
}
}
return &api.BackendReference{
Kind: &api.BackendReference_Backend{
Backend: key,
},
}, nil
default:
return nil, &BackendReferenceError{
Reason: BackendReferenceErrorReasonInvalidKind,
Message: fmt.Sprintf("unsupported backend %v", gk),
}
}
},
RouteBackend: func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
return DefaultRouteBackend(krtctx, agw, defaultNamespace, gk, name, namespace, port)
},
}
}
func DefaultRouteBackend(krtctx krt.HandlerContext, agw *AgwCollections, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
ns := string(ptr.OrDefault(namespace, gwv1.Namespace(defaultNamespace)))
// All MUST return a BackendReference. We may not be able to fully populate it, though; this will get replaced with 'invalid'
ref := &api.BackendReference{}
switch gk {
case wellknown.InferencePoolGVK.GroupKind():
if strings.Contains(string(name), ".") {
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonUnsupportedValue,
Message: "InferencePool name invalid; the name of the InferencePool must be used, not the hostname.",
}
}
key := ns + "/" + string(name)
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.InferencePools, krt.FilterKey(key)))
if svc == nil {
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonBackendNotFound,
Message: fmt.Sprintf("backendRef %s not found", key),
}
}
ref.Kind = &api.BackendReference_Service_{
Service: &api.BackendReference_Service{
Hostname: kubeutils.GetInferenceServiceHostname(string(name), ns),
Namespace: ns,
},
}
ref.Port = uint32(svc.Spec.TargetPorts[0].Number) //nolint:gosec // G115: validated 1-65535
case wellknown.ServiceGVK.GroupKind():
if strings.Contains(string(name), ".") {
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonUnsupportedValue,
Message: "service name invalid; the name of the Service must be used, not the hostname.",
}
}
if port == nil { // Validated by CEL so shouldn't happen
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonUnsupportedValue,
Message: "port is required in Service backendRef",
}
}
// Populate resp now, so even if the service doesn't exist we can return a better error (Service not found vs invalid)
ref.Kind = &api.BackendReference_Service_{
Service: &api.BackendReference_Service{
Hostname: kubeutils.GetServiceHostname(string(name), ns),
Namespace: ns,
}}
ref.Port = uint32(*port) //nolint:gosec // G115: validated 1-65535
key := ns + "/" + string(name)
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key)))
if svc == nil {
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonBackendNotFound,
Message: fmt.Sprintf("backend(%s) not found", kubeutils.GetServiceHostname(string(name), ns)),
}
}
case wellknown.AgentgatewayBackendGVK.GroupKind():
key := ns + "/" + string(name)
ref.Kind = &api.BackendReference_Backend{Backend: key}
// Populate resp now, so even if the service doesn't exist we can return a better error (Service not found vs invalid)
be := ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key)))
if be == nil {
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonBackendNotFound,
Message: fmt.Sprintf("Backend not found: %s", key),
}
}
default:
return ref, &BackendReferenceError{
Reason: BackendReferenceErrorReasonInvalidKind,
Message: fmt.Sprintf("referencing unsupported backendRef: group %q kind %q", gk.Group, gk.Kind),
}
}
return ref, nil
}
type RouteAttachment struct {
// Route
From utils.TypedNamespacedName
@ -36,10 +233,12 @@ func (r RouteAttachment) Equals(other RouteAttachment) bool {
func BuildReferenceIndex(
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment],
referenceTypes ReferenceTypes,
) ReferenceIndex {
return ReferenceIndex{
Ancestors: ancestors,
attachments: attachments,
Ancestors: ancestors,
attachments: attachments,
explicitReferences: referenceTypes,
}
}
@ -66,6 +265,8 @@ type ReferenceIndex struct {
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment]
// Gateway --> Gateway: trivial, no collection needed
// ListenerSet --> Gateway: NOT present; ListenerSet attachment not implemented (but really should be!) in AgentgatewayPolicy anyways
explicitReferences ReferenceTypes
}
func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
@ -75,13 +276,13 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
return sets.New(object.NamespacedName)
case wellknown.HTTPRouteGVK.Kind, wellknown.GRPCRouteGVK.Kind, wellknown.TCPRouteGVK.Kind, wellknown.TLSRouteGVK.Kind:
gateways := sets.New[types.NamespacedName]()
for _, ancestor := range krt.FetchOne(ctx, p.attachments, krt.FilterKey(object.String())).Objects {
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.attachments, object) {
gateways.Insert(ancestor.Gateway)
}
return gateways
default:
gateways := sets.New[types.NamespacedName]()
for _, ancestor := range krt.FetchOne(ctx, p.Ancestors, krt.FilterKey(object.String())).Objects {
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.Ancestors, object) {
gateways.Insert(ancestor.Gateway)
}
return gateways
@ -89,21 +290,19 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
}
func (p ReferenceIndex) LookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
return p.lookupGatewaysForBackend(ctx, object, map[string]struct{}{})
return p.lookupGatewaysForBackend(ctx, object, sets.New[utils.TypedNamespacedName]())
}
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen map[string]struct{}) sets.Set[types.NamespacedName] {
key := object.String()
if _, ok := seen[key]; ok {
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen sets.Set[utils.TypedNamespacedName]) sets.Set[types.NamespacedName] {
if seen.InsertContains(object) {
return sets.New[types.NamespacedName]()
}
seen[key] = struct{}{}
base := p.LookupGatewaysForTarget(ctx, object)
if p.PolicyAttachments == nil {
return base
}
for _, pref := range krt.FetchOne(ctx, p.PolicyAttachments, krt.FilterKey(key)).Objects {
for _, pref := range krtutil.FetchIndexObjects(ctx, p.PolicyAttachments, object) {
base = base.Union(p.lookupGatewaysForBackend(ctx, pref.Target, seen))
}
return base
@ -113,3 +312,15 @@ func (p ReferenceIndex) WithPolicyAttachments(references krt.IndexCollection[uti
p.PolicyAttachments = references
return p
}
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
return p.explicitReferences.PolicyTargets(krtctx, namespace, name, gk, sectionName)
}
func (p ReferenceIndex) PolicyBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
return p.explicitReferences.PolicyBackend(krtctx, defaultNamespace, gk, name, namespace, port)
}
func (p ReferenceIndex) RouteBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
return p.explicitReferences.RouteBackend(krtctx, defaultNamespace, gk, name, namespace, port)
}

View File

@ -9,15 +9,18 @@ import (
type AgwPlugin struct {
AddResourceExtension *AddResourcesPlugin
ContributesPolicies map[schema.GroupKind]PolicyPlugin
ContributesBackends map[schema.GroupKind]BackendPlugin
}
func MergePlugins(plug ...AgwPlugin) AgwPlugin {
ret := AgwPlugin{
ContributesPolicies: make(map[schema.GroupKind]PolicyPlugin),
ContributesBackends: make(map[schema.GroupKind]BackendPlugin),
}
for _, p := range plug {
// Merge contributed policies
maps.Copy(ret.ContributesPolicies, p.ContributesPolicies)
maps.Copy(ret.ContributesBackends, p.ContributesBackends)
if p.AddResourceExtension != nil {
if ret.AddResourceExtension == nil {
ret.AddResourceExtension = &AddResourcesPlugin{}
@ -31,17 +34,10 @@ func MergePlugins(plug ...AgwPlugin) AgwPlugin {
if p.AddResourceExtension.Routes != nil {
ret.AddResourceExtension.Routes = p.AddResourceExtension.Routes
}
if p.AddResourceExtension.AncestorBackends != nil {
ret.AddResourceExtension.AncestorBackends = p.AddResourceExtension.AncestorBackends
}
}
}
return ret
}
// Plugins registers all built-in policy plugins
func Plugins(agw *AgwCollections) []AgwPlugin {
return []AgwPlugin{
NewAgentPlugin(agw),
NewInferencePlugin(agw),
NewA2APlugin(agw),
NewBackendTLSPlugin(agw),
}
}

View File

@ -0,0 +1,21 @@
package plugins
import (
"testing"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func TestMergePluginsMergesBackendContributions(t *testing.T) {
backendGK := schema.GroupKind{Group: "enterpriseagentgateway.solo.io", Kind: "EnterpriseAgentgatewayBackend"}
merged := MergePlugins(AgwPlugin{
ContributesBackends: map[schema.GroupKind]BackendPlugin{
backendGK: {},
},
})
if _, ok := merged.ContributesBackends[backendGK]; !ok {
t.Fatalf("expected backend contribution %v to be preserved", backendGK)
}
}

View File

@ -51,9 +51,9 @@ status:
status:
ancestors:
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: be
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake

View File

@ -30,8 +30,8 @@ status:
name: StatusSummary
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
message: secret default/mtls not found
reason: PartiallyValid
status: "True"
type: Accepted
- lastTransitionTime: fake

View File

@ -0,0 +1,66 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: be
namespace: default
spec:
static:
host: example.com
port: 80
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: eviction-invalid-cel
namespace: default
spec:
targetRefs:
- kind: AgentgatewayBackend
name: be
group: agentgateway.dev
backend:
health:
unhealthyCondition: foolen_{{response.code}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
health:
unhealthyCondition: foolen_{{response.code}}
key: default/eviction-invalid-cel:health:default/be
name:
kind: AgentgatewayPolicy
name: eviction-invalid-cel
namespace: default
target:
backend:
name: be
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: eviction-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'backend health unhealthyCondition is not a valid CEL expression:
foolen_{{response.code}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -30,8 +30,8 @@ status:
name: StatusSummary
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
message: secret default/aws-auth-secret not found
reason: PartiallyValid
status: "True"
type: Accepted
- lastTransitionTime: fake

View File

@ -0,0 +1,61 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: mcp-authz-invalid-cel
namespace: default
spec:
targetRefs:
- kind: HTTPRoute
name: test
group: gateway.networking.k8s.io
backend:
mcp:
authorization:
policy:
matchExpressions:
- foolen_{{mcp.tool.name}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
mcpAuthorization:
allow:
- foolen_{{mcp.tool.name}}
key: default/mcp-authz-invalid-cel:mcp-authorization:default/test
name:
kind: AgentgatewayPolicy
name: mcp-authz-invalid-cel
namespace: default
target:
route:
kind: HTTPRoute
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: mcp-authz-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'backend MCP authorization matchExpression is not a valid CEL expression:
foolen_{{mcp.tool.name}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,62 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: mcp-authz-require-invalid-cel
namespace: default
spec:
targetRefs:
- kind: HTTPRoute
name: test
group: gateway.networking.k8s.io
backend:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- foolen_{{mcp.tool.name}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
mcpAuthorization:
require:
- foolen_{{mcp.tool.name}}
key: default/mcp-authz-require-invalid-cel:mcp-authorization:default/test
name:
kind: AgentgatewayPolicy
name: mcp-authz-require-invalid-cel
namespace: default
target:
route:
kind: HTTPRoute
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: mcp-authz-require-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'backend MCP authorization matchExpression is not a valid CEL expression:
foolen_{{mcp.tool.name}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,92 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec:
targetRefs:
- kind: HTTPRoute
name: test
group: gateway.networking.k8s.io
traffic:
authorization:
action: Require
policy:
matchExpressions:
- 'request.path == "/mcp"'
backend:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- 'mcp.tool.name == "echo"'
- 'jwt.sub == "test-user" && mcp.tool.name == "add"'
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
mcpAuthorization:
require:
- mcp.tool.name == "echo"
- jwt.sub == "test-user" && mcp.tool.name == "add"
key: default/agw:mcp-authorization:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
route:
kind: HTTPRoute
name: test
namespace: default
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/agw:rbac:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
route:
kind: HTTPRoute
name: test
namespace: default
traffic:
authorization:
require:
- request.path == "/mcp"
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -267,60 +267,9 @@ status:
status:
ancestors:
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: dummy-oauth
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test1
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test2
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test3
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake

View File

@ -46,6 +46,24 @@ data:
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
auth:
key: {}
key: backend/default/agw:backend-auth:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
route:
kind: HTTPRoute
name: test
namespace: default
- gateway:
Name: test
Namespace: default
@ -79,7 +97,7 @@ output:
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
hostname: example.com
key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzJ4UGkreEwrNU05ZTYKdUpiNEI5ZjlEczJ6MU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1Mgp1Z3ZPL3psTlZkMjN1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDCmZjalZna0g3R2Z4Zk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEYKRUljcWpSSDFXTU9GS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVQo3RHE3Y2YyUWZWd2Z6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qCm8zcHltTlRuQWdNQkFBRUNnZ0VBQnZ3cGZZWkxjQ3FPWTNFaE9VTE9KYnBtY05SVndoRk94NlFEbkI3NUhyV3oKUU9Kc2VvOE9KVXN1NWt1UFN1MlA4WWJCeXlqdVRoSTRNa0xvcDBxVEhXVGJYN3JTNU0yb2xYVWZBa0treXpZcQpaY09EL3JpaUZTSGVZTGQwNGpySmQ3N3RQc3hTbDVyZWRRNUFSSzRCRTRyL1hZR2lBaUhPeEJFdmgyYm9BMTE4Cm1pejZzMjhhSXVxekZoUUdpOEh5ejREOVJCUzJkRWFsazFWK2V1QVhocHFxZ29HRms4TFhrWGxtUlpzZVdYN0MKZEpyVjhQL0grTGZXb3JCM09KRGs3SWIrek9Cc0pLeklwM3NiRlVsajdraGcyd2xjYi9SZUQrUU5BR1VQR3h1YQpHVndqRFVBSmpwb1RmamhIdjdhYUwwaWtyVVB6a1J2TEFQdjBwc0syb1FLQmdRRE05V2tyZkFhZjh2ZVNxR2lzCk1aSkNtOWFVVkUwdGY4eWkxL3owaGxRYlJFb25Mc2xZM0NCWlFZMHZ1T1owWFc1U29PQ1BUamRKRW1lUjFHTFIKVS9BSUJwRmhnNW5VMVIxaEprUkkyOWtPaGFHVXFBREpSR1ErZWdhK0IrQldLNVhUa3hGVFdFRjBSRDhVWENkQQpXa2lzaFBrU1V0VjV2VjdqNy9ibitSR09hUUtCZ1FEa1NQSmlBMTFNODhBSENTdjRWaHJDb3NRdjZURnZyK0p2CnFJVmlmMHowcFBvT0ZDVE1OdUcxN1Zxa29WV0d6U0R6ejBMYUJHWllGRlk5M2E0cGtxZWNnS3kxZVN1eHJKdlEKUko4WTRKSXpKYXlDbzRhc0lURGJPV21LaGk1am92bHkxRDVmSlFKMjNyUVNsWlRSbHVOdWJpVWxTQkErTS9EcQptcFg4c3ZkK3p3S0JnSCszTlEvWnV5OFVjZDA3Zis0OC9ZendHdWhYRjdpUWVHM0k5V0ZTQ3pycWRPS3hydG5tCllXbjlCUU9Gem1VWWkxU0YxeWkxYnBIa0hCR3RMTjZQMVhUSzB2RFcxcGJmTGUySnNPZE54NVhiQTNMa3RZaTEKUzFuN0pCUnFTQXFxSWpTeTRncnpaZVlUV05OUkVVeHlkZks2OFpIUGVDTGlOQzBKTE93a01pSnhBb0dCQUkvMgpGS3lNdEp6ZnBueUpZeW96bXFLZHBKMFdNTy9lK2l3eUdSTzVkZDFkNExkYUtxNkIrYXNSNkxTamJWMGFKU3E3CnpNdlNOSHhkTHRuSzM1Y2wvZjlyQWY5YlQ1dTNYM2RpbnZaQVFOSnljcXpiMVFUZDFZS2FYUjFYYXcrNGFoanAKRWdCTVJaYVM4UG83VEdNMEJXN1JsU2xDbmNPc1c4U0hBZ2tmRDRidkFvR0FUdmxGT0JiNDJmb3hIMTZsQzVtbQpsZThYdWd0eE5zUGY1OTVUVWw4OFRVZVhnZXlFUlQwMDY4NGo4M0pxcjViTENoc016RlYraTUwUjVQWnZsYW1tCnVkdm04NEFmblN1MktHaVBoTFovZkU2K3NVT284NWIza3R6UkZreFBIQklkbEt6V3FWRDhhV0NjcmxGbjdXTVUKM3RlUllXL2NFRFExUFRnTGZBa2I3Rms9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
root: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
root: ""
verifySubjectAltNames:
- '*.example.com'
- api.example.com

View File

@ -0,0 +1,55 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: accesslog-invalid-filter
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
frontend:
accessLog:
filter: foolen_{{response.code}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
frontend:
logging:
filter: foolen_{{response.code}}
key: frontend/default/accesslog-invalid-filter:frontend-logging:default/test
name:
kind: AgentgatewayPolicy
name: accesslog-invalid-filter
namespace: default
target:
gateway:
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: accesslog-invalid-filter
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'frontend accessLog filter is not a valid CEL expression: foolen_{{response.code}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -143,6 +143,33 @@ output:
gateway:
name: test
namespace: default
- gateway:
Name: test
Namespace: default
resource:
policy:
frontend:
tracing:
attributes:
- name: http.useragent
value: request.headers["user-agent"]
clientSampling: "true"
protocol: GRPC
randomSampling: "true"
remove:
- response.code
resources:
- name: service.name
value: agent-gateway
key: frontend/default/agw:frontend-tracing:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy

View File

@ -0,0 +1,63 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
frontend:
networkAuthorization:
action: Require
policy:
matchExpressions:
- 'cidr("10.0.0.0/8").containsIP(source.address)'
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
frontend:
networkAuthorization:
require:
- cidr("10.0.0.0/8").containsIP(source.address)
key: frontend/default/agw:frontend-network-authz:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,79 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: tracing-invalid-attribute
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
frontend:
tracing:
backendRef:
name: otel-collector
port: 4318
attributes:
add:
- name: trace.id
expression: foolen_{{request.id}}
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
namespace: default
spec:
ports:
- port: 4318
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
frontend:
tracing:
attributes:
- name: trace.id
value: foolen_{{request.id}}
protocol: GRPC
providerBackend:
port: 4318
service:
hostname: otel-collector.default.svc.cluster.local
namespace: default
key: frontend/default/tracing-invalid-attribute:frontend-tracing:default/test
name:
kind: AgentgatewayPolicy
name: tracing-invalid-attribute
namespace: default
target:
gateway:
name: test
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: tracing-invalid-attribute
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'frontend tracing attribute "trace.id" is not a valid CEL expression:
foolen_{{request.id}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,58 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: authorization-invalid-cel
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
authorization:
policy:
matchExpressions:
- foolen_{{request.path}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/authorization-invalid-cel:rbac:default/test
name:
kind: AgentgatewayPolicy
name: authorization-invalid-cel
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
authorization:
allow:
- foolen_{{request.path}}
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: authorization-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'authorization matchExpression is not a valid CEL expression: foolen_{{request.path}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,59 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: authorization-require-invalid-cel
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
authorization:
action: Require
policy:
matchExpressions:
- foolen_{{request.path}}
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/authorization-require-invalid-cel:rbac:default/test
name:
kind: AgentgatewayPolicy
name: authorization-require-invalid-cel
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
authorization:
require:
- foolen_{{request.path}}
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: authorization-require-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'authorization matchExpression is not a valid CEL expression: foolen_{{request.path}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -38,6 +38,8 @@ output:
transformation:
request:
set:
- expression: foolen_{{header("content-length")}}
name: x-invalid-header
- expression: '''foolen_'' + request.headers[''content-length'']'
name: x-valid-header
status:

View File

@ -0,0 +1,77 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: grpc-invalid-metadata
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
extAuth:
backendRef:
name: extauthz
port: 1024
grpc:
requestMetadata:
user: foolen_{{jwt.sub}}
---
apiVersion: v1
kind: Service
metadata:
name: extauthz
namespace: default
spec:
ports:
- port: 1024
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/grpc-invalid-metadata:extauth:default/test
name:
kind: AgentgatewayPolicy
name: grpc-invalid-metadata
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
extAuthz:
grpc:
metadata:
user: foolen_{{jwt.sub}}
target:
port: 1024
service:
hostname: extauthz.default.svc.cluster.local
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: grpc-invalid-metadata
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'extAuth grpc requestMetadata "user" is not a valid CEL expression:
foolen_{{jwt.sub}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,74 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: http-invalid-path
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
extAuth:
backendRef:
name: extauthz
port: 1024
http:
path: foolen_{{request.path}}
---
apiVersion: v1
kind: Service
metadata:
name: extauthz
namespace: default
spec:
ports:
- port: 1024
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/http-invalid-path:extauth:default/test
name:
kind: AgentgatewayPolicy
name: http-invalid-path
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
extAuthz:
http:
path: foolen_{{request.path}}
target:
port: 1024
service:
hostname: extauthz.default.svc.cluster.local
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: http-invalid-path
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'extAuth http path is not a valid CEL expression: foolen_{{request.path}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -13,6 +13,7 @@ spec:
backendRef:
name: extauthz
port: 1024
failureMode: FailOpen
forwardBody:
maxSize: 1024
http:
@ -56,6 +57,7 @@ output:
namespace: default
traffic:
extAuthz:
failureMode: ALLOW
http:
addRequestHeaders:
x-custom-header: random()

View File

@ -0,0 +1,82 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: global-rl-invalid-cel
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
rateLimit:
global:
backendRef:
name: rl-svc
port: 4444
domain: api-gateway
descriptors:
- entries:
- name: user-agent
expression: foolen_{{request.headers["user-agent"]}}
---
apiVersion: v1
kind: Service
metadata:
name: rl-svc
namespace: default
spec:
ports:
- port: 4444
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/global-rl-invalid-cel:rl-global:default/test
name:
kind: AgentgatewayPolicy
name: global-rl-invalid-cel
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
remoteRateLimit:
descriptors:
- entries:
- key: user-agent
value: foolen_{{request.headers["user-agent"]}}
domain: api-gateway
target:
port: 4444
service:
hostname: rl-svc.default.svc.cluster.local
namespace: default
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: global-rl-invalid-cel
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: 'rate limit descriptor entry "user-agent" is not a valid CEL expression:
foolen_{{request.headers["user-agent"]}}'
reason: PartiallyValid
status: "True"
type: Accepted
controllerName: agentgateway.dev/agentgateway

View File

@ -14,6 +14,7 @@ spec:
backendRef:
name: rl-svc
port: 4444
failureMode: FailOpen
domain: "api-gateway"
descriptors:
- entries:
@ -52,6 +53,7 @@ output:
- key: user-agent
value: request.headers["user-agent"]
domain: api-gateway
failureMode: FAIL_OPEN
target:
port: 4444
service:

View File

@ -0,0 +1,109 @@
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: listenerset-gw
namespace: default
spec:
gatewayClassName: agentgateway
allowedListeners:
namespaces:
from: All
listeners:
- name: http
protocol: HTTP
port: 8081
---
apiVersion: gateway.networking.k8s.io/v1
kind: ListenerSet
metadata:
name: listenerset
namespace: default
spec:
parentRef:
group: gateway.networking.k8s.io
kind: Gateway
name: listenerset-gw
listeners:
- name: http-9090
protocol: HTTP
port: 9090
allowedRoutes:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: listenerset-route
namespace: default
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: ListenerSet
name: listenerset
rules:
- backendRefs:
- name: reviews
port: 8080
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: listenerset-route-policy
namespace: default
spec:
targetRefs:
- kind: HTTPRoute
name: listenerset-route
group: gateway.networking.k8s.io
traffic:
timeouts:
request: 5s
---
# Output
output:
- gateway:
Name: listenerset-gw
Namespace: default
resource:
policy:
key: traffic/default/listenerset-route-policy:timeout:default/listenerset-route
name:
kind: AgentgatewayPolicy
name: listenerset-route-policy
namespace: default
target:
route:
kind: HTTPRoute
name: listenerset-route
namespace: default
traffic:
timeout:
request: 5s
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: listenerset-route-policy
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: listenerset-gw
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -0,0 +1,109 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: jwt-mcp
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
jwtAuthentication:
mode: Strict
providers:
- issuer: https://auth.example.com/
audiences:
- my-api
jwks:
inline: |
{
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"use": "sig",
"kid": "test-key",
"alg": "RS256",
"n": "test"
}
]
}
mcp:
provider: Auth0
resourceMetadata:
oauthScopesSupported:
- read
- write
resourceDocumentation: https://docs.example.com/mcp
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/jwt-mcp:jwt:default/test
name:
kind: AgentgatewayPolicy
name: jwt-mcp
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
jwt:
mcp:
provider: AUTH0
resourceMetadata:
extra:
oauthScopesSupported:
- read
- write
resourceDocumentation: https://docs.example.com/mcp
mode: STRICT
providers:
- audiences:
- my-api
inline: |
{
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"use": "sig",
"kid": "test-key",
"alg": "RS256",
"n": "test"
}
]
}
issuer: https://auth.example.com/
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: jwt-mcp
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -267,60 +267,9 @@ status:
status:
ancestors:
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: dummy-oauth
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test1
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test2
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: test3
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake

View File

@ -95,9 +95,9 @@ status:
status:
ancestors:
- ancestorRef:
group: agentgateway.dev
kind: AgentgatewayBackend
name: be
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake

View File

@ -0,0 +1,116 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
- kind: Gateway
name: not-test
group: gateway.networking.k8s.io
- kind: Gateway
name: not-test2
group: gateway.networking.k8s.io
traffic:
retry:
attempts: 2
---
# Output
output:
- gateway:
Name: not-test
Namespace: default
resource:
policy:
key: traffic/default/agw:retry:default/not-test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: not-test
namespace: default
traffic:
retry:
attempts: 2
- gateway:
Name: not-test2
Namespace: default
resource:
policy:
key: traffic/default/agw:retry:default/not-test2
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: not-test2
namespace: default
traffic:
retry:
attempts: 2
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/agw:retry:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
retry:
attempts: 2
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: agw
namespace: default
spec: null
status:
ancestors:
- ancestorRef:
group: agentgateway.dev
name: StatusSummary
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: |-
Policy is not attached: Gateway default/not-test not found
Policy is not attached: Gateway default/not-test2 not found
reason: Pending
status: "False"
type: Attached
controllerName: agentgateway.dev/agentgateway
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test
namespace: default
conditions:
- lastTransitionTime: fake
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -13,7 +13,24 @@ spec:
attempts: 2147483648
---
# Output
output: []
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/agw:retry:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
retry:
attempts: 255
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
@ -30,13 +47,13 @@ status:
namespace: default
conditions:
- lastTransitionTime: fake
message: failed to parse retry attempts should be positive int32 (2147483648)
reason: Invalid
message: Policy accepted
reason: Valid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Policy is not attached due to invalid status
reason: Pending
status: "False"
message: Attached to all targets
reason: Attached
status: "True"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -13,7 +13,23 @@ spec:
attempts: -4
---
# Output
output: []
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/agw:retry:default/test
name:
kind: AgentgatewayPolicy
name: agw
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
retry: {}
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
@ -31,12 +47,7 @@ status:
conditions:
- lastTransitionTime: fake
message: failed to parse retry attempts should be positive int32 (-4)
reason: Invalid
reason: PartiallyValid
status: "True"
type: Accepted
- lastTransitionTime: fake
message: Policy is not attached due to invalid status
reason: Pending
status: "False"
type: Attached
controllerName: agentgateway.dev/agentgateway

View File

@ -1,4 +1,4 @@
package sslutils
package plugins
import (
"crypto/tls"
@ -7,14 +7,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/util/cert"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
)
// Temporary home for constants for conformance testing that are not yet in a released version of Gateway API (https://github.com/kubernetes-sigs/gateway-api/blob/aa1ab6fd282dee4f74eeca803ec48b333297c637/apis/v1/gateway_types.go#L1606-L1614)
const (
ListenerReasonInvalidCACertificateRef gwv1.ListenerConditionReason = "InvalidCACertificateRef"
ListenerReasonInvalidCACertificateKind gwv1.ListenerConditionReason = "InvalidCACertificateKind"
ListenerReasonNoValidCACertificate gwv1.ListenerConditionReason = "NoValidCACertificate"
)
var (
@ -29,16 +21,6 @@ var (
ErrInvalidCACertificate = func(n, ns string, err error) error {
return fmt.Errorf("invalid ca.crt in ConfigMap %s/%s: %v", ns, n, err)
}
ErrVerifySubjectAltNamesRequiresCA = errors.New("verify-subject-alt-names annotation requires a trusted CA to be configured")
ErrInvalidCACertificateRef = errors.New(string(ListenerReasonInvalidCACertificateRef))
ErrInvalidCACertificateKind = errors.New(string(ListenerReasonInvalidCACertificateKind))
ErrInvalidCACertificateKindDetails = func(n, ns, kind string) error {
return fmt.Errorf("invalid ca.crt kind %s in %s/%s: %w", kind, ns, n, ErrInvalidCACertificateKind)
}
ErrMissingCaCertificateRefGrant = errors.New("missing CA certificate reference grant")
)
func ValidateTlsSecretData(n, ns string, sslSecretData map[string][]byte) (cleanedCertChain string, err error) {

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ import (
"istio.io/istio/pkg/slices"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
)
var _ status.WorkerQueue = &TestStatusQueue{}

View File

@ -29,11 +29,12 @@ import (
agwv1alpha1 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/controller"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
func CompareGolden(t test.Failer, content []byte, goldenFile string) {
@ -102,8 +103,7 @@ var timestampRegex = regexp.MustCompile(`lastTransitionTime:.*`)
//
// The output is generally created by running the test with `REFRESH_GOLDEN=true`.
func RunForDirectory[Status any, Output any](t *testing.T, base string, run func(t *testing.T, ctx plugins.PolicyCtx) (Status, []Output)) {
val := apitests.NewAgentgatewayValidator(t)
val.SkipMissing = true
val := apitests.NewAgentgatewayValidatorSkipMissing(t)
defaults, defaultsErr := file.AsString(filepath.Join(base, "_defaults.yaml"))
for _, f := range file.ReadDirOrFail(t, base) {
name := filepath.Base(f)
@ -150,7 +150,7 @@ type testOutput[Status any, Output any] struct {
Output []Output `json:"output"`
}
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *agentgatewaysyncer.Syncer) {
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *syncer.Syncer) {
fc := fake.NewClient(t)
stop := test.NewStop(t)
debugger := new(krt.DebugHandler)
@ -161,7 +161,7 @@ func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (
t.Log(string(b))
}
})
syncer := agentgatewaysyncer.NewAgwSyncer(
syncer := syncer.NewAgwSyncer(
wellknown.DefaultAgwControllerName,
// Only used for NACK, so no need to do anything special here.
fc,
@ -190,7 +190,7 @@ func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (
// agwPluginFactory is a factory function that returns the agent gateway plugins
// It is based on agwPluginFactory(cfg)(ctx, cfg.AgwCollections) in start.go
func agwPluginFactory(agwCollections *plugins.AgwCollections) plugins.AgwPlugin {
agwPlugins := plugins.Plugins(agwCollections)
agwPlugins := controller.Plugins(agwCollections)
mergedPlugins := plugins.MergePlugins(agwPlugins...)
return mergedPlugins
}

View File

@ -218,7 +218,7 @@ func CreateAgwMirrorFilter(
BackendObjectReference: filter.BackendRef,
Weight: &weightOne,
},
}, ns, k, ctx.Backends)
}, ns, k)
if err != nil {
return nil, err
}
@ -258,7 +258,7 @@ func CreateAgwExternalAuthFilter(
BackendObjectReference: filter.BackendRef,
Weight: ptr.Of(int32(1)),
},
}, ns, k, ctx.Backends)
}, ns, k)
if err != nil {
return nil, err
}
@ -545,7 +545,7 @@ func buildAgwGRPCDestination(
Group: "gateway.networking.k8s.io",
Version: "v1",
Kind: "GRPCRoute",
}, ctx.Backends)
})
if err != nil {
logger.Error("error building agent gateway destination", "error", err)
if isInvalidBackend(err) {

View File

@ -421,8 +421,7 @@ func renderAncestorYAML(t *testing.T, parent, target *ancestorRef, routeKind str
}
func TestAncestors(t *testing.T) {
validator := apitests.NewAgentgatewayValidator(t)
validator.SkipMissing = true
validator := apitests.NewAgentgatewayValidatorSkipMissing(t)
parents := []ancestorRef{{
Kind: ancestorListenerSetKind,
Name: "listenerset",

View File

@ -8,7 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// ParentErrorReason is the error string for a ParentError (reason parent could not be referenced)

Some files were not shown because too many files have changed in this diff Show More