Compare commits

...

62 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
358 changed files with 12298 additions and 28836 deletions

View File

@ -12,6 +12,9 @@ updates:
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.

View File

@ -12,6 +12,7 @@ permissions:
jobs:
prepare:
if: github.repository == 'agentgateway/agentgateway'
runs-on: ubuntu-24.04
outputs:
has_commits: ${{ steps.check.outputs.has_commits }}
@ -50,4 +51,6 @@ jobs:
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

@ -16,7 +16,7 @@ env:
CARGO_TERM_COLOR: always
CI: true
RUST_VERSION: "1.93.1"
GO_VERSION: "1.26.1"
GO_VERSION: "1.26.2"
jobs:
#### Proxy jobs ####
@ -24,13 +24,14 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-24.04
validate: true
- os: blacksmith-4vcpu-ubuntu-2404
name: "Proxy Test"
- os: windows-2025
validate: false
name: "Proxy Test (Windows)"
- os: macos-15
validate: false
name: "Proxy Test (Mac)"
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
@ -39,20 +40,25 @@ jobs:
toolchain: "${{ env.RUST_VERSION }}"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
# Github cache is too tiny to handle the full matrix :-(
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
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' }}
- name: Start validation dependencies
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
run: tools/manage-validation-deps.sh start
- name: Test
run: make test
- name: Validate
if: ${{ matrix.validate }}
run: make validate
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: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
@ -88,7 +94,7 @@ jobs:
#### Controller jobs ####
controller-test:
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@ -101,7 +107,7 @@ jobs:
run: go test -race ./...
controller-lint:
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@ -121,7 +127,7 @@ jobs:
run: make generate-apis check-clean-repo
controller-e2e:
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check Runner Info
@ -173,7 +179,7 @@ jobs:
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
controller-conformance:
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust

View File

@ -13,6 +13,11 @@ 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:
@ -24,12 +29,17 @@ on:
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
@ -70,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:
@ -195,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:
@ -325,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:
@ -489,6 +499,7 @@ 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 != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
@ -502,20 +513,24 @@ jobs:
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@ -533,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
@ -549,7 +564,7 @@ jobs:
- name: Upload Artifact
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
@ -563,7 +578,7 @@ jobs:
- push-controller-image
- push-helm-charts
- build
runs-on: ubuntu-24.04
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
env:
@ -578,13 +593,13 @@ 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@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2

