Compare commits

..

2 Commits

Author SHA1 Message Date
Kasun Talwatta
c7292effd6
fixed proto gen issue
Signed-off-by: Kasun Talwatta <kasun.talwatta@gmail.com>
2026-03-27 18:41:59 +13:00
Kasun Talwatta
078ef3932f
adding support to handle limit field to override with dynamic metadata information value. also fixed ext-proc metadata as previously it was wrapped in Arc and wasn't able to process with CEL. fixed the tests to reflect.
Signed-off-by: Kasun Talwatta <kasun.talwatta@gmail.com>
2026-03-27 18:23:46 +13:00
360 changed files with 29409 additions and 12186 deletions

View File

@ -12,9 +12,6 @@ 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,7 +12,6 @@ permissions:
jobs:
prepare:
if: github.repository == 'agentgateway/agentgateway'
runs-on: ubuntu-24.04
outputs:
has_commits: ${{ steps.check.outputs.has_commits }}
@ -51,6 +50,4 @@ 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.2"
GO_VERSION: "1.26.1"
jobs:
#### Proxy jobs ####
@ -24,14 +24,13 @@ jobs:
strategy:
matrix:
include:
- os: blacksmith-4vcpu-ubuntu-2404
name: "Proxy Test"
- os: ubuntu-24.04
validate: true
- os: windows-2025
name: "Proxy Test (Windows)"
validate: false
- os: macos-15
name: "Proxy Test (Mac)"
validate: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
@ -40,25 +39,20 @@ 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, 'blacksmith-') }}
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
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
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
- name: Validate
if: ${{ matrix.validate }}
run: make validate
proxy-lint:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust
@ -94,7 +88,7 @@ jobs:
#### Controller jobs ####
controller-test:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@ -107,7 +101,7 @@ jobs:
run: go test -race ./...
controller-lint:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@ -127,7 +121,7 @@ jobs:
run: make generate-apis check-clean-repo
controller-e2e:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check Runner Info
@ -179,7 +173,7 @@ jobs:
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
controller-conformance:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Rust

View File

@ -13,11 +13,6 @@ 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:
@ -29,17 +24,12 @@ 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.2"
GO_VERSION: "1.26.1"
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/agentgateway
CONTROLLER_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/controller
# Note: /charts is added to this
@ -80,9 +70,9 @@ jobs:
matrix:
include:
- platform: linux/amd64
os: blacksmith-4vcpu-ubuntu-2404
os: ubuntu-24.04
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
os: ubuntu-24.04-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
@ -205,9 +195,9 @@ jobs:
matrix:
include:
- platform: linux/amd64
os: blacksmith-4vcpu-ubuntu-2404
os: ubuntu-24.04
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
os: ubuntu-24.04-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
@ -335,7 +325,7 @@ jobs:
os: ubuntu-24.04
goarch: amd64
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
os: ubuntu-24.04-arm
goarch: arm64
defaults:
run:
@ -499,7 +489,6 @@ 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) }}
@ -513,24 +502,20 @@ jobs:
strategy:
matrix:
include:
- os: blacksmith-4vcpu-ubuntu-2404
- os: ubuntu-24.04
target: x86_64-unknown-linux-musl
# Performance is horrendous on musl without jemalloc
features: jemalloc
name: linux
- os: blacksmith-4vcpu-ubuntu-2404-arm
- os: ubuntu-24.04-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
@ -548,8 +533,8 @@ jobs:
cd ui
npm install
npm run build
- name: Prepare Linux target
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' }}
- name: Install musl-tools
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
@ -564,7 +549,7 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: release-binary-${{ matrix.name }}
name: release-binary-${{ matrix.os }}
path: |
target/${{ matrix.target }}/release/agentgateway
target/${{ matrix.target }}/release/agentgateway.exe
@ -578,7 +563,7 @@ jobs:
- push-controller-image
- push-helm-charts
- build
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-24.04
permissions:
contents: write
env:
@ -593,13 +578,13 @@ jobs:
run: |
ls -R
mkdir outputs
mv release-binary-mac/agentgateway outputs/agentgateway-darwin-arm64
mv release-binary-macos-26/agentgateway outputs/agentgateway-darwin-arm64
sha256sum outputs/agentgateway-darwin-arm64 > outputs/agentgateway-darwin-arm64.sha256
mv release-binary-linux/agentgateway outputs/agentgateway-linux-amd64
mv release-binary-ubuntu-24.04/agentgateway outputs/agentgateway-linux-amd64
sha256sum outputs/agentgateway-linux-amd64 > outputs/agentgateway-linux-amd64.sha256
mv release-binary-linux-arm/agentgateway outputs/agentgateway-linux-arm64
mv release-binary-ubuntu-24.04-arm/agentgateway outputs/agentgateway-linux-arm64
sha256sum outputs/agentgateway-linux-arm64 > outputs/agentgateway-linux-arm64.sha256
mv release-binary-windows/agentgateway.exe outputs/agentgateway-windows-amd64.exe
mv release-binary-windows-2025/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