464
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ anyhow = "1.0"
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", default-features = false, features = ["default-https-client", "rt-tokio"] }
@ -84,7 +84,7 @@ futures = "0.3"
futures-channel = "0.3"
futures-core = "0.3"
futures-util = "0.3"
google-cloud-auth = { version = "1.7", 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.
@ -106,7 +106,7 @@ hyper-util = { version = "0.1", features = ["full"] }
hyper-util-fork = { path = "crates/hyper-util-fork" }
include_dir = "0.7"
indexmap = { version = "2.13", features = ["serde"] }
insta = { version = "1.46", features = ["json", "redactions", "filters", "yaml"] }
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"] }
@ -114,7 +114,7 @@ lazy_static = "1.5"
libc = "0.2"
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"
@ -170,8 +170,8 @@ serde-untagged = "0.1"
serde_json_path_to_error = "0.1"
serde_regex = "1.1"
serde_yaml = "0.9"
sha1 = "0.10"
sha2 = "0.10"
sha1 = "0.11"
sha2 = "0.11"
shellexpand = "3.1"
socket2 = "0.6"
split-iter = "0.1"
@ -204,7 +204,7 @@ tracing-subscriber = { version = "0.3", features = [
"json",
] }
url = "2.5"
uuid = { version = "1.22", 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"
@ -236,7 +236,7 @@ async-compression = { version = "0.4", features = [
"tokio",
] }
core_affinity = "0.8"
frozen-collections = "0.8"
frozen-collections = "0.9"
heck = "0.5"
macro_rules_attribute = "0.2"

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

@ -831,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

@ -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,28 @@ 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
@ -73,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:
@ -137,10 +145,23 @@ spec:
static:
host: example.com
port: 443
policies:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
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

@ -294,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
@ -419,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

@ -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"
)
@ -417,10 +418,18 @@ type McpSelector struct {
}
// 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 MCP target.
// +required
Host ShortString `json:"host"`
// +optional
Host *ShortString `json:"host,omitempty"`
// `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
@ -443,8 +452,10 @@ type McpTarget struct {
// 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.

View File

@ -35,7 +35,7 @@ type AgentgatewayPolicy struct {
// status defines the current state of AgentgatewayPolicy.
// +optional
Status gwv1.PolicyStatus `json:"status,omitempty"`
Status gwv1.PolicyStatus `json:"status,omitzero"`
// TODO: embed this into a typed Status field when
// https://github.com/kubernetes/kubernetes/issues/131533 is resolved
}
@ -51,6 +51,7 @@ type AgentgatewayPolicyList struct {
// +kubebuilder:validation:XValidation:rule="has(self.traffic) || has(self.frontend) || has(self.backend)",message="At least one of traffic, frontend, or backend must be provided."
// +kubebuilder:validation:XValidation:rule="!has(self.backend) || !has(self.backend.mcp) || ((!has(self.targetRefs) || !self.targetRefs.exists(t, t.kind == 'Service')) && (!has(self.targetSelectors) || !self.targetSelectors.exists(t, t.kind == 'Service')))",message="backend.mcp may not be used with a Service target"
// +kubebuilder:validation:XValidation:rule="!has(self.backend) || !has(self.backend.ai) || ((!has(self.targetRefs) || !self.targetRefs.exists(t, t.kind == 'Service')) && (!has(self.targetSelectors) || !self.targetSelectors.exists(t, t.kind == 'Service')))",message="backend.ai may not be used with a Service target"
// +kubebuilder:validation:XValidation:rule="!(has(self.traffic) && has(self.traffic.jwtAuthentication) && has(self.backend) && has(self.backend.mcp) && has(self.backend.mcp.authentication))",message="traffic.jwtAuthentication may not be used with backend.mcp.authentication in the same policy"
// +kubebuilder:validation:XValidation:rule="has(self.frontend) && has(self.targetRefs) ? self.targetRefs.all(t, t.kind == 'Gateway' && !has(t.sectionName)) : true",message="the 'frontend' field can only target a Gateway"
// +kubebuilder:validation:XValidation:rule="has(self.frontend) && has(self.targetSelectors) ? self.targetSelectors.all(t, t.kind == 'Gateway' && !has(t.sectionName)) : true",message="the 'frontend' field can only target a Gateway"
// +kubebuilder:validation:XValidation:rule="has(self.traffic) && has(self.targetRefs) ? self.targetRefs.all(t, t.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'ListenerSet']) : true",message="the 'traffic' field can only target a Gateway, ListenerSet, GRPCRoute, or HTTPRoute"
@ -219,16 +220,6 @@ type BackendEviction struct {
HealthThreshold *int32 `json:"healthThreshold,omitempty"`
}
// +kubebuilder:validation:AtLeastOneFieldSet
type BackendWithMCP struct {
BackendSimple `json:",inline"`
// `mcp` specifies settings for MCP workloads. This is only applicable when
// connecting to a `Backend` of type `mcp`.
// +optional
MCP *BackendMCP `json:"mcp,omitempty"`
}
// +kubebuilder:validation:AtLeastOneFieldSet
type BackendWithAI struct {
BackendSimple `json:",inline"`
@ -250,6 +241,10 @@ type BackendFull struct {
// `mcp` specifies settings for MCP workloads. This is only applicable when
// connecting to a `Backend` of type `mcp`.
//
// This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
// other policies such as transformation and rate limiting.
//
// +optional
MCP *BackendMCP `json:"mcp,omitempty"`
}
@ -666,15 +661,24 @@ const (
JWTAuthenticationModePermissive JWTAuthenticationMode = "Permissive"
)
// +kubebuilder:validation:XValidation:rule="!has(self.mcp) || size(self.providers) == 1",message="jwtAuthentication.mcp requires exactly one provider"
// +kubebuilder:validation:XValidation:rule="!has(self.mcp) || !has(self.mode) || self.mode == 'Strict'",message="jwtAuthentication.mcp requires mode Strict"
type JWTAuthentication struct {
// `mode` is the validation mode for JWT authentication.
// +kubebuilder:default=Strict
// +optional
Mode JWTAuthenticationMode `json:"mode,omitempty"`
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
// +required
Providers []JWTProvider `json:"providers"`
// `mcp` optionally enables MCP OAuth metadata endpoint handling
// and MCP-specific authentication behavior on top of standard JWT validation.
// When set, the gateway will serve the MCP OAuth metadata discovery endpoints.
// +optional
MCP *JWTMCPConfig `json:"mcp,omitempty"`
}
type JWTProvider struct {
@ -696,6 +700,19 @@ type JWTProvider struct {
JWKS JWKS `json:"jwks"`
}
// JWTMCPConfig holds MCP-specific extensions for JWT authentication.
type JWTMCPConfig struct {
// `resourceMetadata` defines the metadata to use for MCP resources,
// served at the MCP OAuth metadata endpoints.
// +optional
ResourceMetadata map[string]apiextensionsv1.JSON `json:"resourceMetadata,omitempty"`
// `provider` specifies the identity provider to use for MCP authentication flows.
// +kubebuilder:validation:Enum=Auth0;Keycloak
// +optional
Provider *McpIDP `json:"provider,omitempty"`
}
// +kubebuilder:validation:ExactlyOneOf=remote;inline
type JWKS struct {
// `remote` specifies how to reach the JSON Web Key Set from a remote

View File

@ -401,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
@ -1899,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.
@ -1911,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
@ -2147,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)
@ -2159,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

@ -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"
)

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

@ -4,7 +4,7 @@ Name|Version|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.20260313105501-0df655d8a214|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
@ -37,7 +37,7 @@ Name|Version|License
[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-20260320151437-efc2b41130da|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

View File

@ -6773,6 +6773,23 @@ spec:
in-cluster `Service` resources, it is recommended to use `selector`
instead.
properties:
backendRef:
description: |-
`backendRef` references a namespace-local `Service` resource by name.
When set, this replaces `host` only; `port`, `path`, and `protocol`
remain configured on this target.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
host:
description: Host is the hostname or IP address of the
MCP target.
@ -6793,6 +6810,8 @@ spec:
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`.
properties:
auth:
description: '`auth` defines settings for managing
@ -7023,223 +7042,6 @@ spec:
- HTTP2
type: string
type: object
mcp:
description: |-
`mcp` specifies settings for MCP workloads. This is only applicable when
connecting to a `Backend` of type `mcp`.
properties:
authentication:
description: '`authentication` defines `MCPBackend`-specific
authentication rules.'
properties:
audiences:
description: |-
`audiences` specifies the list of allowed audiences that are allowed
access. This corresponds to the `aud` claim
(https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).
If unset, any audience is allowed.
items:
type: string
maxItems: 64
minItems: 1
type: array
issuer:
description: |-
`issuer` identifies the IdP that issued the JWT. This corresponds to the
`iss` claim (https://tools.ietf.org/html/rfc7519#section-4.1.1).
maxLength: 256
minLength: 1
type: string
jwks:
description: |-
`jwks` defines the remote JSON Web Key used to validate the signature of
the JWT.
properties:
backendRef:
description: |-
`backendRef` references the remote JWKS server to reach.
Supported types are `Service` and static `Backend`. An
`AgentgatewayPolicy` containing backend TLS config can then be attached
to the `Service` or `Backend` in order to set TLS options for a
connection to the remote `jwks` source.
properties:
group:
default: ""
description: |-
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: Service
description: |-
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: Name is the name of
the referent.
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
Note that when a namespace different than the local namespace is specified,
a ReferenceGrant object is required in the referent namespace to allow that
namespace's owner to accept the reference. See the ReferenceGrant
documentation for details.
Support: Core
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
port:
description: |-
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format: int32
maximum: 65535
minimum: 1
type: integer
required:
- name
type: object
x-kubernetes-validations:
- message: Must have port for Service
reference
rule: '(size(self.group) == 0 && self.kind
== ''Service'') ? has(self.port)
: true'
cacheDuration:
default: 5m
type: string
x-kubernetes-validations:
- message: invalid duration value
rule: matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')
- message: cacheDuration must be at
least 5m.
rule: duration(self) >= duration('5m')
jwksPath:
description: |-
Path to the IdP `jwks` endpoint, relative to the root, commonly
`".well-known/jwks.json"`.
maxLength: 2000
minLength: 1
type: string
required:
- backendRef
- jwksPath
type: object
mode:
default: Strict
description: '`mode` is the validation mode
for JWT authentication.'
enum:
- Strict
- Optional
- Permissive
type: string
provider:
description: '`provider` specifies the identity
provider to use for authentication.'
enum:
- Auth0
- Keycloak
type: string
resourceMetadata:
additionalProperties:
x-kubernetes-preserve-unknown-fields: true
description: ResourceMetadata defines the
metadata to use for MCP resources.
type: object
required:
- jwks
type: object
authorization:
description: |-
authorization defines MCPBackend level authorization. Unlike authorization at the HTTP level, which will reject
unauthorized requests with a `403` error, this policy works at the
`MCPBackend` level.
List operations, such as `list_tools`, will have each item evaluated.
Items that do not meet the rule will be filtered.
Get or call operations, such as `call_tool`, will evaluate the specific
item and reject requests that do not meet the rule.
properties:
action:
default: Allow
description: |-
`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.
enum:
- Allow
- Deny
- Require
type: string
policy:
description: |-
`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.
properties:
matchExpressions:
description: |-
MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
These expressions should be in the form of a Common Expression Language
(`CEL`) expression.
items:
description: CELExpression represents
a Common Expression Language (CEL)
expression.
maxLength: 16384
minLength: 1
type: string
maxItems: 256
minItems: 1
type: array
required:
- matchExpressions
type: object
required:
- policy
type: object
type: object
x-kubernetes-validations:
- message: at least one of the fields in [authentication
authorization] must be set
rule: '[has(self.authentication),has(self.authorization)].filter(x,x==true).size()
>= 1'
tcp:
description: tcp defines settings for managing TCP
connections to the backend.
@ -7756,12 +7558,6 @@ spec:
- backendRef
type: object
type: object
x-kubernetes-validations:
- message: at least one of the fields in [auth health
http mcp tcp tls transformation tunnel] must be
set
rule: '[has(self.auth),has(self.health),has(self.http),has(self.mcp),has(self.tcp),has(self.tls),has(self.transformation),has(self.tunnel)].filter(x,x==true).size()
>= 1'
port:
description: Port is the port number of the MCP target.
format: int32
@ -7777,9 +7573,15 @@ spec:
- SSE
type: string
required:
- host
- port
type: object
x-kubernetes-validations:
- message: mcp target policies may not be used with backendRef
rule: '!has(self.backendRef) || !has(self.policies)'
- message: exactly one of the fields in [host backendRef]
must be set
rule: '[has(self.host),has(self.backendRef)].filter(x,x==true).size()
== 1'
required:
- name
type: object
@ -12756,6 +12558,9 @@ spec:
description: |-
`mcp` specifies settings for MCP workloads. This is only applicable when
connecting to a `Backend` of type `mcp`.
This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
other policies such as transformation and rate limiting.
properties:
authentication:
description: '`authentication` defines `MCPBackend`-specific

View File

@ -5030,6 +5030,9 @@ spec:
description: |-
`mcp` specifies settings for MCP workloads. This is only applicable when
connecting to a `Backend` of type `mcp`.
This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
other policies such as transformation and rate limiting.
properties:
authentication:
description: '`authentication` defines `MCPBackend`-specific
@ -7612,6 +7615,27 @@ spec:
description: '`jwtAuthentication` authenticates users based on
JWT tokens.'
properties:
mcp:
description: |-
`mcp` optionally enables MCP OAuth metadata endpoint handling
and MCP-specific authentication behavior on top of standard JWT validation.
When set, the gateway will serve the MCP OAuth metadata discovery endpoints.
properties:
provider:
description: '`provider` specifies the identity provider
to use for MCP authentication flows.'
enum:
- Auth0
- Keycloak
type: string
resourceMetadata:
additionalProperties:
x-kubernetes-preserve-unknown-fields: true
description: |-
`resourceMetadata` defines the metadata to use for MCP resources,
served at the MCP OAuth metadata endpoints.
type: object
type: object
mode:
default: Strict
description: '`mode` is the validation mode for JWT authentication.'
@ -7768,6 +7792,11 @@ spec:
required:
- providers
type: object
x-kubernetes-validations:
- message: jwtAuthentication.mcp requires exactly one provider
rule: '!has(self.mcp) || size(self.providers) == 1'
- message: jwtAuthentication.mcp requires mode Strict
rule: '!has(self.mcp) || !has(self.mode) || self.mode == ''Strict'''
phase:
description: |-
The phase to apply the traffic policy to. If the phase is `PreRouting`,
@ -8365,6 +8394,10 @@ spec:
rule: '!has(self.backend) || !has(self.backend.ai) || ((!has(self.targetRefs)
|| !self.targetRefs.exists(t, t.kind == ''Service'')) && (!has(self.targetSelectors)
|| !self.targetSelectors.exists(t, t.kind == ''Service'')))'
- message: traffic.jwtAuthentication may not be used with backend.mcp.authentication
in the same policy
rule: '!(has(self.traffic) && has(self.traffic.jwtAuthentication) &&
has(self.backend) && has(self.backend.mcp) && has(self.backend.mcp.authentication))'
- message: the 'frontend' field can only target a Gateway
rule: 'has(self.frontend) && has(self.targetRefs) ? self.targetRefs.all(t,
t.kind == ''Gateway'' && !has(t.sectionName)) : true'

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 }}

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

@ -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 (
@ -240,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]
@ -262,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
@ -417,15 +417,36 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
authnPolicy := policy.Spec.Backend.MCP.Authentication
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
}
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,
},
},
},
}
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
if authnPolicy.Mode == agentgateway.JWTAuthenticationModeStrict {
@ -451,8 +472,55 @@ func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.Agent
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)
}
@ -467,34 +535,7 @@ 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,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
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
@ -581,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 {

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
@ -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

@ -10,7 +10,7 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
@ -128,7 +128,7 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
var path *string
if tracing.Path != nil {
path = ptr.Of(string(*tracing.Path))
path = ptr.Of(*tracing.Path)
}
var protocol api.FrontendPolicySpec_Tracing_Protocol
@ -212,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{

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 (
@ -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

@ -13,12 +13,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/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)
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)
}
@ -43,29 +44,29 @@ func (e *BackendReferenceError) Error() string {
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) {
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{
return []*api.PolicyTarget{{
Kind: utils.GatewayTarget(namespace, string(name), sectionName),
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
case wellknown.HTTPRouteGVK.GroupKind():
return &api.PolicyTarget{
return []*api.PolicyTarget{{
Kind: utils.RouteTarget(namespace, string(name), wellknown.HTTPRouteGVK.Kind, sectionName),
}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
case wellknown.GRPCRouteGVK.GroupKind():
return &api.PolicyTarget{
return []*api.PolicyTarget{{
Kind: utils.RouteTarget(namespace, string(name), wellknown.GRPCRouteGVK.Kind, sectionName),
}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
case wellknown.AgentgatewayBackendGVK.GroupKind():
return &api.PolicyTarget{
return []*api.PolicyTarget{{
Kind: utils.BackendTarget(namespace, string(name), sectionName),
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
case wellknown.ServiceGVK.GroupKind():
return &api.PolicyTarget{
return []*api.PolicyTarget{{
Kind: utils.ServiceTarget(namespace, string(name), sectionName),
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
}
return nil, false
},
@ -275,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
@ -289,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
@ -314,7 +313,7 @@ func (p ReferenceIndex) WithPolicyAttachments(references krt.IndexCollection[uti
return p
}
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) (*api.PolicyTarget, bool) {
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)
}

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

@ -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) {

View File

@ -32,10 +32,10 @@ import (
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
"github.com/agentgateway/agentgateway/controller/pkg/reports"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const (
@ -135,25 +135,27 @@ func TranslateAgentgatewayPolicy(ctx krt.HandlerContext, policy *agentgateway.Ag
for _, target := range policy.Spec.TargetRefs {
gk := schema.GroupKind{Group: string(target.Group), Kind: string(target.Kind)}
policyTarget, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
if policyTarget == nil {
policyTargets, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
if len(policyTargets) == 0 {
// This should be impossible, verified by CEL validation
logger.Warn("unsupported target kind", "kind", target.Kind, "policy", policy.Name)
continue
}
gatewayTargets := references.LookupGatewaysForTarget(ctx, utils.TypedNamespacedName{
gatewayTargets := references.LookupGatewaysForBackend(ctx, utils.TypedNamespacedName{
NamespacedName: types.NamespacedName{Namespace: policy.Namespace, Name: string(target.Name)},
Kind: gk.Kind,
}).UnsortedList()
translatedPolicies := clonePoliciesForTarget(baseTranslatedPolicies, policyTarget)
for _, translatedPolicy := range translatedPolicies {
for _, gatewayTarget := range gatewayTargets {
agwPolicies = append(agwPolicies, AgwPolicy{
Gateway: ptr.Of(gatewayTarget),
Policy: translatedPolicy,
})
for _, policyTarget := range policyTargets {
translatedPolicies := clonePoliciesForTarget(baseTranslatedPolicies, policyTarget)
for _, translatedPolicy := range translatedPolicies {
for _, gatewayTarget := range gatewayTargets {
agwPolicies = append(agwPolicies, AgwPolicy{
Gateway: ptr.Of(gatewayTarget),
Policy: translatedPolicy,
})
}
}
}
@ -302,7 +304,7 @@ func resolvePolicyAncestorRefs(
NamespacedName: types.NamespacedName{Namespace: policyNamespace, Name: string(targetName)},
Kind: targetGK.Kind,
}
gatewayTargets := references.LookupGatewaysForTarget(ctx, object).UnsortedList()
gatewayTargets := references.LookupGatewaysForBackend(ctx, object).UnsortedList()
if len(gatewayTargets) == 0 {
return nil, fmt.Sprintf("Policy is not attached: %s %s/%s is not attached to any Gateway", targetGK.Kind, policyNamespace, targetName)
}
@ -588,6 +590,19 @@ func processJWTAuthenticationPolicy(ctx PolicyCtx, jwt *agentgateway.JWTAuthenti
}
}
if jwt.MCP != nil {
if len(jwt.Providers) != 1 {
errs = append(errs, fmt.Errorf("jwtAuthentication.mcp requires exactly one provider, found %d", len(jwt.Providers)))
} else {
mcp, err := translateJWTMCPConfig(jwt.MCP)
if err != nil {
errs = append(errs, err)
} else {
p.Mcp = mcp
}
}
}
jwtPolicy := &api.Policy{
Key: basePolicyName + jwtPolicySuffix,
Name: TypedResourceFromName(wellknown.AgentgatewayPolicyGVK.Kind, policy),

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,12 +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/controller"
"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) {
@ -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,

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)

View File

@ -34,9 +34,9 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// ConvertHTTPRouteToAgw converts a HTTPRouteRule to an agentgateway HTTPRoute

View File

@ -22,12 +22,12 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
"github.com/agentgateway/agentgateway/controller/pkg/reports"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
var (

View File

@ -15,7 +15,7 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
)
func TestReferences(t *testing.T) {
@ -66,7 +66,7 @@ func TestBackends(t *testing.T) {
return a.ResourceName()
})
a := ri.Outputs.Addresses.List()
a = slices.SortBy(a, func(a agentgatewaysyncer.Address) string {
a = slices.SortBy(a, func(a syncer.Address) string {
return a.ResourceName()
})
res := []any{}

View File

@ -9,8 +9,8 @@ import (
"k8s.io/apimachinery/pkg/types"
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// Reference stores a reference to a namespaced GVK, as used by ReferencePolicy

View File

@ -28,11 +28,11 @@ import (
agwir "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
"github.com/agentgateway/agentgateway/controller/pkg/reports"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// AgwRouteCollection creates the collection of translated Routes
@ -261,7 +261,7 @@ func ProcessParentReferences[T any](
msg = "Parent listener not usable or not permitted"
} else if parent.OriginalReference.SectionName != nil || parent.OriginalReference.Port != nil {
// Use string literal to avoid compile issues if the constant name differs.
reason = gwv1.RouteConditionReason("NoMatchingParent")
reason = "NoMatchingParent"
msg = "No listener with the specified sectionName on the parent Gateway"
}
pr.SetCondition(reporter.RouteCondition{
@ -352,7 +352,7 @@ func reasonResolvedRefs(cond *reporter.RouteCondition, ok bool) gwv1.RouteCondit
if cond != nil && cond.Reason != "" {
return cond.Reason
}
return gwv1.RouteConditionReason("Invalid")
return "Invalid"
}
// buildAttachedRoutesMapAllowed is the same as buildAttachedRoutesMap,

View File

@ -11,7 +11,7 @@ spec:
- protocol: TCP
port: 9090
targetPort: 9090
appProtocol: kgateway.dev/a2a
appProtocol: agentgateway.dev/a2a
---
# Output
output:

View File

@ -10,11 +10,11 @@ spec:
test: test
ports:
- protocol: TCP
appProtocol: kgateway.dev/mcp
appProtocol: agentgateway.dev/mcp
port: 80
targetPort: test
- protocol: TCP
appProtocol: kgateway.dev/mcp-sse
appProtocol: agentgateway.dev/mcp-sse
port: 90
targetPort: test-2
---

View File

@ -0,0 +1,64 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
namespace: default
name: mcp-service-backendref
spec:
mcp:
targets:
- name: explicit-service
static:
backendRef:
name: mcp-service-http
port: 9090
---
apiVersion: v1
kind: Service
metadata:
name: mcp-service-http
namespace: default
spec:
ports:
- name: mcp-http
port: 9090
appProtocol: agentgateway.dev/mcp
---
# Output
output:
- gateway:
Name: basic
Namespace: default
resource:
backend:
key: default/mcp-service-backendref
mcp:
targets:
- backend:
port: 9090
service:
hostname: mcp-service-http.default.svc.cluster.local
namespace: default
name: explicit-service
name:
name: mcp-service-backendref
namespace: default
- canonical: true
hostname: mcp-service-http.default.svc.cluster.local
name: mcp-service-http
namespace: default
ports:
- servicePort: 9090
status:
- apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-service-backendref
namespace: default
spec: null
status:
conditions:
- lastTransitionTime: fake
message: Backend successfully accepted
reason: Accepted
status: "True"
type: Accepted

View File

@ -21,12 +21,12 @@ metadata:
labels:
app: mcp-server
annotations:
kgateway.dev/mcp-http-path: /custom-path
agentgateway.dev/mcp-http-path: /custom-path
spec:
ports:
- name: mcp
port: 8080
appProtocol: kgateway.dev/mcp-sse
appProtocol: agentgateway.dev/mcp-sse
---
# Output
output:

View File

@ -23,7 +23,7 @@ spec:
ports:
- name: mcp-http
port: 9090
appProtocol: kgateway.dev/mcp
appProtocol: agentgateway.dev/mcp
---
# Output
output:

View File

@ -6,13 +6,13 @@ metadata:
labels:
app: mcp-app
annotations:
kgateway.dev/mcp-path: /test
agentgateway.dev/mcp-path: /test
spec:
selector:
test: test
ports:
- protocol: TCP
appProtocol: kgateway.dev/mcp
appProtocol: agentgateway.dev/mcp
port: 80
targetPort: test
---

View File

@ -0,0 +1,104 @@
apiVersion: v1
kind: Service
metadata:
name: processor
namespace: default
spec:
selector:
app: processor
ports:
- protocol: TCP
port: 9002
targetPort: 9002
---
apiVersion: v1
kind: Secret
metadata:
name: client-tls
namespace: default
type: kubernetes.io/tls
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiakNDQVJPZ0F3SUJBZ0lVTFpDLzFkMEhpMlRFUGk5MUtwamVZbzgzZ1pBd0NnWUlLb1pJemowRUF3SXcKRERFS01BZ0dBMVVFQXd3QllUQWVGdzB5TlRFeE1qVXlNRFE0TURLYUZ3MHlOVEV4TWpZeU1EUTRNREphTUF3eApDakFJQmdOVkJBTU1BV0V3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVIvc1UybWRnbkhab2Z6CmR0b0tRZm5FMWdrVE9HY2JJaWFUeDdXUGpZcXF1c1p5ZWYybTBpbkgrcnJVRFBJY2tTRlQ5dnlzRVJFVTBKcGMKL3JTZmVVOG9vMU13VVRBZEJnTlZIUTRFRmdRVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dId1lEVlIwagpCQmd3Rm9BVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxCmhrak9QUVFEQWdOSkFEQkdBaUVBcW9ISTVENUt2VFR4YVVubW1mc0Nzem1vazZWR0dsZ3hpVm5HVmpKNHJ5VUMKSVFENExVcTRZMjVPbG4zQnNlbE1nT0M5VWNFS3dLRGlOTDZlMkc4S09EcU0wZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUxRblhESm5qZFRianhhV2NKQkJOK0FDVjh3UDRxR3RZdVA0VjdZSXdJdGRvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFZjdGTnBuWUp4MmFIODNiYUNrSDV4TllKRXpobkd5SW1rOGUxajQyS3Fyckdjbm45cHRJcAp4L3E2MUF6eUhKRWhVL2I4ckJFUkZOQ2FYUDYwbjNsUEtBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
---
# ext-proc policy targets Gateway, with backendRef to processor Service
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: ext-proc
namespace: default
spec:
targetRefs:
- kind: Gateway
name: test
group: gateway.networking.k8s.io
traffic:
phase: PreRouting
extProc:
backendRef:
name: processor
port: 9002
---
# backend TLS policy targets the processor Service (not the Gateway)
# This should still be associated with the gateway via the ext-proc policy's backendRef
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: processor-backend-tls
namespace: default
spec:
targetRefs:
- kind: Service
name: processor
group: ""
backend:
tls:
mtlsCertificateRef:
- name: client-tls
sni: processor.default.svc.cluster.local
---
# Output
output:
- gateway:
Name: test
Namespace: default
resource:
policy:
backend:
backendTls:
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiakNDQVJPZ0F3SUJBZ0lVTFpDLzFkMEhpMlRFUGk5MUtwamVZbzgzZ1pBd0NnWUlLb1pJemowRUF3SXcKRERFS01BZ0dBMVVFQXd3QllUQWVGdzB5TlRFeE1qVXlNRFE0TURLYUZ3MHlOVEV4TWpZeU1EUTRNREphTUF3eApDakFJQmdOVkJBTU1BV0V3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVIvc1UybWRnbkhab2Z6CmR0b0tRZm5FMWdrVE9HY2JJaWFUeDdXUGpZcXF1c1p5ZWYybTBpbkgrcnJVRFBJY2tTRlQ5dnlzRVJFVTBKcGMKL3JTZmVVOG9vMU13VVRBZEJnTlZIUTRFRmdRVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dId1lEVlIwagpCQmd3Rm9BVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxCmhrak9QUVFEQWdOSkFEQkdBaUVBcW9ISTVENUt2VFR4YVVubW1mc0Nzem1vazZWR0dsZ3hpVm5HVmpKNHJ5VUMKSVFENExVcTRZMjVPbG4zQnNlbE1nT0M5VWNFS3dLRGlOTDZlMkc4S09EcU0wZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
hostname: processor.default.svc.cluster.local
key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUxRblhESm5qZFRianhhV2NKQkJOK0FDVjh3UDRxR3RZdVA0VjdZSXdJdGRvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFZjdGTnBuWUp4MmFIODNiYUNrSDV4TllKRXpobkd5SW1rOGUxajQyS3Fyckdjbm45cHRJcAp4L3E2MUF6eUhKRWhVL2I4ckJFUkZOQ2FYUDYwbjNsUEtBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
key: default/processor-backend-tls:tls:default/processor.default.svc.cluster.local
name:
kind: AgentgatewayPolicy
name: processor-backend-tls
namespace: default
target:
service:
hostname: processor.default.svc.cluster.local
namespace: default
- gateway:
Name: test
Namespace: default
resource:
policy:
key: traffic/default/ext-proc:extproc:default/test
name:
kind: AgentgatewayPolicy
name: ext-proc
namespace: default
target:
gateway:
name: test
namespace: default
traffic:
extProc:
target:
port: 9002
service:
hostname: processor.default.svc.cluster.local
namespace: default
phase: GATEWAY
status: []

View File

@ -0,0 +1,78 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-route
namespace: default
spec:
parentRefs:
- name: test-gateway
hostnames:
- example.com
rules:
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: be
namespace: other
kind: AgentgatewayBackend
group: agentgateway.dev
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: be
namespace: other
spec:
static:
host: primary.example.com
port: 80
---
# Output
output:
- gateway:
Name: test-gateway
Namespace: default
resource:
route:
backends:
- weight: 1
hostnames:
- example.com
key: default/test-route.00.http
listenerKey: default/test-gateway.http
matches:
- path:
pathPrefix: /api
name:
kind: HTTPRoute
name: test-route
namespace: default
status:
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-route
namespace: default
spec: null
status:
parents:
- conditions:
- lastTransitionTime: fake
message: ""
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: fake
message: backendRef be/other not accessible to a HTTPRoute in namespace "default"
(missing a ReferenceGrant?)
reason: RefNotPermitted
status: "False"
type: ResolvedRefs
controllerName: agentgateway.dev/agentgateway
parentRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test-gateway
namespace: default

View File

@ -0,0 +1,78 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-route
namespace: default
spec:
parentRefs:
- name: test-gateway
hostnames:
- example.com
rules:
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: be
kind: AgentgatewayBackend
group: agentgateway.dev
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: be
namespace: default
spec:
static:
host: primary.example.com
port: 80
---
# Output
output:
- gateway:
Name: test-gateway
Namespace: default
resource:
route:
backends:
- backend:
backend: default/be
weight: 1
hostnames:
- example.com
key: default/test-route.00.http
listenerKey: default/test-gateway.http
matches:
- path:
pathPrefix: /api
name:
kind: HTTPRoute
name: test-route
namespace: default
status:
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: test-route
namespace: default
spec: null
status:
parents:
- conditions:
- lastTransitionTime: fake
message: ""
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: fake
message: ""
reason: ResolvedRefs
status: "True"
type: ResolvedRefs
controllerName: agentgateway.dev/agentgateway
parentRef:
group: gateway.networking.k8s.io
kind: Gateway
name: test-gateway
namespace: default

View File

@ -18,9 +18,9 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/client/clientset/versioned"
"github.com/agentgateway/agentgateway/controller/pkg/client/clientset/versioned/fake"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
"github.com/agentgateway/agentgateway/controller/test/testutils"
)

View File

@ -0,0 +1,17 @@
package apiclient
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
)
// SecretsFieldSelector is an optimization to avoid excessive secret bloat.
// We only care about TLS certificates.
// Unfortunately, it is not as simple as selecting type=kubernetes.io/tls; we support generic types.
// Its also likely users have started to use random types and expect them to continue working.
// This makes the assumption we will never care about Helm secrets or SA token secrets - two common
// large secrets in clusters.
// This is a best effort optimization only; the code would behave correctly if we watched all secrets.
var SecretsFieldSelector = fields.AndSelectors(
fields.OneTermNotEqualSelector("type", "helm.sh/release.v1"),
fields.OneTermNotEqualSelector("type", string(corev1.SecretTypeServiceAccountToken))).String()

View File

@ -10,7 +10,7 @@ import (
"k8s.io/apimachinery/pkg/watch"
agwv1alpha1 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// RegisterTypes registers all the types used by our API Client

View File

@ -1,21 +1,18 @@
package controller
import (
"context"
"time"
"golang.org/x/time/rate"
"istio.io/istio/pkg/kube/kubetypes"
"k8s.io/client-go/util/workqueue"
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
"sigs.k8s.io/controller-runtime/pkg/manager"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
internaldeployer "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
)
// rateLimiter uses token bucket for overall rate limiting and exponential backoff for per-item rate limiting
@ -25,12 +22,9 @@ var rateLimiter = workqueue.NewTypedMaxOfRateLimiter(
&workqueue.TypedBucketRateLimiter[any]{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
)
// TODO [danehans]: Refactor so controller config is organized into shared and Gateway/InferencePool-specific controllers.
type GatewayConfig struct {
Client apiclient.Client
Mgr manager.Manager
// Dev enables development mode for the controller.
Dev bool
// AgwControllerName is the name of the agentgateway controller. Any GatewayClass objects
// managed by this controller must have this name as their ControllerName.
AgwControllerName string
@ -38,12 +32,8 @@ type GatewayConfig struct {
ImageDefaults *agentgateway.Image
// ControlPlane sets the default control plane information the deployer will use.
ControlPlane deployer.ControlPlaneInfo
// ImageInfo sets the default image information the deployer will use.
ImageInfo *deployer.ImageInfo
// DiscoveryNamespaceFilter filters namespaced objects based on the discovery namespace filter.
DiscoveryNamespaceFilter kubetypes.DynamicObjectFilter
// CommonCollections used to fetch ir.Gateways for the deployer to generate the ports for the proxy service
CommonCollections *collections.CommonCollections
// AgwCollections used to fetch ir.Gateways for the deployer to generate the ports for the proxy service
AgwCollections *agwplugins.AgwCollections
// AgentgatewayClassName is the configured agent gateway class name.
AgentgatewayClassName string
// Additional GatewayClass definitions to support extending to other well-known gateway classes
@ -55,7 +45,6 @@ type GatewayConfig struct {
type HelmValuesGeneratorOverrideFunc func(inputs *deployer.Inputs) deployer.HelmValuesGenerator
func NewBaseGatewayController(
ctx context.Context,
cfg GatewayConfig,
classInfos map[string]*deployer.GatewayClassInfo,
helmValuesGeneratorOverride HelmValuesGeneratorOverrideFunc,
@ -88,22 +77,20 @@ func watchGw(
)
inputs := &deployer.Inputs{
Dev: cfg.Dev,
ImageDefaults: cfg.ImageDefaults,
ControlPlane: cfg.ControlPlane,
NoListenersDummyPort: cfg.CommonCollections.Settings.NoListenersDummyPort,
ImageInfo: cfg.ImageInfo,
CommonCollections: cfg.CommonCollections,
NoListenersDummyPort: cfg.AgwCollections.Settings.NoListenersDummyPort,
AgwCollections: cfg.AgwCollections,
AgentgatewayClassName: cfg.AgentgatewayClassName,
AgentgatewayControllerName: cfg.AgwControllerName,
}
gwParams := internaldeployer.NewGatewayParameters(cfg.Client, inputs)
gwParams := deployer.NewGatewayParameters(cfg.Client, inputs)
if helmValuesGeneratorOverride != nil {
gwParams.WithHelmValuesGeneratorOverride(helmValuesGeneratorOverride(inputs))
}
d, err := internaldeployer.NewGatewayDeployer(
d, err := deployer.NewGatewayDeployer(
cfg.AgwControllerName,
cfg.AgentgatewayClassName,
cfg.Mgr.GetScheme(),

View File

@ -22,9 +22,9 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/reports"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
var _ manager.LeaderElectionRunnable = (*gatewayClassReconciler)(nil)

View File

@ -31,14 +31,14 @@ import (
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
internaldeployer "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
"github.com/agentgateway/agentgateway/controller/pkg/reports"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
var logger = logging.New("gateway-controller")
@ -47,7 +47,7 @@ var _ manager.LeaderElectionRunnable = (*gatewayReconciler)(nil)
type gatewayReconciler struct {
deployer *deployer.Deployer
gwParams *internaldeployer.GatewayParameters
gwParams *deployer.GatewayParameters
scheme *runtime.Scheme
agwControllerName string
@ -69,7 +69,7 @@ type gatewayReconciler struct {
func NewGatewayReconciler(
cfg GatewayConfig,
deployer *deployer.Deployer,
gwParams *internaldeployer.GatewayParameters,
gwParams *deployer.GatewayParameters,
controllerExtension pluginsdk.GatewayControllerExtension,
) *gatewayReconciler {
filter := kclient.Filter{ObjectFilter: cfg.Client.ObjectFilter()}
@ -87,7 +87,10 @@ func NewGatewayReconciler(
deploymentClient: kclient.NewFiltered[*appsv1.Deployment](cfg.Client, filter),
svcAccountClient: kclient.NewFiltered[*corev1.ServiceAccount](cfg.Client, filter),
configMapClient: kclient.NewFiltered[*corev1.ConfigMap](cfg.Client, filter),
secretClient: kclient.NewFiltered[*corev1.Secret](cfg.Client, filter),
secretClient: kclient.NewFiltered[*corev1.Secret](cfg.Client, kclient.Filter{
FieldSelector: apiclient.SecretsFieldSelector,
ObjectFilter: cfg.Client.ObjectFilter(),
}),
}
// Reuse the parameter clients from the deployer to avoid duplicate watches
@ -207,7 +210,7 @@ func NewGatewayReconciler(
// this is necessary for two reasons:
// 1. we don't Fetch() the GatewayForDeployer, so we must reconcile to prevent a stale reference
// 2. if a ListenerSet adds a port to a GatewayForDeployer, we need to deploy the new ports
cfg.CommonCollections.GatewaysForDeployer.Register(func(o krt.Event[collections.GatewayForDeployer]) {
cfg.AgwCollections.GatewaysForDeployer.Register(func(o krt.Event[collections.GatewayForDeployer]) {
gw := o.Latest()
ref := types.NamespacedName{Namespace: gw.Namespace, Name: gw.Name}
logger.Debug("explicitly reconciling Gateway for deployer due to GatewayForDeployer change", "ref", ref)
@ -303,7 +306,7 @@ func (r *gatewayReconciler) Reconcile(req types.NamespacedName) (rErr error) {
ctx := context.Background()
objs, err := r.deployer.GetObjsToDeploy(ctx, gw)
if err != nil {
if errors.Is(err, internaldeployer.ErrNoValidPorts) {
if errors.Is(err, deployer.ErrNoValidPorts) {
// status is reported from translator, so return normally
return err
}

View File

@ -6,7 +6,6 @@ import (
"log/slog"
"maps"
"net/http"
"sync/atomic"
"istio.io/istio/pkg/kube/krt"
istiolog "istio.io/istio/pkg/log"
@ -24,20 +23,16 @@ import (
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
agentgatewaybackend "github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/backend"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/backend"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/utils/namespaces"
"github.com/agentgateway/agentgateway/controller/pkg/version"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// TLSRootCAPath is the path to the TLS root CA
const TLSRootCAPath = "/etc/xds-tls/ca.crt"
type SetupOpts struct {
KrtDebugger *krt.DebugHandler
@ -73,29 +68,25 @@ type StartConfig struct {
Client apiclient.Client
AgwCollections *agwplugins.AgwCollections
CommonCollections *collections.CommonCollections
AgwCollections *agwplugins.AgwCollections
KrtOptions krtutil.KrtOptions
ExtraAgwResourceStatusHandlers map[schema.GroupVersionKind]agentgatewaysyncer.ResourceStatusSyncer
ExtraAgwResourceStatusHandlers map[schema.GroupVersionKind]syncer.ResourceStatusSyncer
// GatewayControllerExtension is an extension that can be used to extend Gateway controller
GatewayControllerExtension pluginsdk.GatewayControllerExtension
// AgentgatewaySyncerOptions is the list of options to be passed when creating the AgentGatewaySyncer
AgentgatewaySyncerOptions []agentgatewaysyncer.AgentgatewaySyncerOption
AgentgatewaySyncerOptions []syncer.AgentgatewaySyncerOption
}
// Start runs the controllers responsible for processing the K8s Gateway API objects
// It is intended to be run in a goroutine as the function will block until the supplied
// context is cancelled
type ControllerBuilder struct {
agwSyncer *agentgatewaysyncer.Syncer
agwSyncer *syncer.Syncer
cfg StartConfig
mgr ctrl.Manager
commoncol *collections.CommonCollections
ready atomic.Bool
}
func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuilder, error) {
@ -122,7 +113,7 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
gvks = append(gvks, gvk)
}
agwSyncer := agentgatewaysyncer.NewAgwSyncer(
agwSyncer := syncer.NewAgwSyncer(
cfg.AgwControllerName,
cfg.Client,
cfg.AgwCollections,
@ -138,14 +129,14 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
return nil, err
}
agwStatusSyncer := agentgatewaysyncer.NewAgwStatusSyncer(
agwStatusSyncer := syncer.NewAgwStatusSyncer(
cfg.AgwControllerName,
cfg.AgentgatewayClassName,
cfg.Client,
agwSyncer.StatusCollections(),
agwSyncer.CacheSyncs(),
cfg.ExtraAgwResourceStatusHandlers,
cfg.CommonCollections.Settings.EnableInferExt,
cfg.AgwCollections.Settings.EnableInferExt,
)
if err := cfg.Manager.Add(agwStatusSyncer); err != nil {
setupLog.Error(err, "unable to add agentgateway StatusSyncer runnable")
@ -157,7 +148,6 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
agwSyncer: agwSyncer,
cfg: cfg,
mgr: cfg.Manager,
commoncol: cfg.CommonCollections,
}
// wait for the ControllerBuilder to Start
@ -195,7 +185,7 @@ func agwPluginFactory(cfg StartConfig) func(ctx context.Context, agw *agwplugins
}
}
func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Syncer, error) {
func (c *ControllerBuilder) Build() (*syncer.Syncer, error) {
slog.Info("creating gateway controllers")
globalSettings := c.cfg.SetupOpts.GlobalSettings
@ -239,20 +229,13 @@ func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Sync
XdsTLS: globalSettings.XdsTLS,
XdsTlsCaPath: apisettings.TLSRootCAPath,
},
ImageInfo: &deployer.ImageInfo{
Registry: globalSettings.DefaultImageRegistry,
Tag: globalSettings.DefaultImageTag,
PullPolicy: globalSettings.DefaultImagePullPolicy,
},
DiscoveryNamespaceFilter: c.cfg.Client.ObjectFilter(),
CommonCollections: c.commoncol,
AgentgatewayClassName: c.cfg.AgentgatewayClassName,
CertWatcher: c.cfg.SetupOpts.CertWatcher,
AgwCollections: c.cfg.AgwCollections,
AgentgatewayClassName: c.cfg.AgentgatewayClassName,
CertWatcher: c.cfg.SetupOpts.CertWatcher,
}
setupLog.Info("creating base gateway controller")
if err := NewBaseGatewayController(
ctx,
gwCfg,
c.cfg.GatewayClassInfos,
c.cfg.HelmValuesGeneratorOverride,
@ -262,10 +245,6 @@ func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Sync
return nil, err
}
// TODO (dmitri-d) don't think c.ready field is used anywhere and can be removed
// mgr WaitForCacheSync is part of proxySyncer's HasSynced
// so we can mark ready here before we call mgr.Start
c.ready.Store(true)
return c.agwSyncer, nil
}

View File

@ -19,11 +19,11 @@ import (
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/deployer/strategicpatch"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
const sessionKeyEnvVar = "SESSION_KEY"
@ -54,7 +54,7 @@ func setIfNonZero[T comparable](dst *T, src T) {
// ApplyToHelmValues applies the AgentgatewayParameters configs to the helm
// values. This is called before rendering the helm chart. (We render a helm
// chart, but we do not use helm beyond that point.)
func (a *AgentgatewayParametersApplier) ApplyToHelmValues(vals *deployer.HelmConfig) {
func (a *AgentgatewayParametersApplier) ApplyToHelmValues(vals *HelmConfig) {
if a.params == nil || vals == nil || vals.Agentgateway == nil {
return
}
@ -167,18 +167,21 @@ type agentgatewayParametersHelmValuesGenerator struct {
agwParamClient kclient.Client[*agentgateway.AgentgatewayParameters]
gwClassClient kclient.Client[*gwv1.GatewayClass]
secretClient kclient.Client[*corev1.Secret]
inputs *deployer.Inputs
inputs *Inputs
sessionKeyGen func() (string, error)
}
func newAgentgatewayParametersHelmValuesGenerator(cli apiclient.Client, inputs *deployer.Inputs) *agentgatewayParametersHelmValuesGenerator {
func newAgentgatewayParametersHelmValuesGenerator(cli apiclient.Client, inputs *Inputs) *agentgatewayParametersHelmValuesGenerator {
filter := kclient.Filter{ObjectFilter: cli.ObjectFilter()}
return &agentgatewayParametersHelmValuesGenerator{
agwParamClient: kclient.NewFilteredDelayed[*agentgateway.AgentgatewayParameters](cli, wellknown.AgentgatewayParametersGVR, filter),
gwClassClient: kclient.NewFilteredDelayed[*gwv1.GatewayClass](cli, wellknown.GatewayClassGVR, filter),
secretClient: kclient.NewFiltered[*corev1.Secret](cli, filter),
inputs: inputs,
sessionKeyGen: generateSessionKey,
secretClient: kclient.NewFiltered[*corev1.Secret](cli, kclient.Filter{
FieldSelector: apiclient.SecretsFieldSelector,
ObjectFilter: cli.ObjectFilter(),
}),
inputs: inputs,
sessionKeyGen: generateSessionKey,
}
}
@ -218,7 +221,7 @@ func (g *agentgatewayParametersHelmValuesGenerator) GetValues(ctx context.Contex
}
var jsonVals map[string]any
err = deployer.JsonConvert(vals, &jsonVals)
err = JsonConvert(vals, &jsonVals)
return jsonVals, err
}
@ -296,7 +299,7 @@ func usesManagedSessionKeyResolvedParameters(resolved *resolvedParameters) bool
return usesManagedSessionKeyEnv(envs)
}
func applyManagedSessionKeyDefaults(gtw *deployer.AgentgatewayHelmGateway, gatewayName string) {
func applyManagedSessionKeyDefaults(gtw *AgentgatewayHelmGateway, gatewayName string) {
if gtw == nil {
return
}
@ -319,7 +322,7 @@ func (g *agentgatewayParametersHelmValuesGenerator) GetCacheSyncHandlers() []cac
func (g *agentgatewayParametersHelmValuesGenerator) GetResolvedParametersForGateway(gw *gwv1.Gateway) (*resolvedParameters, error) {
return g.resolveParameters(gw)
}
func DefaultGatewayIRGetter(gw *gwv1.Gateway, commonCollections *collections.CommonCollections) *collections.GatewayForDeployer {
func DefaultGatewayIRGetter(gw *gwv1.Gateway, agwCollections *agwplugins.AgwCollections) *collections.GatewayForDeployer {
gwKey := collections.ObjectSource{
Group: wellknown.GatewayGVK.GroupKind().Group,
Kind: wellknown.GatewayGVK.GroupKind().Kind,
@ -327,33 +330,33 @@ func DefaultGatewayIRGetter(gw *gwv1.Gateway, commonCollections *collections.Com
Namespace: gw.GetNamespace(),
}
irGW := commonCollections.GatewaysForDeployer.GetKey(gwKey.ResourceName())
irGW := agwCollections.GatewaysForDeployer.GetKey(gwKey.ResourceName())
if irGW == nil {
// If its not in the IR we cannot tell, so need to make a guess.
controllerNameGuess := commonCollections.AgentgatewayControllerName
controllerNameGuess := agwCollections.ControllerName
irGW = GatewayIRFrom(gw, controllerNameGuess)
}
return irGW
}
func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmValues(gw *gwv1.Gateway) (*deployer.HelmConfig, error) {
irGW := DefaultGatewayIRGetter(gw, g.inputs.CommonCollections)
ports := deployer.GetPortsValues(irGW, int32(g.inputs.NoListenersDummyPort))
func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmValues(gw *gwv1.Gateway) (*HelmConfig, error) {
irGW := DefaultGatewayIRGetter(gw, g.inputs.AgwCollections)
ports := GetPortsValues(irGW, int32(g.inputs.NoListenersDummyPort))
if len(ports) == 0 {
return nil, ErrNoValidPorts
}
gtw := &deployer.AgentgatewayHelmGateway{
gtw := &AgentgatewayHelmGateway{
Name: &gw.Name,
GatewayClassName: func() *string {
s := string(gw.Spec.GatewayClassName)
return &s
}(),
Ports: ports,
Xds: &deployer.HelmXds{
Xds: &HelmXds{
Host: &g.inputs.ControlPlane.XdsHost,
Port: &g.inputs.ControlPlane.AgwXdsPort,
Tls: &deployer.HelmXdsTls{
Tls: &HelmXdsTls{
Enabled: func() *bool { b := g.inputs.ControlPlane.XdsTLS; return &b }(),
CaCert: &g.inputs.ControlPlane.XdsTlsCaPath,
},
@ -372,13 +375,13 @@ func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmVa
PullPolicy: nil,
}
gtw.Service = &deployer.AgentgatewayHelmService{}
gtw.Service = &AgentgatewayHelmService{}
// Extract loadBalancerIP from Gateway.spec.addresses and set it on the service
if err := deployer.SetLoadBalancerIPFromGatewayForAgentgateway(gw, gtw.Service); err != nil {
if err := SetLoadBalancerIPFromGatewayForAgentgateway(gw, gtw.Service); err != nil {
return nil, err
}
return &deployer.HelmConfig{Agentgateway: gtw}, nil
return &HelmConfig{Agentgateway: gtw}, nil
}
func gatewaySessionKeySecretName(gatewayName string) string {

View File

@ -21,7 +21,6 @@ import (
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
)
func newSyncedSecretClient(t *testing.T, objects ...client.Object) kclient.Client[*corev1.Secret] {
@ -51,8 +50,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Image(t *testing.T) {
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)
@ -82,8 +81,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Resources(t *testing.T)
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)
@ -106,8 +105,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Env(t *testing.T) {
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)
@ -130,8 +129,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_PreservesSessionKeyEnvV
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)
@ -143,7 +142,7 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_PreservesSessionKeyEnvV
}
func TestApplyManagedSessionKeyDefaults_UsesUserProvidedSessionKey(t *testing.T) {
vals := &deployer.AgentgatewayHelmGateway{
vals := &AgentgatewayHelmGateway{
AgentgatewayParametersConfigs: agentgateway.AgentgatewayParametersConfigs{
Env: []corev1.EnvVar{
{Name: "SESSION_KEY", Value: "inline-key"},
@ -264,8 +263,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_RawConfig(t *testing.T)
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)
@ -310,8 +309,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_NoAliasing(t *testing.T
origGWCLimits := gatewayClassAGWP.Spec.Resources.Limits.DeepCopy()
// Apply GatewayClass first, then Gateway — same order as GetValues.
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
NewAgentgatewayParametersApplier(gatewayClassAGWP).ApplyToHelmValues(vals)
NewAgentgatewayParametersApplier(gatewayAGWP).ApplyToHelmValues(vals)
@ -356,8 +355,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_RawConfigWithLogging(t
}
applier := NewAgentgatewayParametersApplier(params)
vals := &deployer.HelmConfig{
Agentgateway: &deployer.AgentgatewayHelmGateway{},
vals := &HelmConfig{
Agentgateway: &AgentgatewayHelmGateway{},
}
applier.ApplyToHelmValues(vals)

View File

@ -25,9 +25,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"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/utils/kubeutils"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
var logger = logging.New("deployer")

View File

@ -4,14 +4,13 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
)
func NewGatewayDeployer(agwControllerName, agwGatewayClassName string, scheme *runtime.Scheme, client apiclient.Client, gwParams *GatewayParameters, opts ...deployer.Option) (*deployer.Deployer, error) {
func NewGatewayDeployer(agwControllerName, agwGatewayClassName string, scheme *runtime.Scheme, client apiclient.Client, gwParams *GatewayParameters, opts ...Option) (*Deployer, error) {
agentgatewayChart, err := LoadAgentgatewayChart()
if err != nil {
return nil, err
}
return deployer.NewDeployerWithMultipleCharts(
return NewDeployerWithMultipleCharts(
agwControllerName, agwGatewayClassName, scheme, client, agentgatewayChart, gwParams, GatewayReleaseNameAndNamespace, opts...), nil
}

View File

@ -16,14 +16,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
deployerinternal "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
var scheme = schemes.DefaultScheme()
@ -40,7 +37,7 @@ func TestDeployObjs(t *testing.T) {
getDeployer := func(t *testing.T, fc apiclient.Client, patcher deployer.Patcher) *deployer.Deployer {
t.Helper()
d, err := deployerinternal.NewGatewayDeployer(
d, err := deployer.NewGatewayDeployer(
wellknown.DefaultAgwControllerName,
wellknown.DefaultAgwClassName,
scheme,
@ -198,7 +195,7 @@ func TestPruneRemovedResources(t *testing.T) {
getDeployer := func(t *testing.T, fc apiclient.Client) *deployer.Deployer {
t.Helper()
d, err := deployerinternal.NewGatewayDeployer(
d, err := deployer.NewGatewayDeployer(
wellknown.DefaultAgwControllerName,
wellknown.DefaultAgwClassName,
scheme,

View File

@ -1,19 +0,0 @@
package deployer
import (
"errors"
"fmt"
)
var (
GatewayParametersError = errors.New("could not retrieve GatewayParameters")
GetGatewayParametersForGatewayError = func(err error, gwpNamespace, gwpName, gwNamespace, gwName, resourceType string) error {
return fmt.Errorf("(%s.%s) for %s (%s.%s): %w",
gwpNamespace, gwpName, resourceType, gwNamespace, gwName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err))
}
GetGatewayParametersForGatewayClassError = func(err error, gwpNamespace, gwpName, gwcName, resourceType string) error {
return fmt.Errorf("(%s.%s) for %s (%s): %w",
gwpNamespace, gwpName, resourceType, gwcName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err))
}
NilDeployerInputsErr = errors.New("nil inputs to NewDeployer")
)

View File

@ -1,18 +1,35 @@
package deployer
import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"log/slog"
"strings"
"helm.sh/helm/v3/pkg/chart"
"istio.io/istio/pkg/kube/kclient"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/helm"
)
// Inputs is the set of options used to configure gateway/inference pool deployment.
type Inputs struct {
Dev bool
ImageDefaults *agentgateway.Image
ControlPlane ControlPlaneInfo
NoListenersDummyPort uint16
ImageInfo *ImageInfo
CommonCollections *collections.CommonCollections
AgwCollections *agwplugins.AgwCollections
AgentgatewayClassName string
AgentgatewayControllerName string
}
@ -24,3 +41,220 @@ type InMemoryGatewayParametersConfig struct {
AgwControllerName string
OmitDefaultSecurityContext bool
}
var (
// ErrNoValidPorts is returned when no valid ports are found for the Gateway
ErrNoValidPorts = errors.New("no valid ports")
)
const sessionKeyChecksumAnnotation = "checksum/session-key"
func NewGatewayParameters(cli apiclient.Client, inputs *Inputs) *GatewayParameters {
gp := &GatewayParameters{
inputs: inputs,
agwHelmValuesGenerator: newAgentgatewayParametersHelmValuesGenerator(cli, inputs),
}
return gp
}
type GatewayParameters struct {
inputs *Inputs
helmValuesGeneratorOverride HelmValuesGenerator
agwHelmValuesGenerator *agentgatewayParametersHelmValuesGenerator
}
func (gp *GatewayParameters) WithHelmValuesGeneratorOverride(generator HelmValuesGenerator) *GatewayParameters {
gp.helmValuesGeneratorOverride = generator
return gp
}
func (gp *GatewayParameters) WithSessionKeyGenerator(generator func() (string, error)) *GatewayParameters {
if gp.agwHelmValuesGenerator != nil && generator != nil {
gp.agwHelmValuesGenerator.sessionKeyGen = generator
}
return gp
}
// GetAgentgatewayParametersClient returns the AgentgatewayParameters client if Agentgateway is enabled, nil otherwise.
// This allows the reconciler to reuse the same client for watching changes.
func (gp *GatewayParameters) GetAgentgatewayParametersClient() kclient.Client[*agentgateway.AgentgatewayParameters] {
if gp.agwHelmValuesGenerator != nil {
return gp.agwHelmValuesGenerator.agwParamClient
}
return nil
}
func LoadAgentgatewayChart() (*chart.Chart, error) {
return loadChart(helm.AgentgatewayHelmChart)
}
func (gp *GatewayParameters) GetValues(ctx context.Context, obj client.Object) (map[string]any, error) {
generator, err := gp.getHelmValuesGenerator(obj)
if err != nil {
return nil, err
}
return generator.GetValues(ctx, obj)
}
func (gp *GatewayParameters) GetCacheSyncHandlers() []cache.InformerSynced {
if gp.helmValuesGeneratorOverride != nil {
return gp.helmValuesGeneratorOverride.GetCacheSyncHandlers()
}
var handlers []cache.InformerSynced
if gp.agwHelmValuesGenerator != nil {
handlers = append(handlers, gp.agwHelmValuesGenerator.GetCacheSyncHandlers()...)
}
return handlers
}
// PostProcessObjects implements deployer.ObjectPostProcessor.
// It applies GatewayParameters or AgentgatewayParameters overlays to the rendered objects.
// When both GatewayClass and Gateway have parameters, the overlays
// are applied in order: GatewayClass first, then Gateway on top.
func (gp *GatewayParameters) PostProcessObjects(ctx context.Context, obj client.Object, rendered []client.Object) ([]client.Object, error) {
// Check if override implements ObjectPostProcessor and delegate to it
if gp.helmValuesGeneratorOverride != nil {
if postProcessor, ok := gp.helmValuesGeneratorOverride.(ObjectPostProcessor); ok {
return postProcessor.PostProcessObjects(ctx, obj, rendered)
}
}
gw, ok := obj.(*gwv1.Gateway)
if !ok {
return rendered, nil
}
// Determine which controller this Gateway uses
var gwClassClient kclient.Client[*gwv1.GatewayClass]
if gp.agwHelmValuesGenerator != nil {
gwClassClient = gp.agwHelmValuesGenerator.gwClassClient
} else {
return nil, fmt.Errorf("no controller enabled for Gateway %s/%s", gw.GetNamespace(), gw.GetName())
}
gwc, err := getGatewayClassFromGateway(gwClassClient, gw)
if err != nil {
return nil, fmt.Errorf("failed to get GatewayClass for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
}
// Check if this is an agentgateway or envoy gateway
if string(gwc.Spec.ControllerName) == gp.inputs.AgentgatewayControllerName {
// Agentgateway overlays
if gp.agwHelmValuesGenerator == nil {
// Agentgateway not enabled; skip overlays (not an error since overlays are optional).
return rendered, nil
}
resolved, err := gp.agwHelmValuesGenerator.GetResolvedParametersForGateway(gw)
if err != nil {
return nil, fmt.Errorf("failed to resolve AgentgatewayParameters for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
}
// Apply overlays in order: GatewayClass first, then Gateway.
if resolved.gatewayClassAGWP != nil {
applier := NewAgentgatewayParametersApplier(resolved.gatewayClassAGWP)
rendered, err = applier.ApplyOverlaysToObjects(rendered)
if err != nil {
return nil, err
}
}
if resolved.gatewayAGWP != nil {
applier := NewAgentgatewayParametersApplier(resolved.gatewayAGWP)
rendered, err = applier.ApplyOverlaysToObjects(rendered)
if err != nil {
return nil, err
}
}
if usesManagedSessionKeyResolvedParameters(resolved) {
sessionKeySecret, err := gp.agwHelmValuesGenerator.buildSessionKeySecret(
ctx,
gw,
gatewaySessionKeySecretName(gw.Name),
)
if err != nil {
return nil, fmt.Errorf("failed to build session key secret for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
}
if err := addSessionKeyChecksumAnnotation(rendered, sessionKeySecret); err != nil {
return nil, fmt.Errorf("failed to annotate session key checksum for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
}
rendered = append(rendered, sessionKeySecret)
}
}
return rendered, nil
}
func addSessionKeyChecksumAnnotation(rendered []client.Object, secret *corev1.Secret) error {
key, found := secret.Data["key"]
if !found || len(key) == 0 {
return fmt.Errorf("session key secret %s/%s missing key entry", secret.Namespace, secret.Name)
}
checksum := sha256.Sum256(key)
checksumHex := hex.EncodeToString(checksum[:])
for _, obj := range rendered {
deployment, ok := obj.(*appsv1.Deployment)
if !ok {
continue
}
if deployment.Spec.Template.Annotations == nil {
deployment.Spec.Template.Annotations = map[string]string{}
}
deployment.Spec.Template.Annotations[sessionKeyChecksumAnnotation] = checksumHex
}
return nil
}
func GatewayReleaseNameAndNamespace(obj client.Object) (string, string) {
// A helm release is never installed, only a template is generated, so the name doesn't matter
// Use a hard-coded name to avoid going over the 53 character name limit
return "release-name-placeholder", obj.GetNamespace()
}
func (gp *GatewayParameters) getHelmValuesGenerator(obj client.Object) (HelmValuesGenerator, error) {
gw, ok := obj.(*gwv1.Gateway)
if !ok {
return nil, fmt.Errorf("expected a Gateway resource, got %s", obj.GetObjectKind().GroupVersionKind().String())
}
if gp.helmValuesGeneratorOverride != nil {
slog.Debug("using override HelmValuesGenerator for Gateway",
"gateway_name", gw.GetName(),
"gateway_namespace", gw.GetNamespace(),
)
return gp.helmValuesGeneratorOverride, nil
}
return gp.agwHelmValuesGenerator, nil
}
func getGatewayClassFromGateway(cli kclient.Client[*gwv1.GatewayClass], gw *gwv1.Gateway) (*gwv1.GatewayClass, error) {
if gw == nil {
return nil, errors.New("nil Gateway")
}
if gw.Spec.GatewayClassName == "" {
return nil, errors.New("GatewayClassName must not be empty")
}
gwc := cli.Get(string(gw.Spec.GatewayClassName), metav1.NamespaceNone)
if gwc == nil {
return nil, fmt.Errorf("failed to get GatewayClass for Gateway %s/%s", gw.GetName(), gw.GetNamespace())
}
return gwc, nil
}
func translateInfraMeta[K ~string, V ~string](meta map[K]V) map[string]string {
infra := make(map[string]string, len(meta))
for k, v := range meta {
if strings.HasPrefix(string(k), "gateway.networking.k8s.io/") {
continue // ignore this prefix to avoid conflicts
}
infra[string(k)] = string(v)
}
return infra
}

View File

@ -18,7 +18,7 @@ import (
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
// ResourceOverlays contains all the overlays that can be applied to rendered objects.

View File

@ -3,13 +3,11 @@ package deployer
import (
"fmt"
"os"
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
)
// injectXdsCACertificate reads the CA certificate from the control plane's mounted TLS Secret
// and injects it into the Helm values so it can be used by the proxy templates.
func injectXdsCACertificate(caCertPath string, vals *deployer.HelmConfig) error {
func injectXdsCACertificate(caCertPath string, vals *HelmConfig) error {
if _, err := os.Stat(caCertPath); os.IsNotExist(err) {
return fmt.Errorf("xDS TLS is enabled but CA certificate file not found at %s. "+
"Ensure the xDS TLS secret is properly mounted and contains ca.crt", caCertPath,

View File

@ -24,10 +24,6 @@ var (
// This file contains helper functions that generate helm values in the format needed
// by the deployer.
var ComponentLogLevelEmptyError = func(key string, value string) error {
return fmt.Errorf("an empty key or value was provided in componentLogLevels: key=%s, value=%s", key, value)
}
// Extract the listener ports from a Gateway and corresponding listener sets. These will be used to populate:
// 1. the ports exposed on the envoy container
// 2. the ports exposed on the proxy service
@ -48,7 +44,7 @@ func GetPortsValues(gw *collections.GatewayForDeployer, noListenersDummyPort int
if len(listenerPorts) == 0 && noListenersDummyPort != 0 {
port := noListenersDummyPort
portName := GenerateListenerNameFromPort(gwv1.PortNumber(port))
portName := GenerateListenerNameFromPort(port)
gwPorts = AppendPortValue(gwPorts, port, portName)
}

View File

@ -1,44 +0,0 @@
package agentgatewaysyncer
import (
"istio.io/istio/pkg/kube/controllers"
"istio.io/istio/pkg/kube/krt"
"istio.io/istio/pkg/ptr"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/translator"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
)
type PolicyStatusCollections = map[schema.GroupKind]krt.StatusCollection[controllers.Object, any]
func AgwPolicyCollection(agwPlugins plugins.AgwPlugin, references plugins.ReferenceIndex, krtopts krtutil.KrtOptions) (krt.Collection[ir.AgwResource], krt.Collection[*plugins.PolicyAttachment], PolicyStatusCollections) {
var allPolicies []krt.Collection[plugins.AgwPolicy]
var allReferences []krt.Collection[*plugins.PolicyAttachment]
policyStatusMap := PolicyStatusCollections{}
// Collect all policies from registered plugins.
// Note: Only one plugin should be used per source GVK.
// Avoid joining collections per-GVK before passing them to a plugin.
for gvk, plugin := range agwPlugins.ContributesPolicies {
policy, policyStatus, refs := plugin.ApplyPolicies(plugins.PolicyPluginInput{References: references})
if refs != nil {
allReferences = append(allReferences, refs)
}
allPolicies = append(allPolicies, policy)
if policyStatus != nil {
// some plugins may not have a status collection (a2a services, etc.)
policyStatusMap[gvk] = policyStatus
}
}
joinPolicies := krt.JoinCollection(allPolicies, krtopts.ToOptions("JoinPolicies")...)
allPoliciesCol := krt.NewCollection(joinPolicies, func(ctx krt.HandlerContext, i plugins.AgwPolicy) *ir.AgwResource {
return ptr.Of(translator.ToResourceForGateway(*i.Gateway, i))
}, krtopts.ToOptions("AllPolicies")...)
allRefsCol := krt.JoinCollection(allReferences, krtopts.ToOptions("PolicyReferences")...)
return allPoliciesCol, allRefsCol, policyStatusMap
}

View File

@ -1,3 +0,0 @@
These CRDs are needed by the setup suite and manually maintained.
When bumping gateway-api version, use the `bump-gtw` Makefile target to update these CRDs.

View File

@ -1,27 +0,0 @@
package crds
import (
"path"
"path/filepath"
"runtime"
_ "embed"
)
//go:embed gateway-crds.yaml
var GatewayCrds []byte
func getDirectory() string {
_, filename, _, _ := runtime.Caller(0)
return path.Dir(filename)
}
// directory is the absolute path to the directory containing the crd files
// It can't change at runtime, so we can cache it
var directory = getDirectory()
// AbsPathToCrd returns the absolute path to directory in which crds are stored (currently the same directory as this file)
// Used for tests to find the crd files if needed
func AbsPathToCrd(crdFile string) string {
return filepath.Join(directory, crdFile)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,753 +0,0 @@
# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Gateway API Experimental channel install
#
---
#
# config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/3328
gateway.networking.k8s.io/bundle-version: v1.3.0
gateway.networking.k8s.io/channel: experimental
creationTimestamp: null
name: tcproutes.gateway.networking.k8s.io
spec:
group: gateway.networking.k8s.io
names:
categories:
- gateway-api
kind: TCPRoute
listKind: TCPRouteList
plural: tcproutes
singular: tcproute
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
description: |-
TCPRoute provides a way to route TCP requests. When combined with a Gateway
listener, it can be used to forward connections on the port specified by the
listener to a set of backends specified by the TCPRoute.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: Spec defines the desired state of TCPRoute.
properties:
parentRefs:
description: |-
ParentRefs references the resources (usually Gateways) that a Route wants
to be attached to. Note that the referenced parent resource needs to
allow this for the attachment to be complete. For Gateways, that means
the Gateway needs to allow attachment from Routes of this kind and
namespace. For Services, that means the Service must either be in the same
namespace for a "producer" route, or the mesh implementation must support
and allow "consumer" routes for the referenced Service. ReferenceGrant is
not applicable for governing ParentRefs to Services - it is not possible to
create a "producer" route for a Service in a different namespace from the
Route.
There are two kinds of parent resources with "Core" support:
* Gateway (Gateway conformance profile)
* Service (Mesh conformance profile, ClusterIP Services only)
This API may be extended in the future to support additional kinds of parent
resources.
ParentRefs must be _distinct_. This means either that:
* They select different objects. If this is the case, then parentRef
entries are distinct. In terms of fields, this means that the
multi-part key defined by `group`, `kind`, `namespace`, and `name` must
be unique across all parentRef entries in the Route.
* They do not select different objects, but for each optional field used,
each ParentRef that selects the same object must set the same set of
optional fields to different values. If one ParentRef sets a
combination of optional fields, all must set the same combination.
Some examples:
* If one ParentRef sets `sectionName`, all ParentRefs referencing the
same object must also set `sectionName`.
* If one ParentRef sets `port`, all ParentRefs referencing the same
object must also set `port`.
* If one ParentRef sets `sectionName` and `port`, all ParentRefs
referencing the same object must also set `sectionName` and `port`.
It is possible to separately reference multiple distinct objects that may
be collapsed by an implementation. For example, some implementations may
choose to merge compatible Gateway Listeners together. If that is the
case, the list of routes attached to those resources should also be
merged.
Note that for ParentRefs that cross namespace boundaries, there are specific
rules. Cross-namespace references are only valid if they are explicitly
allowed by something in the namespace they are referring to. For example,
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
generic way to enable other kinds of cross-namespace reference.
ParentRefs from a Route to a Service in the same namespace are "producer"
routes, which apply default routing rules to inbound connections from
any namespace to the Service.
ParentRefs from a Route to a Service in a different namespace are
"consumer" routes, and these routing rules are only applied to outbound
connections originating from the same namespace as the Route, for which
the intended destination of the connections are a Service targeted as a
ParentRef of the Route.
items:
description: |-
ParentReference identifies an API object (usually a Gateway) that can be considered
a parent of this resource (usually a route). There are two kinds of parent resources
with "Core" support:
* Gateway (Gateway conformance profile)
* Service (Mesh conformance profile, ClusterIP Services only)
This API may be extended in the future to support additional kinds of parent
resources.
The API object must be valid in the cluster; the Group and Kind must
be registered in the cluster for this reference to be valid.
properties:
group:
default: gateway.networking.k8s.io
description: |-
Group is the group of the referent.
When unspecified, "gateway.networking.k8s.io" is inferred.
To set the core API group (such as for a "Service" kind referent),
Group must be explicitly set to "" (empty string).
Support: Core
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: Gateway
description: |-
Kind is kind of the referent.
There are two kinds of parent resources with "Core" support:
* Gateway (Gateway conformance profile)
* Service (Mesh conformance profile, ClusterIP Services only)
Support for other resources is Implementation-Specific.
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: |-
Name is the name of the referent.
Support: Core
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the referent. When unspecified, this refers
to the local namespace of the Route.
Note that there are specific rules for ParentRefs which cross namespace
boundaries. Cross-namespace references are only valid if they are explicitly
allowed by something in the namespace they are referring to. For example:
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
generic way to enable any other kind of cross-namespace reference.
ParentRefs from a Route to a Service in the same namespace are "producer"
routes, which apply default routing rules to inbound connections from
any namespace to the Service.
ParentRefs from a Route to a Service in a different namespace are
"consumer" routes, and these routing rules are only applied to outbound
connections originating from the same namespace as the Route, for which
the intended destination of the connections are a Service targeted as a
ParentRef of the Route.
Support: Core
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
port:
description: |-
Port is the network port this Route targets. It can be interpreted
differently based on the type of parent resource.
When the parent resource is a Gateway, this targets all listeners
listening on the specified port that also support this kind of Route(and
select this Route). It's not recommended to set `Port` unless the
networking behaviors specified in a Route must apply to a specific port
as opposed to a listener(s) whose port(s) may be changed. When both Port
and SectionName are specified, the name and port of the selected listener
must match both specified values.
When the parent resource is a Service, this targets a specific port in the
Service spec. When both Port (experimental) and SectionName are specified,
the name and port of the selected port must match both specified values.
Implementations MAY choose to support other parent resources.
Implementations supporting other types of parent resources MUST clearly
document how/if Port is interpreted.
For the purpose of status, an attachment is considered successful as
long as the parent resource accepts it partially. For example, Gateway
listeners can restrict which Routes can attach to them by Route kind,
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
from the referencing Route, the Route MUST be considered successfully
attached. If no Gateway listeners accept attachment from this Route,
the Route MUST be considered detached from the Gateway.
Support: Extended
format: int32
maximum: 65535
minimum: 1
type: integer
sectionName:
description: |-
SectionName is the name of a section within the target resource. In the
following resources, SectionName is interpreted as the following:
* Gateway: Listener name. When both Port (experimental) and SectionName
are specified, the name and port of the selected listener must match
both specified values.
* Service: Port name. When both Port (experimental) and SectionName
are specified, the name and port of the selected listener must match
both specified values.
Implementations MAY choose to support attaching Routes to other resources.
If that is the case, they MUST clearly document how SectionName is
interpreted.
When unspecified (empty string), this will reference the entire resource.
For the purpose of status, an attachment is considered successful if at
least one section in the parent resource accepts it. For example, Gateway
listeners can restrict which Routes can attach to them by Route kind,
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
the referencing Route, the Route MUST be considered successfully
attached. If no Gateway listeners accept attachment from this Route, the
Route MUST be considered detached from the Gateway.
Support: Core
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- name
type: object
maxItems: 32
type: array
x-kubernetes-validations:
- message: sectionName or port must be specified when parentRefs includes
2 or more references to the same parent
rule: 'self.all(p1, self.all(p2, p1.group == p2.group && p1.kind
== p2.kind && p1.name == p2.name && (((!has(p1.__namespace__)
|| p1.__namespace__ == '''') && (!has(p2.__namespace__) || p2.__namespace__
== '''')) || (has(p1.__namespace__) && has(p2.__namespace__) &&
p1.__namespace__ == p2.__namespace__)) ? ((!has(p1.sectionName)
|| p1.sectionName == '''') == (!has(p2.sectionName) || p2.sectionName
== '''') && (!has(p1.port) || p1.port == 0) == (!has(p2.port)
|| p2.port == 0)): true))'
- message: sectionName or port must be unique when parentRefs includes
2 or more references to the same parent
rule: self.all(p1, self.exists_one(p2, p1.group == p2.group && p1.kind
== p2.kind && p1.name == p2.name && (((!has(p1.__namespace__)
|| p1.__namespace__ == '') && (!has(p2.__namespace__) || p2.__namespace__
== '')) || (has(p1.__namespace__) && has(p2.__namespace__) &&
p1.__namespace__ == p2.__namespace__ )) && (((!has(p1.sectionName)
|| p1.sectionName == '') && (!has(p2.sectionName) || p2.sectionName
== '')) || ( has(p1.sectionName) && has(p2.sectionName) && p1.sectionName
== p2.sectionName)) && (((!has(p1.port) || p1.port == 0) && (!has(p2.port)
|| p2.port == 0)) || (has(p1.port) && has(p2.port) && p1.port
== p2.port))))
rules:
description: Rules are a list of TCP matchers and actions.
items:
description: TCPRouteRule is the configuration for a given rule.
properties:
backendRefs:
description: |-
BackendRefs defines the backend(s) where matching requests should be
sent. If unspecified or invalid (refers to a nonexistent resource or a
Service with no endpoints), the underlying implementation MUST actively
reject connection attempts to this backend. Connection rejections must
respect weight; if an invalid backend is requested to have 80% of
connections, then 80% of connections must be rejected instead.
Support: Core for Kubernetes Service
Support: Extended for Kubernetes ServiceImport
Support: Implementation-specific for any other resource
Support for weight: Extended
items:
description: |-
BackendRef defines how a Route should forward a request to a Kubernetes
resource.
Note that when a namespace different than the local namespace is specified, a
ReferenceGrant object is required in the referent namespace to allow that
namespace's owner to accept the reference. See the ReferenceGrant
documentation for details.
When the BackendRef points to a Kubernetes Service, implementations SHOULD
honor the appProtocol field if it is set for the target Service Port.
Implementations supporting appProtocol SHOULD recognize the Kubernetes
Standard Application Protocols defined in KEP-3726.
If a Service appProtocol isn't specified, an implementation MAY infer the
backend protocol through its own means. Implementations MAY infer the
protocol from the Route type referring to the backend Service.
If a Route is not able to send traffic to the backend using the specified
protocol then the backend is considered invalid. Implementations MUST set the
"ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason.
Note that when the BackendTLSPolicy object is enabled by the implementation,
there are some extra rules about validity to consider here. See the fields
where this struct is used for more information about the exact behavior.
properties:
group:
default: ""
description: |-
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: Service
description: |-
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: Name is the name of the referent.
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
Note that when a namespace different than the local namespace is specified,
a ReferenceGrant object is required in the referent namespace to allow that
namespace's owner to accept the reference. See the ReferenceGrant
documentation for details.
Support: Core
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
port:
description: |-
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format: int32
maximum: 65535
minimum: 1
type: integer
weight:
default: 1
description: |-
Weight specifies the proportion of requests forwarded to the referenced
backend. This is computed as weight/(sum of all weights in this
BackendRefs list). For non-zero values, there may be some epsilon from
the exact proportion defined here depending on the precision an
implementation supports. Weight is not a percentage and the sum of
weights does not need to equal 100.
If only one backend is specified and it has a weight greater than 0, 100%
of the traffic is forwarded to that backend. If weight is set to 0, no
traffic should be forwarded for this entry. If unspecified, weight
defaults to 1.
Support for this field varies based on the context where used.
format: int32
maximum: 1000000
minimum: 0
type: integer
required:
- name
type: object
x-kubernetes-validations:
- message: Must have port for Service reference
rule: '(size(self.group) == 0 && self.kind == ''Service'')
? has(self.port) : true'
maxItems: 16
minItems: 1
type: array
name:
description: |-
Name is the name of the route rule. This name MUST be unique within a Route if it is set.
Support: Extended
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: object
maxItems: 16
minItems: 1
type: array
x-kubernetes-validations:
- message: Rule name must be unique within the route
rule: self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name)
&& l1.name == l2.name))
required:
- rules
type: object
status:
description: Status defines the current state of TCPRoute.
properties:
parents:
description: |-
Parents is a list of parent resources (usually Gateways) that are
associated with the route, and the status of the route with respect to
each parent. When this route attaches to a parent, the controller that
manages the parent must add an entry to this list when the controller
first sees the route and should update the entry as appropriate when the
route or gateway is modified.
Note that parent references that cannot be resolved by an implementation
of this API will not be added to this list. Implementations of this API
can only populate Route status for the Gateways/parent resources they are
responsible for.
A maximum of 32 Gateways will be represented in this list. An empty list
means the route has not been attached to any Gateway.
items:
description: |-
RouteParentStatus describes the status of a route with respect to an
associated Parent.
properties:
conditions:
description: |-
Conditions describes the status of the route with respect to the Gateway.
Note that the route's availability is also subject to the Gateway's own
status conditions and listener status.
If the Route's ParentRef specifies an existing Gateway that supports
Routes of this kind AND that Gateway's controller has sufficient access,
then that Gateway's controller MUST set the "Accepted" condition on the
Route, to indicate whether the route has been accepted or rejected by the
Gateway, and why.
A Route MUST be considered "Accepted" if at least one of the Route's
rules is implemented by the Gateway.
There are a number of cases where the "Accepted" condition may not be set
due to lack of controller visibility, that includes when:
* The Route refers to a nonexistent parent.
* The Route is of a type that the controller does not support.
* The Route is in a namespace the controller does not have access to.
items:
description: Condition contains details for one aspect of
the current state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False,
Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
maxItems: 8
minItems: 1
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
controllerName:
description: |-
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.
Example: "example.net/gateway-controller".
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.
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$
type: string
parentRef:
description: |-
ParentRef corresponds with a ParentRef in the spec that this
RouteParentStatus struct describes the status of.
properties:
group:
default: gateway.networking.k8s.io
description: |-
Group is the group of the referent.
When unspecified, "gateway.networking.k8s.io" is inferred.
To set the core API group (such as for a "Service" kind referent),
Group must be explicitly set to "" (empty string).
Support: Core
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: Gateway
description: |-
Kind is kind of the referent.
There are two kinds of parent resources with "Core" support:
* Gateway (Gateway conformance profile)
* Service (Mesh conformance profile, ClusterIP Services only)
Support for other resources is Implementation-Specific.
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: |-
Name is the name of the referent.
Support: Core
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the referent. When unspecified, this refers
to the local namespace of the Route.
Note that there are specific rules for ParentRefs which cross namespace
boundaries. Cross-namespace references are only valid if they are explicitly
allowed by something in the namespace they are referring to. For example:
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
generic way to enable any other kind of cross-namespace reference.
ParentRefs from a Route to a Service in the same namespace are "producer"
routes, which apply default routing rules to inbound connections from
any namespace to the Service.
ParentRefs from a Route to a Service in a different namespace are
"consumer" routes, and these routing rules are only applied to outbound
connections originating from the same namespace as the Route, for which
the intended destination of the connections are a Service targeted as a
ParentRef of the Route.
Support: Core
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
port:
description: |-
Port is the network port this Route targets. It can be interpreted
differently based on the type of parent resource.
When the parent resource is a Gateway, this targets all listeners
listening on the specified port that also support this kind of Route(and
select this Route). It's not recommended to set `Port` unless the
networking behaviors specified in a Route must apply to a specific port
as opposed to a listener(s) whose port(s) may be changed. When both Port
and SectionName are specified, the name and port of the selected listener
must match both specified values.
When the parent resource is a Service, this targets a specific port in the
Service spec. When both Port (experimental) and SectionName are specified,
the name and port of the selected port must match both specified values.
Implementations MAY choose to support other parent resources.
Implementations supporting other types of parent resources MUST clearly
document how/if Port is interpreted.
For the purpose of status, an attachment is considered successful as
long as the parent resource accepts it partially. For example, Gateway
listeners can restrict which Routes can attach to them by Route kind,
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
from the referencing Route, the Route MUST be considered successfully
attached. If no Gateway listeners accept attachment from this Route,
the Route MUST be considered detached from the Gateway.
Support: Extended
format: int32
maximum: 65535
minimum: 1
type: integer
sectionName:
description: |-
SectionName is the name of a section within the target resource. In the
following resources, SectionName is interpreted as the following:
* Gateway: Listener name. When both Port (experimental) and SectionName
are specified, the name and port of the selected listener must match
both specified values.
* Service: Port name. When both Port (experimental) and SectionName
are specified, the name and port of the selected listener must match
both specified values.
Implementations MAY choose to support attaching Routes to other resources.
If that is the case, they MUST clearly document how SectionName is
interpreted.
When unspecified (empty string), this will reference the entire resource.
For the purpose of status, an attachment is considered successful if at
least one section in the parent resource accepts it. For example, Gateway
listeners can restrict which Routes can attach to them by Route kind,
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
the referencing Route, the Route MUST be considered successfully
attached. If no Gateway listeners accept attachment from this Route, the
Route MUST be considered detached from the Gateway.
Support: Core
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- name
type: object
required:
- controllerName
- parentRef
type: object
maxItems: 32
type: array
required:
- parents
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null

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