462
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 = { version = "0.34", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
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-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.8", default-features = false, features = [
google-cloud-auth = { version = "1.7", 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.47", features = ["json", "redactions", "filters", "yaml"] }
insta = { version = "1.46", 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.11"
md-5 = "0.10"
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.11"
sha2 = "0.11"
sha1 = "0.10"
sha2 = "0.10"
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.23", features = ["v4"] }
uuid = { version = "1.22", 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.9"
frozen-collections = "0.8"
heck = "0.5"
macro_rules_attribute = "0.2"

View File

@ -29,7 +29,7 @@
---
**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.
**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).
<br>
<div align="center">
@ -41,31 +41,20 @@
[![Agentgateway Intro Video](https://img.youtube.com/vi/SomP92JWPmE/hqdefault.jpg)](https://youtu.be/SomP92JWPmE)
## Key Features
## Key Features:
- **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.
- [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.
<br>
## Getting Started
## Getting Started
- [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.
To get started with agentgateway, please check out the [Getting Started Guide](https://agentgateway.dev/docs/quickstart).
## Documentation
@ -80,23 +69,6 @@ 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.
@ -108,7 +80,7 @@ Recordings of the community meetings will be published on our [google drive](htt
## Roadmap
`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).
`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).
## Contributors

View File

@ -7854,7 +7854,6 @@ type TrafficPolicySpec_JWT struct {
// How the JWT validation should behave
Mode TrafficPolicySpec_JWT_Mode `protobuf:"varint,1,opt,name=mode,proto3,enum=agentgateway.dev.resource.TrafficPolicySpec_JWT_Mode" json:"mode,omitempty"`
Providers []*TrafficPolicySpec_JWTProvider `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"`
Mcp *TrafficPolicySpec_JWT_MCP `protobuf:"bytes,3,opt,name=mcp,proto3" json:"mcp,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@ -7903,13 +7902,6 @@ func (x *TrafficPolicySpec_JWT) GetProviders() []*TrafficPolicySpec_JWTProvider
return nil
}
func (x *TrafficPolicySpec_JWT) GetMcp() *TrafficPolicySpec_JWT_MCP {
if x != nil {
return x.Mcp
}
return nil
}
// Basic authentication configuration using htpasswd file
type TrafficPolicySpec_BasicAuthentication struct {
state protoimpl.MessageState `protogen:"open.v1"`
@ -8345,9 +8337,10 @@ func (x *TrafficPolicySpec_HostRewrite) GetMode() TrafficPolicySpec_HostRewrite_
}
type TrafficPolicySpec_RemoteRateLimit_Descriptor struct {
state protoimpl.MessageState `protogen:"open.v1"`
Entries []*TrafficPolicySpec_RemoteRateLimit_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
Type TrafficPolicySpec_RemoteRateLimit_Type `protobuf:"varint,2,opt,name=type,proto3,enum=agentgateway.dev.resource.TrafficPolicySpec_RemoteRateLimit_Type" json:"type,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
Entries []*TrafficPolicySpec_RemoteRateLimit_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
Type TrafficPolicySpec_RemoteRateLimit_Type `protobuf:"varint,2,opt,name=type,proto3,enum=agentgateway.dev.resource.TrafficPolicySpec_RemoteRateLimit_Type" json:"type,omitempty"`
LimitOverride *TrafficPolicySpec_RemoteRateLimit_LimitOverride `protobuf:"bytes,3,opt,name=limit_override,json=limitOverride,proto3,oneof" json:"limit_override,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@ -8396,6 +8389,13 @@ func (x *TrafficPolicySpec_RemoteRateLimit_Descriptor) GetType() TrafficPolicySp
return TrafficPolicySpec_RemoteRateLimit_REQUESTS
}
func (x *TrafficPolicySpec_RemoteRateLimit_Descriptor) GetLimitOverride() *TrafficPolicySpec_RemoteRateLimit_LimitOverride {
if x != nil {
return x.LimitOverride
}
return nil
}
type TrafficPolicySpec_RemoteRateLimit_Entry struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
@ -8448,6 +8448,56 @@ func (x *TrafficPolicySpec_RemoteRateLimit_Entry) GetValue() string {
return ""
}
// Dynamic rate limit override evaluated from request context.
// when set, the proxy evaluates the CEL expression and sends
// a `RateLimitOverride` to RLS, allowing per-request limit customization.
type TrafficPolicySpec_RemoteRateLimit_LimitOverride struct {
state protoimpl.MessageState `protogen:"open.v1"`
// CEL expression evaluated against the request context.
// must resolve to an object with "requests_per_unit" (int) and "unit" (string).
// e.g: "extproc.dynamic_rate_limit",
Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrafficPolicySpec_RemoteRateLimit_LimitOverride) Reset() {
*x = TrafficPolicySpec_RemoteRateLimit_LimitOverride{}
mi := &file_resource_proto_msgTypes[90]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrafficPolicySpec_RemoteRateLimit_LimitOverride) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrafficPolicySpec_RemoteRateLimit_LimitOverride) ProtoMessage() {}
func (x *TrafficPolicySpec_RemoteRateLimit_LimitOverride) ProtoReflect() protoreflect.Message {
mi := &file_resource_proto_msgTypes[90]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrafficPolicySpec_RemoteRateLimit_LimitOverride.ProtoReflect.Descriptor instead.
func (*TrafficPolicySpec_RemoteRateLimit_LimitOverride) Descriptor() ([]byte, []int) {
return file_resource_proto_rawDescGZIP(), []int{45, 0, 2}
}
func (x *TrafficPolicySpec_RemoteRateLimit_LimitOverride) GetExpression() string {
if x != nil {
return x.Expression
}
return ""
}
type TrafficPolicySpec_ExternalAuth_BodyOptions struct {
state protoimpl.MessageState `protogen:"open.v1"`
MaxRequestBytes uint32 `protobuf:"varint,1,opt,name=max_request_bytes,json=maxRequestBytes,proto3" json:"max_request_bytes,omitempty"`
@ -8459,7 +8509,7 @@ type TrafficPolicySpec_ExternalAuth_BodyOptions struct {
func (x *TrafficPolicySpec_ExternalAuth_BodyOptions) Reset() {
*x = TrafficPolicySpec_ExternalAuth_BodyOptions{}
mi := &file_resource_proto_msgTypes[90]
mi := &file_resource_proto_msgTypes[91]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -8471,7 +8521,7 @@ func (x *TrafficPolicySpec_ExternalAuth_BodyOptions) String() string {
func (*TrafficPolicySpec_ExternalAuth_BodyOptions) ProtoMessage() {}
func (x *TrafficPolicySpec_ExternalAuth_BodyOptions) ProtoReflect() protoreflect.Message {
mi := &file_resource_proto_msgTypes[90]
mi := &file_resource_proto_msgTypes[91]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -8518,7 +8568,7 @@ type TrafficPolicySpec_ExternalAuth_GRPCProtocol struct {
func (x *TrafficPolicySpec_ExternalAuth_GRPCProtocol) Reset() {
*x = TrafficPolicySpec_ExternalAuth_GRPCProtocol{}
mi := &file_resource_proto_msgTypes[91]
mi := &file_resource_proto_msgTypes[92]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -8530,7 +8580,7 @@ func (x *TrafficPolicySpec_ExternalAuth_GRPCProtocol) String() string {
func (*TrafficPolicySpec_ExternalAuth_GRPCProtocol) ProtoMessage() {}
func (x *TrafficPolicySpec_ExternalAuth_GRPCProtocol) ProtoReflect() protoreflect.Message {
mi := &file_resource_proto_msgTypes[91]
mi := &file_resource_proto_msgTypes[92]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -8573,7 +8623,7 @@ type TrafficPolicySpec_ExternalAuth_HTTPProtocol struct {
func (x *TrafficPolicySpec_ExternalAuth_HTTPProtocol) Reset() {
*x = TrafficPolicySpec_ExternalAuth_HTTPProtocol{}
mi := &file_resource_proto_msgTypes[92]
mi := &file_resource_proto_msgTypes[93]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -8585,7 +8635,7 @@ func (x *TrafficPolicySpec_ExternalAuth_HTTPProtocol) String() string {
func (*TrafficPolicySpec_ExternalAuth_HTTPProtocol) ProtoMessage() {}
func (x *TrafficPolicySpec_ExternalAuth_HTTPProtocol) ProtoReflect() protoreflect.Message {
mi := &file_resource_proto_msgTypes[92]
mi := &file_resource_proto_msgTypes[93]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -8636,58 +8686,6 @@ func (x *TrafficPolicySpec_ExternalAuth_HTTPProtocol) GetMetadata() map[string]s
return nil
}
type TrafficPolicySpec_JWT_MCP struct {
state protoimpl.MessageState `protogen:"open.v1"`
Provider BackendPolicySpec_McpAuthentication_McpIDP `protobuf:"varint,1,opt,name=provider,proto3,enum=agentgateway.dev.resource.BackendPolicySpec_McpAuthentication_McpIDP" json:"provider,omitempty"`
ResourceMetadata *BackendPolicySpec_McpAuthentication_ResourceMetadata `protobuf:"bytes,2,opt,name=resource_metadata,json=resourceMetadata,proto3" json:"resource_metadata,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrafficPolicySpec_JWT_MCP) Reset() {
*x = TrafficPolicySpec_JWT_MCP{}
mi := &file_resource_proto_msgTypes[97]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrafficPolicySpec_JWT_MCP) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrafficPolicySpec_JWT_MCP) ProtoMessage() {}
func (x *TrafficPolicySpec_JWT_MCP) ProtoReflect() protoreflect.Message {
mi := &file_resource_proto_msgTypes[97]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrafficPolicySpec_JWT_MCP.ProtoReflect.Descriptor instead.
func (*TrafficPolicySpec_JWT_MCP) Descriptor() ([]byte, []int) {
return file_resource_proto_rawDescGZIP(), []int{45, 5, 0}
}
func (x *TrafficPolicySpec_JWT_MCP) GetProvider() BackendPolicySpec_McpAuthentication_McpIDP {
if x != nil {
return x.Provider
}
return BackendPolicySpec_McpAuthentication_UNSPECIFIED
}
func (x *TrafficPolicySpec_JWT_MCP) GetResourceMetadata() *BackendPolicySpec_McpAuthentication_ResourceMetadata {
if x != nil {
return x.ResourceMetadata
}
return nil
}
type TrafficPolicySpec_APIKey_User struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
@ -10461,14 +10459,13 @@ func (x *BackendPolicySpec_Ai_PromptGuard) GetResponse() []*BackendPolicySpec_Ai
// Default JSON key-value pairs to add to the LLM request if the key is not set in the request.
type BackendPolicySpec_Ai_PromptCaching struct {
state protoimpl.MessageState `protogen:"open.v1"`
CacheSystem bool `protobuf:"varint,1,opt,name=cache_system,json=cacheSystem,proto3" json:"cache_system,omitempty"`
CacheMessages bool `protobuf:"varint,2,opt,name=cache_messages,json=cacheMessages,proto3" json:"cache_messages,omitempty"`
CacheTools bool `protobuf:"varint,3,opt,name=cache_tools,json=cacheTools,proto3" json:"cache_tools,omitempty"`
MinTokens *uint32 `protobuf:"varint,4,opt,name=min_tokens,json=minTokens,proto3,oneof" json:"min_tokens,omitempty"`
CacheMessageOffset *uint32 `protobuf:"varint,5,opt,name=cache_message_offset,json=cacheMessageOffset,proto3,oneof" json:"cache_message_offset,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
state protoimpl.MessageState `protogen:"open.v1"`
CacheSystem bool `protobuf:"varint,1,opt,name=cache_system,json=cacheSystem,proto3" json:"cache_system,omitempty"`
CacheMessages bool `protobuf:"varint,2,opt,name=cache_messages,json=cacheMessages,proto3" json:"cache_messages,omitempty"`
CacheTools bool `protobuf:"varint,3,opt,name=cache_tools,json=cacheTools,proto3" json:"cache_tools,omitempty"`
MinTokens *uint32 `protobuf:"varint,4,opt,name=min_tokens,json=minTokens,proto3,oneof" json:"min_tokens,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BackendPolicySpec_Ai_PromptCaching) Reset() {
@ -10529,13 +10526,6 @@ func (x *BackendPolicySpec_Ai_PromptCaching) GetMinTokens() uint32 {
return 0
}
func (x *BackendPolicySpec_Ai_PromptCaching) GetCacheMessageOffset() uint32 {
if x != nil && x.CacheMessageOffset != nil {
return *x.CacheMessageOffset
}
return 0
}
type BackendPolicySpec_McpAuthentication_ResourceMetadata struct {
state protoimpl.MessageState `protogen:"open.v1"`
Extra map[string]*structpb.Value `protobuf:"bytes,1,rep,name=extra,proto3" json:"extra,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
@ -11608,7 +11598,7 @@ const file_resource_proto_rawDesc = "" +
"\x05value\x18\x02 \x01(\tR\x05valueB\x06\n" +
"\x04kind\"?\n" +
"\x14JWTValidationOptions\x12'\n" +
"\x0frequired_claims\x18\x01 \x03(\tR\x0erequiredClaims\"\xc7>\n" +
"\x0frequired_claims\x18\x01 \x03(\tR\x0erequiredClaims\"\xd2=\n" +
"\x11TrafficPolicySpec\x12N\n" +
"\x05phase\x18\x01 \x01(\x0e28.agentgateway.dev.resource.TrafficPolicySpec.PolicyPhaseR\x05phase\x12>\n" +
"\atimeout\x18\x02 \x01(\v2\".agentgateway.dev.resource.TimeoutH\x00R\atimeout\x128\n" +
@ -11634,19 +11624,25 @@ const file_resource_proto_rawDesc = "" +
"basic_auth\x18\x13 \x01(\v2@.agentgateway.dev.resource.TrafficPolicySpec.BasicAuthenticationH\x00R\tbasicAuth\x12W\n" +
"\fapi_key_auth\x18\x14 \x01(\v23.agentgateway.dev.resource.TrafficPolicySpec.APIKeyH\x00R\n" +
"apiKeyAuth\x12]\n" +
"\fhost_rewrite\x18\x15 \x01(\v28.agentgateway.dev.resource.TrafficPolicySpec.HostRewriteH\x00R\vhostRewrite\x1a\x8c\x05\n" +
"\fhost_rewrite\x18\x15 \x01(\v28.agentgateway.dev.resource.TrafficPolicySpec.HostRewriteH\x00R\vhostRewrite\x1a\xc8\x06\n" +
"\x0fRemoteRateLimit\x12\x16\n" +
"\x06domain\x18\x01 \x01(\tR\x06domain\x12i\n" +
"\vdescriptors\x18\x02 \x03(\v2G.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.DescriptorR\vdescriptors\x12C\n" +
"\x06target\x18\x03 \x01(\v2+.agentgateway.dev.resource.BackendReferenceR\x06target\x12k\n" +
"\ffailure_mode\x18\x04 \x01(\x0e2H.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.FailureModeR\vfailureMode\x1a\xc1\x01\n" +
"\ffailure_mode\x18\x04 \x01(\x0e2H.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.FailureModeR\vfailureMode\x1a\xcc\x02\n" +
"\n" +
"Descriptor\x12\\\n" +
"\aentries\x18\x01 \x03(\v2B.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.EntryR\aentries\x12U\n" +
"\x04type\x18\x02 \x01(\x0e2A.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.TypeR\x04type\x1a/\n" +
"\x04type\x18\x02 \x01(\x0e2A.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.TypeR\x04type\x12v\n" +
"\x0elimit_override\x18\x03 \x01(\v2J.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.LimitOverrideH\x00R\rlimitOverride\x88\x01\x01B\x11\n" +
"\x0f_limit_override\x1a/\n" +
"\x05Entry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value\" \n" +
"\x05value\x18\x02 \x01(\tR\x05value\x1a/\n" +
"\rLimitOverride\x12\x1e\n" +
"\n" +
"expression\x18\x01 \x01(\tR\n" +
"expression\" \n" +
"\x04Type\x12\f\n" +
"\bREQUESTS\x10\x00\x12\n" +
"\n" +
@ -11714,14 +11710,10 @@ const file_resource_proto_rawDesc = "" +
"\taudiences\x18\x02 \x03(\tR\taudiences\x12\x18\n" +
"\x06inline\x18\x03 \x01(\tH\x00R\x06inline\x12e\n" +
"\x16jwt_validation_options\x18\x04 \x01(\v2/.agentgateway.dev.resource.JWTValidationOptionsR\x14jwtValidationOptionsB\r\n" +
"\vjwks_source\x1a\x8b\x04\n" +
"\vjwks_source\x1a\xda\x01\n" +
"\x03JWT\x12I\n" +
"\x04mode\x18\x01 \x01(\x0e25.agentgateway.dev.resource.TrafficPolicySpec.JWT.ModeR\x04mode\x12V\n" +
"\tproviders\x18\x02 \x03(\v28.agentgateway.dev.resource.TrafficPolicySpec.JWTProviderR\tproviders\x12F\n" +
"\x03mcp\x18\x03 \x01(\v24.agentgateway.dev.resource.TrafficPolicySpec.JWT.MCPR\x03mcp\x1a\xe6\x01\n" +
"\x03MCP\x12a\n" +
"\bprovider\x18\x01 \x01(\x0e2E.agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.McpIDPR\bprovider\x12|\n" +
"\x11resource_metadata\x18\x02 \x01(\v2O.agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadataR\x10resourceMetadata\"0\n" +
"\tproviders\x18\x02 \x03(\v28.agentgateway.dev.resource.TrafficPolicySpec.JWTProviderR\tproviders\"0\n" +
"\x04Mode\x12\f\n" +
"\bOPTIONAL\x10\x00\x12\n" +
"\n" +
@ -11801,7 +11793,7 @@ const file_resource_proto_rawDesc = "" +
"\vPolicyPhase\x12\t\n" +
"\x05ROUTE\x10\x00\x12\v\n" +
"\aGATEWAY\x10\x01B\x06\n" +
"\x04kind\"\x86C\n" +
"\x04kind\"\xb6B\n" +
"\x11BackendPolicySpec\x12D\n" +
"\x03a2a\x18\x01 \x01(\v20.agentgateway.dev.resource.BackendPolicySpec.A2aH\x00R\x03a2a\x12l\n" +
"\x11inference_routing\x18\x02 \x01(\v2=.agentgateway.dev.resource.BackendPolicySpec.InferenceRoutingH\x00R\x10inferenceRouting\x12Z\n" +
@ -11821,7 +11813,7 @@ const file_resource_proto_rawDesc = "" +
"backendTcp\x12k\n" +
"\x0etransformation\x18\x0e \x01(\v2A.agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicyH\x00R\x0etransformation\x12M\n" +
"\x06health\x18\x0f \x01(\v23.agentgateway.dev.resource.BackendPolicySpec.HealthH\x00R\x06health\x12c\n" +
"\x0ebackend_tunnel\x18\x10 \x01(\v2:.agentgateway.dev.resource.BackendPolicySpec.BackendTunnelH\x00R\rbackendTunnel\x1a\xe3\"\n" +
"\x0ebackend_tunnel\x18\x10 \x01(\v2:.agentgateway.dev.resource.BackendPolicySpec.BackendTunnelH\x00R\rbackendTunnel\x1a\x93\"\n" +
"\x02Ai\x12^\n" +
"\fprompt_guard\x18\x01 \x01(\v2;.agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuardR\vpromptGuard\x12Y\n" +
"\bdefaults\x18\x02 \x03(\v2=.agentgateway.dev.resource.BackendPolicySpec.Ai.DefaultsEntryR\bdefaults\x12\\\n" +
@ -11888,17 +11880,15 @@ const file_resource_proto_rawDesc = "" +
"\x04kind\x1a\xc0\x01\n" +
"\vPromptGuard\x12V\n" +
"\arequest\x18\x01 \x03(\v2<.agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuardR\arequest\x12Y\n" +
"\bresponse\x18\x02 \x03(\v2=.agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuardR\bresponse\x1a\xfd\x01\n" +
"\bresponse\x18\x02 \x03(\v2=.agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuardR\bresponse\x1a\xad\x01\n" +
"\rPromptCaching\x12!\n" +
"\fcache_system\x18\x01 \x01(\bR\vcacheSystem\x12%\n" +
"\x0ecache_messages\x18\x02 \x01(\bR\rcacheMessages\x12\x1f\n" +
"\vcache_tools\x18\x03 \x01(\bR\n" +
"cacheTools\x12\"\n" +
"\n" +
"min_tokens\x18\x04 \x01(\rH\x00R\tminTokens\x88\x01\x01\x125\n" +
"\x14cache_message_offset\x18\x05 \x01(\rH\x01R\x12cacheMessageOffset\x88\x01\x01B\r\n" +
"\v_min_tokensB\x17\n" +
"\x15_cache_message_offset\x1a;\n" +
"min_tokens\x18\x04 \x01(\rH\x00R\tminTokens\x88\x01\x01B\r\n" +
"\v_min_tokens\x1a;\n" +
"\rDefaultsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a<\n" +
@ -12271,14 +12261,14 @@ var file_resource_proto_goTypes = []any{
(*TrafficPolicySpec_HostRewrite)(nil), // 117: agentgateway.dev.resource.TrafficPolicySpec.HostRewrite
(*TrafficPolicySpec_RemoteRateLimit_Descriptor)(nil), // 118: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor
(*TrafficPolicySpec_RemoteRateLimit_Entry)(nil), // 119: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Entry
(*TrafficPolicySpec_ExternalAuth_BodyOptions)(nil), // 120: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.BodyOptions
(*TrafficPolicySpec_ExternalAuth_GRPCProtocol)(nil), // 121: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol
(*TrafficPolicySpec_ExternalAuth_HTTPProtocol)(nil), // 122: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol
nil, // 123: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.ContextEntry
nil, // 124: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.MetadataEntry
nil, // 125: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.AddRequestHeadersEntry
nil, // 126: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.MetadataEntry
(*TrafficPolicySpec_JWT_MCP)(nil), // 127: agentgateway.dev.resource.TrafficPolicySpec.JWT.MCP
(*TrafficPolicySpec_RemoteRateLimit_LimitOverride)(nil), // 120: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.LimitOverride
(*TrafficPolicySpec_ExternalAuth_BodyOptions)(nil), // 121: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.BodyOptions
(*TrafficPolicySpec_ExternalAuth_GRPCProtocol)(nil), // 122: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol
(*TrafficPolicySpec_ExternalAuth_HTTPProtocol)(nil), // 123: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol
nil, // 124: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.ContextEntry
nil, // 125: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.MetadataEntry
nil, // 126: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.AddRequestHeadersEntry
nil, // 127: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.MetadataEntry
(*TrafficPolicySpec_APIKey_User)(nil), // 128: agentgateway.dev.resource.TrafficPolicySpec.APIKey.User
(*TrafficPolicySpec_TransformationPolicy_Transform)(nil), // 129: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform
nil, // 130: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.MetadataEntry
@ -12487,103 +12477,101 @@ var file_resource_proto_depIdxs = []int32{
180, // 148: agentgateway.dev.resource.TrafficPolicySpec.LocalRateLimit.fill_interval:type_name -> google.protobuf.Duration
11, // 149: agentgateway.dev.resource.TrafficPolicySpec.LocalRateLimit.type:type_name -> agentgateway.dev.resource.TrafficPolicySpec.LocalRateLimit.Type
84, // 150: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.target:type_name -> agentgateway.dev.resource.BackendReference
121, // 151: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.grpc:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol
122, // 152: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.http:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol
122, // 151: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.grpc:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol
123, // 152: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.http:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol
12, // 153: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.failure_mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.FailureMode
120, // 154: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.include_request_body:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.BodyOptions
121, // 154: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.include_request_body:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.BodyOptions
74, // 155: agentgateway.dev.resource.TrafficPolicySpec.JWTProvider.jwt_validation_options:type_name -> agentgateway.dev.resource.JWTValidationOptions
13, // 156: agentgateway.dev.resource.TrafficPolicySpec.JWT.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.JWT.Mode
108, // 157: agentgateway.dev.resource.TrafficPolicySpec.JWT.providers:type_name -> agentgateway.dev.resource.TrafficPolicySpec.JWTProvider
127, // 158: agentgateway.dev.resource.TrafficPolicySpec.JWT.mcp:type_name -> agentgateway.dev.resource.TrafficPolicySpec.JWT.MCP
14, // 159: agentgateway.dev.resource.TrafficPolicySpec.BasicAuthentication.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.BasicAuthentication.Mode
128, // 160: agentgateway.dev.resource.TrafficPolicySpec.APIKey.api_keys:type_name -> agentgateway.dev.resource.TrafficPolicySpec.APIKey.User
15, // 161: agentgateway.dev.resource.TrafficPolicySpec.APIKey.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.APIKey.Mode
129, // 162: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.request:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform
129, // 163: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.response:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform
84, // 164: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.target:type_name -> agentgateway.dev.resource.BackendReference
16, // 165: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.failure_mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.FailureMode
131, // 166: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.request_attributes:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.RequestAttributesEntry
132, // 167: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.response_attributes:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.ResponseAttributesEntry
134, // 168: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.metadata_context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.MetadataContextEntry
17, // 169: agentgateway.dev.resource.TrafficPolicySpec.HostRewrite.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HostRewrite.Mode
119, // 170: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor.entries:type_name -> agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Entry
9, // 171: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor.type:type_name -> agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Type
123, // 172: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.ContextEntry
124, // 173: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.MetadataEntry
125, // 174: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.add_request_headers:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.AddRequestHeadersEntry
126, // 175: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.MetadataEntry
24, // 176: agentgateway.dev.resource.TrafficPolicySpec.JWT.MCP.provider:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.McpIDP
165, // 177: agentgateway.dev.resource.TrafficPolicySpec.JWT.MCP.resource_metadata:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata
181, // 178: agentgateway.dev.resource.TrafficPolicySpec.APIKey.User.metadata:type_name -> google.protobuf.Struct
113, // 179: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.set:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HeaderTransformation
113, // 180: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.add:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HeaderTransformation
114, // 181: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.body:type_name -> agentgateway.dev.resource.TrafficPolicySpec.BodyTransformation
130, // 182: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.MetadataEntry
135, // 183: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext.context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext.ContextEntry
133, // 184: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.MetadataContextEntry.value:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext
158, // 185: agentgateway.dev.resource.BackendPolicySpec.Ai.prompt_guard:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard
160, // 186: agentgateway.dev.resource.BackendPolicySpec.Ai.defaults:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.DefaultsEntry
161, // 187: agentgateway.dev.resource.BackendPolicySpec.Ai.overrides:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.OverridesEntry
162, // 188: agentgateway.dev.resource.BackendPolicySpec.Ai.transformations:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.TransformationsEntry
148, // 189: agentgateway.dev.resource.BackendPolicySpec.Ai.prompts:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment
163, // 190: agentgateway.dev.resource.BackendPolicySpec.Ai.model_aliases:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ModelAliasesEntry
159, // 191: agentgateway.dev.resource.BackendPolicySpec.Ai.prompt_caching:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptCaching
164, // 192: agentgateway.dev.resource.BackendPolicySpec.Ai.routes:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RoutesEntry
84, // 193: agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.endpoint_picker:type_name -> agentgateway.dev.resource.BackendReference
21, // 194: agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.failure_mode:type_name -> agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.FailureMode
180, // 195: agentgateway.dev.resource.BackendPolicySpec.Eviction.duration:type_name -> google.protobuf.Duration
139, // 196: agentgateway.dev.resource.BackendPolicySpec.Health.eviction:type_name -> agentgateway.dev.resource.BackendPolicySpec.Eviction
22, // 197: agentgateway.dev.resource.BackendPolicySpec.BackendTLS.verification:type_name -> agentgateway.dev.resource.BackendPolicySpec.BackendTLS.VerificationMode
85, // 198: agentgateway.dev.resource.BackendPolicySpec.BackendTLS.alpn:type_name -> agentgateway.dev.resource.Alpn
23, // 199: agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.version:type_name -> agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.HttpVersion
180, // 200: agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.request_timeout:type_name -> google.protobuf.Duration
84, // 201: agentgateway.dev.resource.BackendPolicySpec.BackendTunnel.proxy:type_name -> agentgateway.dev.resource.BackendReference
72, // 202: agentgateway.dev.resource.BackendPolicySpec.BackendTCP.keepalive:type_name -> agentgateway.dev.resource.KeepaliveConfig
180, // 203: agentgateway.dev.resource.BackendPolicySpec.BackendTCP.connect_timeout:type_name -> google.protobuf.Duration
24, // 204: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.provider:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.McpIDP
165, // 205: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.resource_metadata:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata
25, // 206: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.mode:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.Mode
74, // 207: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.jwt_validation_options:type_name -> agentgateway.dev.resource.JWTValidationOptions
147, // 208: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment.append:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Message
147, // 209: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment.prepend:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Message
18, // 210: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRule.builtin:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BuiltinRegexRule
19, // 211: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules.action:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ActionKind
149, // 212: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules.rules:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRule
84, // 213: agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook.backend:type_name -> agentgateway.dev.resource.BackendReference
62, // 214: agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook.forward_header_matches:type_name -> agentgateway.dev.resource.HeaderMatch
76, // 215: agentgateway.dev.resource.BackendPolicySpec.Ai.Moderation.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
76, // 216: agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
76, // 217: agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
155, // 218: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.rejection:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestRejection
150, // 219: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.regex:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules
151, // 220: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.webhook:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook
154, // 221: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.google_model_armor:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor
153, // 222: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.bedrock_guardrails:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails
155, // 223: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.rejection:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestRejection
150, // 224: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.regex:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules
151, // 225: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.webhook:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook
152, // 226: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.openai_moderation:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Moderation
154, // 227: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.google_model_armor:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor
153, // 228: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.bedrock_guardrails:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails
157, // 229: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard.request:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard
156, // 230: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard.response:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard
20, // 231: agentgateway.dev.resource.BackendPolicySpec.Ai.RoutesEntry.value:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RouteType
166, // 232: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.extra:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.ExtraEntry
182, // 233: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.ExtraEntry.value:type_name -> google.protobuf.Value
167, // 234: agentgateway.dev.resource.AIBackend.Provider.host_override:type_name -> agentgateway.dev.resource.AIBackend.HostOverride
168, // 235: agentgateway.dev.resource.AIBackend.Provider.openai:type_name -> agentgateway.dev.resource.AIBackend.OpenAI
169, // 236: agentgateway.dev.resource.AIBackend.Provider.gemini:type_name -> agentgateway.dev.resource.AIBackend.Gemini
170, // 237: agentgateway.dev.resource.AIBackend.Provider.vertex:type_name -> agentgateway.dev.resource.AIBackend.Vertex
171, // 238: agentgateway.dev.resource.AIBackend.Provider.anthropic:type_name -> agentgateway.dev.resource.AIBackend.Anthropic
172, // 239: agentgateway.dev.resource.AIBackend.Provider.bedrock:type_name -> agentgateway.dev.resource.AIBackend.Bedrock
173, // 240: agentgateway.dev.resource.AIBackend.Provider.azureopenai:type_name -> agentgateway.dev.resource.AIBackend.AzureOpenAI
76, // 241: agentgateway.dev.resource.AIBackend.Provider.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
174, // 242: agentgateway.dev.resource.AIBackend.ProviderGroup.providers:type_name -> agentgateway.dev.resource.AIBackend.Provider
243, // [243:243] is the sub-list for method output_type
243, // [243:243] is the sub-list for method input_type
243, // [243:243] is the sub-list for extension type_name
243, // [243:243] is the sub-list for extension extendee
0, // [0:243] is the sub-list for field type_name
14, // 158: agentgateway.dev.resource.TrafficPolicySpec.BasicAuthentication.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.BasicAuthentication.Mode
128, // 159: agentgateway.dev.resource.TrafficPolicySpec.APIKey.api_keys:type_name -> agentgateway.dev.resource.TrafficPolicySpec.APIKey.User
15, // 160: agentgateway.dev.resource.TrafficPolicySpec.APIKey.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.APIKey.Mode
129, // 161: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.request:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform
129, // 162: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.response:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform
84, // 163: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.target:type_name -> agentgateway.dev.resource.BackendReference
16, // 164: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.failure_mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.FailureMode
131, // 165: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.request_attributes:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.RequestAttributesEntry
132, // 166: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.response_attributes:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.ResponseAttributesEntry
134, // 167: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.metadata_context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.MetadataContextEntry
17, // 168: agentgateway.dev.resource.TrafficPolicySpec.HostRewrite.mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HostRewrite.Mode
119, // 169: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor.entries:type_name -> agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Entry
9, // 170: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor.type:type_name -> agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Type
120, // 171: agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.Descriptor.limit_override:type_name -> agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.LimitOverride
124, // 172: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.ContextEntry
125, // 173: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.GRPCProtocol.MetadataEntry
126, // 174: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.add_request_headers:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.AddRequestHeadersEntry
127, // 175: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.HTTPProtocol.MetadataEntry
181, // 176: agentgateway.dev.resource.TrafficPolicySpec.APIKey.User.metadata:type_name -> google.protobuf.Struct
113, // 177: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.set:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HeaderTransformation
113, // 178: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.add:type_name -> agentgateway.dev.resource.TrafficPolicySpec.HeaderTransformation
114, // 179: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.body:type_name -> agentgateway.dev.resource.TrafficPolicySpec.BodyTransformation
130, // 180: agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.metadata:type_name -> agentgateway.dev.resource.TrafficPolicySpec.TransformationPolicy.Transform.MetadataEntry
135, // 181: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext.context:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext.ContextEntry
133, // 182: agentgateway.dev.resource.TrafficPolicySpec.ExtProc.MetadataContextEntry.value:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExtProc.NamespacedMetadataContext
158, // 183: agentgateway.dev.resource.BackendPolicySpec.Ai.prompt_guard:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard
160, // 184: agentgateway.dev.resource.BackendPolicySpec.Ai.defaults:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.DefaultsEntry
161, // 185: agentgateway.dev.resource.BackendPolicySpec.Ai.overrides:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.OverridesEntry
162, // 186: agentgateway.dev.resource.BackendPolicySpec.Ai.transformations:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.TransformationsEntry
148, // 187: agentgateway.dev.resource.BackendPolicySpec.Ai.prompts:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment
163, // 188: agentgateway.dev.resource.BackendPolicySpec.Ai.model_aliases:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ModelAliasesEntry
159, // 189: agentgateway.dev.resource.BackendPolicySpec.Ai.prompt_caching:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.PromptCaching
164, // 190: agentgateway.dev.resource.BackendPolicySpec.Ai.routes:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RoutesEntry
84, // 191: agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.endpoint_picker:type_name -> agentgateway.dev.resource.BackendReference
21, // 192: agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.failure_mode:type_name -> agentgateway.dev.resource.BackendPolicySpec.InferenceRouting.FailureMode
180, // 193: agentgateway.dev.resource.BackendPolicySpec.Eviction.duration:type_name -> google.protobuf.Duration
139, // 194: agentgateway.dev.resource.BackendPolicySpec.Health.eviction:type_name -> agentgateway.dev.resource.BackendPolicySpec.Eviction
22, // 195: agentgateway.dev.resource.BackendPolicySpec.BackendTLS.verification:type_name -> agentgateway.dev.resource.BackendPolicySpec.BackendTLS.VerificationMode
85, // 196: agentgateway.dev.resource.BackendPolicySpec.BackendTLS.alpn:type_name -> agentgateway.dev.resource.Alpn
23, // 197: agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.version:type_name -> agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.HttpVersion
180, // 198: agentgateway.dev.resource.BackendPolicySpec.BackendHTTP.request_timeout:type_name -> google.protobuf.Duration
84, // 199: agentgateway.dev.resource.BackendPolicySpec.BackendTunnel.proxy:type_name -> agentgateway.dev.resource.BackendReference
72, // 200: agentgateway.dev.resource.BackendPolicySpec.BackendTCP.keepalive:type_name -> agentgateway.dev.resource.KeepaliveConfig
180, // 201: agentgateway.dev.resource.BackendPolicySpec.BackendTCP.connect_timeout:type_name -> google.protobuf.Duration
24, // 202: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.provider:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.McpIDP
165, // 203: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.resource_metadata:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata
25, // 204: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.mode:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.Mode
74, // 205: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.jwt_validation_options:type_name -> agentgateway.dev.resource.JWTValidationOptions
147, // 206: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment.append:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Message
147, // 207: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptEnrichment.prepend:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Message
18, // 208: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRule.builtin:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BuiltinRegexRule
19, // 209: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules.action:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ActionKind
149, // 210: agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules.rules:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRule
84, // 211: agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook.backend:type_name -> agentgateway.dev.resource.BackendReference
62, // 212: agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook.forward_header_matches:type_name -> agentgateway.dev.resource.HeaderMatch
76, // 213: agentgateway.dev.resource.BackendPolicySpec.Ai.Moderation.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
76, // 214: agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
76, // 215: agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
155, // 216: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.rejection:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestRejection
150, // 217: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.regex:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules
151, // 218: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.webhook:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook
154, // 219: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.google_model_armor:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor
153, // 220: agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard.bedrock_guardrails:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails
155, // 221: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.rejection:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestRejection
150, // 222: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.regex:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RegexRules
151, // 223: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.webhook:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Webhook
152, // 224: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.openai_moderation:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.Moderation
154, // 225: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.google_model_armor:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.GoogleModelArmor
153, // 226: agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard.bedrock_guardrails:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.BedrockGuardrails
157, // 227: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard.request:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RequestGuard
156, // 228: agentgateway.dev.resource.BackendPolicySpec.Ai.PromptGuard.response:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuard
20, // 229: agentgateway.dev.resource.BackendPolicySpec.Ai.RoutesEntry.value:type_name -> agentgateway.dev.resource.BackendPolicySpec.Ai.RouteType
166, // 230: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.extra:type_name -> agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.ExtraEntry
182, // 231: agentgateway.dev.resource.BackendPolicySpec.McpAuthentication.ResourceMetadata.ExtraEntry.value:type_name -> google.protobuf.Value
167, // 232: agentgateway.dev.resource.AIBackend.Provider.host_override:type_name -> agentgateway.dev.resource.AIBackend.HostOverride
168, // 233: agentgateway.dev.resource.AIBackend.Provider.openai:type_name -> agentgateway.dev.resource.AIBackend.OpenAI
169, // 234: agentgateway.dev.resource.AIBackend.Provider.gemini:type_name -> agentgateway.dev.resource.AIBackend.Gemini
170, // 235: agentgateway.dev.resource.AIBackend.Provider.vertex:type_name -> agentgateway.dev.resource.AIBackend.Vertex
171, // 236: agentgateway.dev.resource.AIBackend.Provider.anthropic:type_name -> agentgateway.dev.resource.AIBackend.Anthropic
172, // 237: agentgateway.dev.resource.AIBackend.Provider.bedrock:type_name -> agentgateway.dev.resource.AIBackend.Bedrock
173, // 238: agentgateway.dev.resource.AIBackend.Provider.azureopenai:type_name -> agentgateway.dev.resource.AIBackend.AzureOpenAI
76, // 239: agentgateway.dev.resource.AIBackend.Provider.inline_policies:type_name -> agentgateway.dev.resource.BackendPolicySpec
174, // 240: agentgateway.dev.resource.AIBackend.ProviderGroup.providers:type_name -> agentgateway.dev.resource.AIBackend.Provider
241, // [241:241] is the sub-list for method output_type
241, // [241:241] is the sub-list for method input_type
241, // [241:241] is the sub-list for extension type_name
241, // [241:241] is the sub-list for extension extendee
0, // [0:241] is the sub-list for field type_name
}
func init() { file_resource_proto_init() }
@ -12749,7 +12737,8 @@ func file_resource_proto_init() {
(*TrafficPolicySpec_JWTProvider_Inline)(nil),
}
file_resource_proto_msgTypes[80].OneofWrappers = []any{}
file_resource_proto_msgTypes[92].OneofWrappers = []any{}
file_resource_proto_msgTypes[88].OneofWrappers = []any{}
file_resource_proto_msgTypes[93].OneofWrappers = []any{}
file_resource_proto_msgTypes[109].OneofWrappers = []any{}
file_resource_proto_msgTypes[111].OneofWrappers = []any{}
file_resource_proto_msgTypes[119].OneofWrappers = []any{

View File

@ -743,6 +743,17 @@ func (this *TrafficPolicySpec_RemoteRateLimit_Entry) UnmarshalJSON(b []byte) err
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TrafficPolicySpec_RemoteRateLimit_LimitOverride
func (this *TrafficPolicySpec_RemoteRateLimit_LimitOverride) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for TrafficPolicySpec_RemoteRateLimit_LimitOverride
func (this *TrafficPolicySpec_RemoteRateLimit_LimitOverride) UnmarshalJSON(b []byte) error {
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TrafficPolicySpec_LocalRateLimit
func (this *TrafficPolicySpec_LocalRateLimit) MarshalJSON() ([]byte, error) {
str, err := ResourceMarshaler.MarshalToString(this)
@ -831,17 +842,6 @@ 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,6 +104,10 @@ 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,7 +461,6 @@ 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
@ -491,29 +490,18 @@ 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-$(HELM_CHART_VERSION_NO_V).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(VERSION).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-$(HELM_CHART_VERSION_NO_V).tgz \
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(VERSION).tgz \
--namespace $(INSTALL_NAMESPACE) --create-namespace \
--set image.registry=$(IMAGE_REGISTRY) \
--set image.tag=$(VERSION) \

View File

@ -1,7 +1,4 @@
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 = "agentgateway.dev/mcp-path"
const MCPServiceHTTPPath = "kgateway.dev/mcp-path"

View File

@ -161,6 +161,13 @@ 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,6 +27,9 @@ 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",
@ -71,6 +74,9 @@ func TestSettings(t *testing.T) {
AgentgatewayXdsServicePort: 9978,
NoListenersDummyPort: 443,
EnableInferExt: false,
DefaultImageRegistry: "cr.agentgateway.dev",
DefaultImageTag: "",
DefaultImagePullPolicy: "IfNotPresent",
LogLevel: "info",
DiscoveryNamespaceSelectors: "[]",
EnableBuiltinDefaultMetrics: false,
@ -99,6 +105,9 @@ 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,
@ -179,6 +188,9 @@ 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,28 +41,6 @@ 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
@ -95,47 +73,4 @@ spec:
ai:
provider:
openai: {}
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: {}
host: example.com

View File

@ -63,20 +63,6 @@ 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
@ -85,6 +71,12 @@ spec:
port: 443
policies:
tls: {}
mcp:
authorization:
action: Deny
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
- name: k8s
selector:
namespaces:
@ -145,23 +137,10 @@ spec:
static:
host: example.com
port: 443
policies:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'
---
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: mcp-backend-ref
spec:
mcp:
targets:
- name: local-svc
static:
backendRef:
name: mcp-service
port: 8080
policies:
mcp:
authorization:
action: Require
policy:
matchExpressions:
- 'mcp.tool.name == "hello"'

View File

@ -294,21 +294,6 @@ 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
@ -434,28 +419,6 @@ 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,7 +1,6 @@
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"
)
@ -418,18 +417,10 @@ 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.
// +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"`
// +required
Host ShortString `json:"host"`
// Port is the port number of the MCP target.
// +kubebuilder:validation:Minimum=1
@ -452,10 +443,8 @@ 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 *BackendSimple `json:"policies,omitempty"`
Policies *BackendWithMCP `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,omitzero"`
Status gwv1.PolicyStatus `json:"status,omitempty"`
// TODO: embed this into a typed Status field when
// https://github.com/kubernetes/kubernetes/issues/131533 is resolved
}
@ -51,7 +51,6 @@ 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"
@ -220,6 +219,16 @@ 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"`
@ -241,10 +250,6 @@ 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"`
}
@ -661,24 +666,15 @@ 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 {
@ -700,19 +696,6 @@ 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,13 +401,4 @@ 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,6 +1218,27 @@ 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
@ -1878,11 +1899,6 @@ 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.
@ -1895,33 +1911,6 @@ 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
@ -2158,16 +2147,6 @@ 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)
@ -2180,7 +2159,7 @@ func (in *McpTarget) DeepCopyInto(out *McpTarget) {
}
if in.Policies != nil {
in, out := &in.Policies, &out.Policies
*out = new(BackendSimple)
*out = new(BackendWithMCP)
(*in).DeepCopyInto(*out)
}
}

View File

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/agentgateway/agentgateway/controller/pkg/setup"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/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"
"github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
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.20260402053555-4e9843ddb8d0|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
[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-20260407051556-b9f70d130eb6|Apache License 2.0
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260320151437-efc2b41130da|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,23 +6773,6 @@ 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.
@ -6810,8 +6793,6 @@ 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
@ -7042,6 +7023,223 @@ 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.
@ -7558,6 +7756,12 @@ 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
@ -7573,15 +7777,9 @@ 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
@ -12558,9 +12756,6 @@ 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,9 +5030,6 @@ 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
@ -7615,27 +7612,6 @@ 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.'
@ -7792,11 +7768,6 @@ 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`,
@ -8394,10 +8365,6 @@ 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,14 +44,6 @@ 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

@ -41,7 +41,6 @@ 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/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
)
// 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(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *collections.CommonCollections, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
logger.Info("creating jwks store")
jwksCache := NewJwksCache()
@ -43,7 +43,7 @@ func BuildJwksStore(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChange
jwksCache: jwksCache,
jwksChanges: jwksChanges,
jwksFetcher: NewJwksFetcher(jwksCache),
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, krtOpts),
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, commonCols.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: ref.Name,
Name: string(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,13 +12,12 @@ 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 (
legacyA2aProtocol = "kgateway.dev/a2a"
a2aProtocol = "agentgateway.dev/a2a"
a2aProtocol = "kgateway.dev/a2a"
)
// NewA2APlugin creates a new A2A policy plugin
@ -49,8 +48,7 @@ func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service,
}).UnsortedList()
for _, port := range svc.Spec.Ports {
// support legacy kgateway.dev/a2a and agentgateway.dev/a2a
if port.AppProtocol != nil && (*port.AppProtocol == a2aProtocol || *port.AppProtocol == legacyA2aProtocol) {
if port.AppProtocol != nil && *port.AppProtocol == a2aProtocol {
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(*armor.Location)
pgArmor.Location = ptr.Of(string(*armor.Location))
} else {
pgArmor.Location = ptr.Of("us-central1")
}

View File

@ -12,7 +12,6 @@ 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"
@ -20,8 +19,9 @@ 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 := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
if _, err := sslutils.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 := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
pem, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
if err != nil {
errs = append(errs, fmt.Errorf("error extracting CA cert from ConfigMap %s: %w", nn, err))
continue
@ -417,36 +417,15 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
authnPolicy := policy.Spec.Backend.MCP.Authentication
mcpAuthn, err := translateMCPAuthenticationSpec(ctx, types.NamespacedName{
Namespace: policy.Namespace,
Name: policy.Name,
}, authnPolicy)
mcpAuthnPolicy := &api.Policy{
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix,
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
Kind: &api.Policy_Backend{
Backend: &api.BackendPolicySpec{
Kind: &api.BackendPolicySpec_McpAuthentication_{
McpAuthentication: mcpAuthn,
},
},
},
idp := api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
if authnPolicy.McpIDP != nil {
if *authnPolicy.McpIDP == agentgateway.Keycloak {
idp = api.BackendPolicySpec_McpAuthentication_KEYCLOAK
} else if *authnPolicy.McpIDP == agentgateway.Auth0 {
idp = api.BackendPolicySpec_McpAuthentication_AUTH0
}
}
logger.Debug("generated MCP authentication policy",
"policy", policy.Name,
"agentgateway_policy", mcpAuthnPolicy.Name)
return mcpAuthnPolicy, err
}
func translateMCPAuthenticationSpec(
ctx PolicyCtx,
policy types.NamespacedName,
authnPolicy *agentgateway.MCPAuthentication,
) (*api.BackendPolicySpec_McpAuthentication, error) {
idp := translateMcpIDP(authnPolicy.McpIDP)
// default mode is Strict
mode := api.BackendPolicySpec_McpAuthentication_STRICT
if authnPolicy.Mode == agentgateway.JWTAuthenticationModeStrict {
@ -472,55 +451,8 @@ func translateMCPAuthenticationSpec(
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 resourceMetadata {
for k, v := range authnPolicy.ResourceMetadata {
if extraResourceMetadata == nil {
extraResourceMetadata = make(map[string]*structpb.Value)
}
@ -535,7 +467,34 @@ func translateMCPResourceMetadata(resourceMetadata map[string]apiextensionsv1.JS
extraResourceMetadata[k] = proto
}
return extraResourceMetadata, errors.Join(errs...)
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...)
}
// translateBackendAI processes AI configuration and creates corresponding Agw policies
@ -622,9 +581,6 @@ 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/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
)
// NewBackendTLSPlugin creates a new BackendTLSPolicy plugin
@ -130,14 +130,16 @@ func translatePoliciesForBackendTLS(
}
}
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(),
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
}
// We cannot send this policy to agentgateway, as it would not know the priority logic.
continue
}
switch string(target.Kind) {
@ -209,7 +211,7 @@ func translatePoliciesForBackendTLS(
if scrt == nil {
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
} else {
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
if _, err := sslutils.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]
@ -252,9 +254,9 @@ func translatePoliciesForBackendTLS(
func checkConflicted(
btls *gwv1.BackendTLSPolicy,
target gwv1.LocalPolicyTargetReferenceWithSectionName,
allMatches []*gwv1.BackendTLSPolicy,
allMatches *krt.IndexObject[utils.TypedNamespacedName, *gwv1.BackendTLSPolicy],
) error {
for _, m := range allMatches {
for _, m := range allMatches.Objects {
if m.UID == btls.UID {
// This is ourself, skip it
continue
@ -351,7 +353,7 @@ func getBackendTLSCACert(
}
return nil, fmt.Errorf("certificate reference not found: %v", ref)
}
caCert, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
caCert, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
if err != nil {
conds[string(gwv1.BackendTLSPolicyReasonResolvedRefs)].error = &ConfigError{
Reason: string(gwv1.BackendTLSPolicyReasonInvalidCACertificateRef),

View File

@ -7,7 +7,6 @@ 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"
@ -15,23 +14,18 @@ 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]
@ -82,108 +76,82 @@ type AgwCollections struct {
// Collections that rely on plugins aren't initialized here,
// and InitPlugins must be called.
func NewAgwCollections(
krtOptions krtutil.KrtOptions,
client apiclient.Client,
commoncol *collections.CommonCollections,
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: 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,
Client: commoncol.Client,
KrtOpts: commoncol.KrtOpts,
ControllerName: agwControllerName,
SystemNamespace: systemNamespace,
IstioNamespace: commoncol.Settings.IstioNamespace,
IstioRevision: commoncol.Settings.IstioRevision,
ClusterID: clusterID,
// Core Kubernetes resources
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{
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{
ObjectTransform: istiokube.StripPodUnusedFields,
ObjectFilter: client.ObjectFilter(),
}, krtOptions.ToOptions("informer/Pods")...),
ObjectFilter: commoncol.Client.ObjectFilter(),
}, commoncol.KrtOpts.ToOptions("informer/Pods")...),
Secrets: krt.WrapClient(
kclient.NewFiltered[*corev1.Secret](client, kubetypes.Filter{
FieldSelector: apiclient.SecretsFieldSelector,
ObjectFilter: client.ObjectFilter(),
kclient.NewFiltered[*corev1.Secret](commoncol.Client, kubetypes.Filter{
ObjectFilter: commoncol.Client.ObjectFilter(),
}),
),
ConfigMaps: krt.WrapClient(
kclient.NewFiltered[*corev1.ConfigMap](client, kubetypes.Filter{
ObjectFilter: client.ObjectFilter(),
kclient.NewFiltered[*corev1.ConfigMap](commoncol.Client, kubetypes.Filter{
ObjectFilter: commoncol.Client.ObjectFilter(),
}),
krtOptions.ToOptions("informer/ConfigMaps")...,
commoncol.KrtOpts.ToOptions("informer/ConfigMaps")...,
),
Services: krt.WrapClient(
kclient.NewFiltered[*corev1.Service](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/Services")...),
kclient.NewFiltered[*corev1.Service](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/Services")...),
EndpointSlices: krt.WrapClient(
kclient.NewFiltered[*discovery.EndpointSlice](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/EndpointSlices")...),
kclient.NewFiltered[*discovery.EndpointSlice](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/EndpointSlices")...),
// Istio resources
WorkloadEntries: krt.WrapClient(
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/WorkloadEntries")...),
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](commoncol.Client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/WorkloadEntries")...),
ServiceEntries: krt.WrapClient(
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
krtOptions.ToOptions("informer/ServiceEntries")...),
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](commoncol.Client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
commoncol.KrtOpts.ToOptions("informer/ServiceEntries")...),
// Gateway API resources
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,
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")...),
// Gateway API alpha
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")...),
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")...),
// 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, krtOptions.ToOptions("disable/inferencepools")...),
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, commoncol.KrtOpts.ToOptions("disable/inferencepools")...),
// agentgateway-specific CRDs
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](client),
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](client),
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](commoncol.Client),
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](commoncol.Client),
}
if settings.EnableInferExt {
if commoncol.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](client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/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.SetupIndexes()
@ -194,7 +162,3 @@ 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/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
)
const (
@ -128,7 +128,7 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
var path *string
if tracing.Path != nil {
path = ptr.Of(*tracing.Path)
path = ptr.Of(string(*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(*otlp.Path)
path = ptr.Of(string(*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 = wellknown.ServiceKind
kind = inf.Kind(wellknown.ServiceKind)
}
if kind != wellknown.ServiceKind {
if kind != inf.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: defaultInferencePoolStatusKind,
Name: defaultInferencePoolStatusName,
Kind: inf.Kind(defaultInferencePoolStatusKind),
Name: inf.ObjectName(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: wellknown.GatewayKind,
Kind: inf.Kind(wellknown.GatewayKind),
Namespace: inf.Namespace(g.Namespace),
Name: inf.ObjectName(g.Name),
})

View File

@ -13,13 +13,12 @@ import (
"github.com/agentgateway/agentgateway/api"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"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)
}
@ -44,29 +43,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
},
@ -276,13 +275,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 krtutil.FetchIndexObjects(ctx, p.attachments, object) {
for _, ancestor := range krt.FetchOne(ctx, p.attachments, krt.FilterKey(object.String())).Objects {
gateways.Insert(ancestor.Gateway)
}
return gateways
default:
gateways := sets.New[types.NamespacedName]()
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.Ancestors, object) {
for _, ancestor := range krt.FetchOne(ctx, p.Ancestors, krt.FilterKey(object.String())).Objects {
gateways.Insert(ancestor.Gateway)
}
return gateways
@ -290,19 +289,21 @@ 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, sets.New[utils.TypedNamespacedName]())
return p.lookupGatewaysForBackend(ctx, object, map[string]struct{}{})
}
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen sets.Set[utils.TypedNamespacedName]) sets.Set[types.NamespacedName] {
if seen.InsertContains(object) {
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 {
return sets.New[types.NamespacedName]()
}
seen[key] = struct{}{}
base := p.LookupGatewaysForTarget(ctx, object)
if p.PolicyAttachments == nil {
return base
}
for _, pref := range krtutil.FetchIndexObjects(ctx, p.PolicyAttachments, object) {
for _, pref := range krt.FetchOne(ctx, p.PolicyAttachments, krt.FilterKey(key)).Objects {
base = base.Union(p.lookupGatewaysForBackend(ctx, pref.Target, seen))
}
return base
@ -313,7 +314,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

@ -1,109 +0,0 @@
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

@ -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,27 +135,25 @@ 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)}
policyTargets, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
if len(policyTargets) == 0 {
policyTarget, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
if policyTarget == nil {
// This should be impossible, verified by CEL validation
logger.Warn("unsupported target kind", "kind", target.Kind, "policy", policy.Name)
continue
}
gatewayTargets := references.LookupGatewaysForBackend(ctx, utils.TypedNamespacedName{
gatewayTargets := references.LookupGatewaysForTarget(ctx, utils.TypedNamespacedName{
NamespacedName: types.NamespacedName{Namespace: policy.Namespace, Name: string(target.Name)},
Kind: gk.Kind,
}).UnsortedList()
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,
})
}
translatedPolicies := clonePoliciesForTarget(baseTranslatedPolicies, policyTarget)
for _, translatedPolicy := range translatedPolicies {
for _, gatewayTarget := range gatewayTargets {
agwPolicies = append(agwPolicies, AgwPolicy{
Gateway: ptr.Of(gatewayTarget),
Policy: translatedPolicy,
})
}
}
@ -304,7 +302,7 @@ func resolvePolicyAncestorRefs(
NamespacedName: types.NamespacedName{Namespace: policyNamespace, Name: string(targetName)},
Kind: targetGK.Kind,
}
gatewayTargets := references.LookupGatewaysForBackend(ctx, object).UnsortedList()
gatewayTargets := references.LookupGatewaysForTarget(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)
}
@ -590,19 +588,6 @@ 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/syncer/status"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/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/controller"
"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/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, *syncer.Syncer) {
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *agentgatewaysyncer.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 := syncer.NewAgwSyncer(
syncer := agentgatewaysyncer.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/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/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/syncer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
)
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 syncer.Address) string {
a = slices.SortBy(a, func(a agentgatewaysyncer.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 = "NoMatchingParent"
reason = gwv1.RouteConditionReason("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 "Invalid"
return gwv1.RouteConditionReason("Invalid")
}
// buildAttachedRoutesMapAllowed is the same as buildAttachedRoutesMap,

View File

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

View File

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

View File

@ -1,64 +0,0 @@
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:
agentgateway.dev/mcp-http-path: /custom-path
kgateway.dev/mcp-http-path: /custom-path
spec:
ports:
- name: mcp
port: 8080
appProtocol: agentgateway.dev/mcp-sse
appProtocol: kgateway.dev/mcp-sse
---
# Output
output:

View File

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

View File

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

View File

@ -1,104 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,17 +0,0 @@
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/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
)
// RegisterTypes registers all the types used by our API Client

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

@ -16,11 +16,14 @@ 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()
@ -37,7 +40,7 @@ func TestDeployObjs(t *testing.T) {
getDeployer := func(t *testing.T, fc apiclient.Client, patcher deployer.Patcher) *deployer.Deployer {
t.Helper()
d, err := deployer.NewGatewayDeployer(
d, err := deployerinternal.NewGatewayDeployer(
wellknown.DefaultAgwControllerName,
wellknown.DefaultAgwClassName,
scheme,
@ -195,7 +198,7 @@ func TestPruneRemovedResources(t *testing.T) {
getDeployer := func(t *testing.T, fc apiclient.Client) *deployer.Deployer {
t.Helper()
d, err := deployer.NewGatewayDeployer(
d, err := deployerinternal.NewGatewayDeployer(
wellknown.DefaultAgwControllerName,
wellknown.DefaultAgwClassName,
scheme,

View File

@ -0,0 +1,19 @@
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,35 +1,18 @@
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"
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
"github.com/agentgateway/agentgateway/controller/pkg/helm"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
)
// 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
AgwCollections *agwplugins.AgwCollections
ImageInfo *ImageInfo
CommonCollections *collections.CommonCollections
AgentgatewayClassName string
AgentgatewayControllerName string
}
@ -41,220 +24,3 @@ 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/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
)
// ResourceOverlays contains all the overlays that can be applied to rendered objects.

View File

@ -24,6 +24,10 @@ 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
@ -44,7 +48,7 @@ func GetPortsValues(gw *collections.GatewayForDeployer, noListenersDummyPort int
if len(listenerPorts) == 0 && noListenersDummyPort != 0 {
port := noListenersDummyPort
portName := GenerateListenerNameFromPort(port)
portName := GenerateListenerNameFromPort(gwv1.PortNumber(port))
gwPorts = AppendPortValue(gwPorts, port, portName)
}

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/admin"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/admin"
)
func TestSnapshotResponseDataMarshalJSONString(t *testing.T) {

View File

@ -12,16 +12,18 @@ import (
"istio.io/istio/pkg/kube/krt"
"github.com/agentgateway/agentgateway/controller/pkg/controller"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/controller"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
"github.com/agentgateway/agentgateway/controller/pkg/version"
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
)
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) {
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) error {
// 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
@ -79,7 +81,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.AdminPort),
Addr: fmt.Sprintf("localhost:%d", wellknown.KgatewayAdminPort),
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
}

View File

@ -910,7 +910,7 @@ spec:
- protocol: TCP
port: 3001
targetPort: 3001
appProtocol: agentgateway.dev/mcp
appProtocol: kgateway.dev/mcp
type: ClusterIP
EOF
```
@ -1002,7 +1002,7 @@ spec:
ports:
- port: 80
targetPort: 8000
appProtocol: agentgateway.dev/mcp
appProtocol: kgateway.dev/mcp
EOF
```
@ -1044,11 +1044,11 @@ spec:
- protocol: TCP
port: 9090
targetPort: 9090
appProtocol: agentgateway.dev/a2a
appProtocol: kgateway.dev/a2a
EOF
```
Note, you must use `agentgateway.dev/a2a` as the app protocol for the kgateway control plane to configure agentgateway to use a2a.
Note, you must use `kgateway.dev/a2a` as the app protocol for the kgateway control plane to configure agentgateway to use a2a.
Apply the routing config:
```shell
@ -1539,7 +1539,7 @@ spec:
- protocol: TCP
port: 3001
targetPort: 3001
appProtocol: agentgateway.dev/mcp
appProtocol: kgateway.dev/mcp
type: ClusterIP
EOF
```
@ -1764,7 +1764,7 @@ EOF
```shell
kubectl apply -f- <<EOF
apiVersion: gateway.agentgateway.dev/v1alpha1
apiVersion: gateway.kgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: token-rate-limit
@ -1901,7 +1901,7 @@ EOF
```
#### Bedrock prompt caching
Enable Bedrock prompt caching via `AgentgatewayPolicy.spec.backend.ai.promptCaching` to reduce costs on repeated prompts and tool specs. Set `minTokens` to avoid caching short prompts; only Bedrock models support this feature. Use `cacheMessageOffset` to shift the message cache point further back in the conversation (0 = default second-to-last message; higher values move it N additional messages toward the start).
Enable Bedrock prompt caching via `AgentgatewayPolicy.spec.backend.ai.promptCaching` to reduce costs on repeated prompts and tool specs. Set `minTokens` to avoid caching short prompts; only Bedrock models support this feature.
```shell
kubectl apply -f- <<EOF

View File

@ -103,12 +103,6 @@ func TranslateMCPSelectorTargets(
targetName = service.Name + "-" + port.Name
}
path := service.Annotations[apiannotations.MCPServiceHTTPPath]
// use legacy annotation for backwards compatibility
if path == "" && service.Annotations[apiannotations.LegacyMCPServiceHTTPPath] != "" {
path = service.Annotations[apiannotations.LegacyMCPServiceHTTPPath]
}
svcHostname := kubeutils.ServiceFQDN(service.ObjectMeta)
mcpTargets = append(mcpTargets, &api.MCPTarget{
Name: targetName,
@ -122,27 +116,9 @@ func TranslateMCPSelectorTargets(
Port: uint32(port.Port), //nolint:gosec // G115: Kubernetes service ports are always positive
},
Protocol: toMCPProtocol(appProtocol),
Path: path,
Path: service.Annotations[apiannotations.MCPServiceHTTPPath],
})
}
}
return mcpTargets, nil
}
func ResolveMCPBackendRefHost(
ctx plugins.PolicyCtx,
namespace string,
ref *corev1.LocalObjectReference,
) (string, error) {
if ref == nil || ref.Name == "" {
return "", fmt.Errorf("mcp backendRef name is required")
}
key := namespace + "/" + ref.Name
service := ptr.Flatten(krt.FetchOne(ctx.Krt, ctx.Collections.Services, krt.FilterKey(key)))
if service == nil {
return "", fmt.Errorf("mcp backendRef service %s not found", key)
}
return kubeutils.ServiceFQDN(service.ObjectMeta), nil
}

View File

@ -20,8 +20,8 @@ import (
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/translator"
"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/wellknown"
)
var logger = logging.New("agentgateway/backend")
@ -92,8 +92,11 @@ func BuildAgwBackendReferences(
if mcp := backend.Spec.MCP; mcp != nil {
for _, r := range mcp.Targets {
if r.Static != nil && r.Static.Policies != nil {
p := r.Static.Policies
plugins.BackendReferencesFromBackendPolicy(&agentgateway.BackendFull{
BackendSimple: *r.Static.Policies,
BackendSimple: p.BackendSimple,
MCP: p.MCP,
AI: nil,
}, app)
}
}
@ -213,58 +216,22 @@ func TranslateMCPBackends(ctx plugins.PolicyCtx, be *agentgateway.AgentgatewayBa
var errs []error
for _, target := range mcp.Targets {
if s := target.Static; s != nil {
if s.BackendRef != nil {
serviceHostname, err := ResolveMCPBackendRefHost(ctx, be.Namespace, s.BackendRef)
if err != nil {
return nil, err
}
mcpTarget := &api.MCPTarget{
Name: string(target.Name),
Backend: &api.BackendReference{
Kind: &api.BackendReference_Service_{
Service: &api.BackendReference_Service{
Hostname: serviceHostname,
Namespace: be.Namespace,
},
},
Port: uint32(s.Port), //nolint:gosec // G115: validated by the CRD schema
},
Path: ptr.OrEmpty(s.Path),
}
switch ptr.OrEmpty(s.Protocol) {
case agentgateway.MCPProtocolSSE:
mcpTarget.Protocol = api.MCPTarget_SSE
case agentgateway.MCPProtocolStreamableHTTP:
mcpTarget.Protocol = api.MCPTarget_STREAMABLE_HTTP
}
mcpTargets = append(mcpTargets, mcpTarget)
continue
}
staticBackendRef := utils.InternalMCPStaticBackendName(be.Namespace, be.Name, string(target.Name))
pol, err := TranslateMCPBackendPolicies(ctx, be.Namespace, s.Policies)
if err != nil {
logger.Error("failed to translate static MCP backend policies", "err", err)
errs = append(errs, err)
}
staticBackend := &api.Backend{
Key: staticBackendRef,
Name: plugins.ResourceName(be),
Kind: &api.Backend_Static{
Static: &api.StaticBackend{
Host: ptr.OrEmpty(s.Host),
Port: s.Port,
Host: target.Static.Host,
Port: target.Static.Port,
},
},
}
if s.Policies != nil {
polt, err := TranslateBackendPolicies(ctx, be.Namespace, &agentgateway.BackendFull{
BackendSimple: *s.Policies,
})
if err != nil {
logger.Error("failed to translate static MCP backend policies", "err", err)
errs = append(errs, err)
}
staticBackend.InlinePolicies = polt
InlinePolicies: pol,
}
backends = append(backends, staticBackend)
@ -275,10 +242,10 @@ func TranslateMCPBackends(ctx plugins.PolicyCtx, be *agentgateway.AgentgatewayBa
Backend: staticBackendRef,
},
},
Path: ptr.OrEmpty(s.Path),
Path: ptr.OrEmpty(target.Static.Path),
}
switch ptr.OrEmpty(s.Protocol) {
switch ptr.OrEmpty(target.Static.Protocol) {
case agentgateway.MCPProtocolSSE:
mcpTarget.Protocol = api.MCPTarget_SSE
case agentgateway.MCPProtocolStreamableHTTP:
@ -381,6 +348,19 @@ func TranslateBackendPolicies(
return plugins.TranslateInlineBackendPolicy(ctx, namespace, policies)
}
func TranslateMCPBackendPolicies(
ctx plugins.PolicyCtx,
namespace string, policies *agentgateway.BackendWithMCP,
) ([]*api.BackendPolicySpec, error) {
if policies == nil {
return nil, nil
}
return TranslateBackendPolicies(ctx, namespace, &agentgateway.BackendFull{
BackendSimple: policies.BackendSimple,
MCP: policies.MCP,
})
}
func translateAIBackendPolicies(
ctx plugins.PolicyCtx,
namespace string, policies *agentgateway.BackendWithAI,

View File

@ -17,7 +17,7 @@ import (
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/backend"
agentgatewaybackend "github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/backend"
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
)
@ -41,7 +41,7 @@ func TestBuildMCP(t *testing.T) {
{
Name: "static-target",
Static: &agentgateway.McpTarget{
Host: shortStringPtr("mcp-server.example.com"),
Host: "mcp-server.example.com",
Port: 8080,
Path: stringPtr("override-sse"),
Protocol: ptr.Of(agentgateway.MCPProtocolSSE),
@ -132,81 +132,6 @@ func TestBuildMCP(t *testing.T) {
},
inputs: []any{createMockMCPServiceWithProtocol("test-ns", "mcp-service", "app=mcp-server", "agentgateway.dev/mcp")},
},
{
name: "Service selector MCPBackend backend - legacy annotation path",
backend: &agentgateway.AgentgatewayBackend{
ObjectMeta: metav1.ObjectMeta{
Name: "service-mcp-backend-legacy",
Namespace: "test-ns",
},
Spec: agentgateway.AgentgatewayBackendSpec{
MCP: &agentgateway.MCPBackend{
Targets: []agentgateway.McpTargetSelector{
{
Selector: &agentgateway.McpSelector{
Service: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "mcp-server-legacy",
},
},
},
},
},
},
},
},
inputs: []any{createMockMCPServiceWithLegacyAnnotation("test-ns", "mcp-service-legacy", "app=mcp-server-legacy", "/legacy/mcp/path")},
},
{
name: "Service selector MCPBackend backend - new annotation takes precedence",
backend: &agentgateway.AgentgatewayBackend{
ObjectMeta: metav1.ObjectMeta{
Name: "service-mcp-backend-precedence",
Namespace: "test-ns",
},
Spec: agentgateway.AgentgatewayBackendSpec{
MCP: &agentgateway.MCPBackend{
Targets: []agentgateway.McpTargetSelector{
{
Selector: &agentgateway.McpSelector{
Service: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "mcp-server-both",
},
},
},
},
},
},
},
},
inputs: []any{createMockMCPServiceWithBothAnnotations("test-ns", "mcp-service-both", "app=mcp-server-both", "/new/path", "/legacy/path")},
},
{
name: "Service backendRef MCPBackend backend - same namespace",
backend: &agentgateway.AgentgatewayBackend{
ObjectMeta: metav1.ObjectMeta{
Name: "service-ref-mcp-backend",
Namespace: "test-ns",
},
Spec: agentgateway.AgentgatewayBackendSpec{
MCP: &agentgateway.MCPBackend{
Targets: []agentgateway.McpTargetSelector{
{
Name: "service-ref-target",
Static: &agentgateway.McpTarget{
BackendRef: &corev1.LocalObjectReference{
Name: "mcp-service",
},
Port: 8080,
},
},
},
},
},
},
inputs: []any{createMockMCPService("test-ns", "mcp-service", "app=mcp-server")},
},
{
name: "Error case - invalid service selector",
backend: &agentgateway.AgentgatewayBackend{
@ -629,11 +554,6 @@ func stringPtr(s string) *string {
return &s
}
func shortStringPtr(s string) *agentgateway.ShortString {
v := agentgateway.ShortString(s)
return &v
}
// Helper function to create a mock SecretIndex for testing
func createMockSecret(namespace, name string, data map[string]string) *corev1.Secret {
// Create mock secret data
@ -824,81 +744,6 @@ func createMockMCPServiceWithProtocol(namespace, serviceName, _ /* labels */, ap
}
}
// createMockMCPServiceWithLegacyAnnotation creates a mock service with the legacy kgateway.dev/mcp-path annotation
func createMockMCPServiceWithLegacyAnnotation(namespace, serviceName, labels, legacyPath string) *corev1.Service {
// Parse labels
labelsMap := make(map[string]string)
if labels != "" {
// Simple parsing for "key=value" format
for _, label := range []string{labels} {
if len(label) > 0 {
parts := []string{"app", "mcp-server-legacy"} // hardcoded for test
if len(parts) == 2 {
labelsMap[parts[0]] = parts[1]
}
}
}
}
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: serviceName,
Namespace: namespace,
Labels: labelsMap,
Annotations: map[string]string{
"kgateway.dev/mcp-path": legacyPath,
},
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
},
},
},
}
}
// createMockMCPServiceWithBothAnnotations creates a mock service with both new and legacy annotations to test precedence
func createMockMCPServiceWithBothAnnotations(namespace, serviceName, labels, newPath, legacyPath string) *corev1.Service {
// Parse labels
labelsMap := make(map[string]string)
if labels != "" {
// Simple parsing for "key=value" format
for _, label := range []string{labels} {
if len(label) > 0 {
parts := []string{"app", "mcp-server-both"} // hardcoded for test
if len(parts) == 2 {
labelsMap[parts[0]] = parts[1]
}
}
}
}
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: serviceName,
Namespace: namespace,
Labels: labelsMap,
Annotations: map[string]string{
"agentgateway.dev/mcp-path": newPath,
"kgateway.dev/mcp-path": legacyPath,
},
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
},
},
},
}
}
// createMockMCPService creates a mock service collection with a specific MCPBackend service
func createMockMCPService(namespace, serviceName, labels string) *corev1.Service {
// Parse labels
@ -926,7 +771,7 @@ func createMockMCPService(namespace, serviceName, labels string) *corev1.Service
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
AppProtocol: ptr.Of("kgateway.dev/mcp"),
},
},
},
@ -950,7 +795,7 @@ func createMockMultipleNamespaceServices() []any {
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
AppProtocol: ptr.Of("kgateway.dev/mcp"),
},
},
},
@ -968,7 +813,7 @@ func createMockMultipleNamespaceServices() []any {
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
AppProtocol: ptr.Of("kgateway.dev/mcp"),
},
},
},
@ -986,7 +831,7 @@ func createMockMultipleNamespaceServices() []any {
{
Name: "mcp",
Port: 8080,
AppProtocol: ptr.Of("agentgateway.dev/mcp"),
AppProtocol: ptr.Of("kgateway.dev/mcp"),
},
},
},

View File

@ -1,4 +1,4 @@
package syncer
package agentgatewaysyncer
import (
"istio.io/istio/pkg/kube/controllers"

View File

@ -39,10 +39,10 @@ import (
_ "istio.io/istio/pkg/util/protomarshal" // Ensure we get the more efficient vtproto gRPC encoder
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/nack"
"github.com/agentgateway/agentgateway/controller/pkg/logging"
"github.com/agentgateway/agentgateway/controller/pkg/metrics"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/nack"
)
var (

View File

@ -21,32 +21,32 @@ import (
"github.com/agentgateway/agentgateway/api"
agwir "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/krtxds"
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
"github.com/agentgateway/agentgateway/controller/pkg/syncer/krtxds"
)
type Fake struct {
Server *krtxds.DiscoveryServer
Addresses krt.StaticCollection[syncer.Address]
Addresses krt.StaticCollection[agentgatewaysyncer.Address]
Resources krt.StaticCollection[agwir.AgwResource]
BufListener *bufconn.Listener
t *testing.T
}
func NewFakeDiscoveryServer(t *testing.T, initialAddress ...syncer.Address) Fake {
func NewFakeDiscoveryServer(t *testing.T, initialAddress ...agentgatewaysyncer.Address) Fake {
return NewFakeDiscoveryServerWith(t, initialAddress, nil)
}
func NewFakeDiscoveryServerWith(t *testing.T, initialAddress []syncer.Address, initialResource []agwir.AgwResource) Fake {
func NewFakeDiscoveryServerWith(t *testing.T, initialAddress []agentgatewaysyncer.Address, initialResource []agwir.AgwResource) Fake {
stop := test.NewStop(t)
opts := krtutil.NewKrtOptions(stop, new(krt.DebugHandler))
xdsAddress := krt.NewStaticCollection[syncer.Address](nil, initialAddress, opts.ToOptions("address")...)
xdsAddress := krt.NewStaticCollection[agentgatewaysyncer.Address](nil, initialAddress, opts.ToOptions("address")...)
xdsResource := krt.NewStaticCollection[agwir.AgwResource](nil, initialResource, opts.ToOptions("resource")...)
agwResourcesByGateway := func(resource agwir.AgwResource) types.NamespacedName {
return resource.Gateway
}
reg := []krtxds.Registration{
krtxds.Collection[syncer.Address, *workloadapi.Address](xdsAddress, opts),
krtxds.Collection[agentgatewaysyncer.Address, *workloadapi.Address](xdsAddress, opts),
krtxds.PerGatewayCollection[agwir.AgwResource, *api.Resource](xdsResource, agwResourcesByGateway, opts),
}
// we won't need a mock nack event publisher for this testing, so we pass nil
@ -108,8 +108,8 @@ func (f Fake) ConnectDeltaADS() *istioxds.DeltaAdsTest {
}
var (
testWorkload1 = syncer.Address{
Workload: ptr.Of(syncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl1"}})),
testWorkload1 = agentgatewaysyncer.Address{
Workload: ptr.Of(agentgatewaysyncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl1"}})),
}
)
@ -131,8 +131,8 @@ func TestXDSUpdate(t *testing.T) {
ads := s.ConnectDeltaADS().WithType(krtxds.TargetTypeAddressUrl)
ads.RequestResponseAck(nil)
wl1Updated := syncer.Address{
Workload: ptr.Of(syncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl1", ClusterId: "cluster1"}})),
wl1Updated := agentgatewaysyncer.Address{
Workload: ptr.Of(agentgatewaysyncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl1", ClusterId: "cluster1"}})),
}
s.Addresses.UpdateObject(wl1Updated)
resp := ads.ExpectResponse()
@ -153,8 +153,8 @@ func TestXDSDisconnect(t *testing.T) {
ads.RequestResponseAck(nil)
ads.Cleanup()
wl2 := syncer.Address{
Workload: ptr.Of(syncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl2", ClusterId: "cluster1"}})),
wl2 := agentgatewaysyncer.Address{
Workload: ptr.Of(agentgatewaysyncer.PrecomputeWorkload(model.WorkloadInfo{Workload: &workloadapi.Workload{Uid: "wl2", ClusterId: "cluster1"}})),
}
s.Addresses.DeleteObject("wl1")
s.Addresses.UpdateObject(wl2)

View File

@ -1,4 +1,4 @@
package syncer
package agentgatewaysyncer
import (
meshconfig "istio.io/api/mesh/v1alpha1"

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