Compare commits
62 Commits
fix-dynami
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34871c59e3 | ||
|
|
0d4b0a9f90 | ||
|
|
b7bb1a5a7c | ||
|
|
39c98f335b | ||
|
|
edbb343c98 | ||
|
|
a9491f891a | ||
|
|
ee83b193f7 | ||
|
|
0b1cb95c9d | ||
|
|
ac0005fb0d | ||
|
|
ead514fffd | ||
|
|
70042851d6 | ||
|
|
4cf848a9e9 | ||
|
|
0418247e7e | ||
|
|
28ead632fe | ||
|
|
ccc31c040b | ||
|
|
3bf346eb6b | ||
|
|
c1d05ae952 | ||
|
|
4e9a4bdc4f | ||
|
|
661c1b0d99 | ||
|
|
d3db9106b8 | ||
|
|
8b96e4da5c | ||
|
|
143ee77d86 | ||
|
|
ebed6743b7 | ||
|
|
b35cc7d561 | ||
|
|
5c6c7f10e2 | ||
|
|
6deb9d38ae | ||
|
|
cf5ade8a49 | ||
|
|
076fa978a1 | ||
|
|
fff0ec3e85 | ||
|
|
a0cdfbeeb6 | ||
|
|
4d04dea960 | ||
|
|
badc180a79 | ||
|
|
9e726dbd69 | ||
|
|
be0c3128ac | ||
|
|
eeb246b9fd | ||
|
|
8f0e00850d | ||
|
|
304e2c3073 | ||
|
|
8a08a7e431 | ||
|
|
570f9b18b3 | ||
|
|
225ca63127 | ||
|
|
88d3ac4e45 | ||
|
|
d95d555d5b | ||
|
|
e5eea3ebd8 | ||
|
|
a1b70fa595 | ||
|
|
db5e9598b7 | ||
|
|
85d5e1ade5 | ||
|
|
2fd260be35 | ||
|
|
54e18b2b30 | ||
|
|
f35f0f8f35 | ||
|
|
0b3c8c68bb | ||
|
|
61e49fb507 | ||
|
|
6081e848f3 | ||
|
|
e0bd15ceef | ||
|
|
04695a4f30 | ||
|
|
a67cd7b5c9 | ||
|
|
60ebe19a78 | ||
|
|
76b725627e | ||
|
|
b440fb4d5e | ||
|
|
0b901fcf59 | ||
|
|
758de777bb | ||
|
|
379b23d9b8 | ||
|
|
9ce893eddb |
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@ -12,6 +12,9 @@ updates:
|
||||
cargo-weekly:
|
||||
patterns:
|
||||
- "*"
|
||||
ignore:
|
||||
- dependency-name: "nom"
|
||||
- dependency-name: "criterion"
|
||||
open-pull-requests-limit: 1
|
||||
|
||||
# Disable regular version updates while still allowing Dependabot security PRs.
|
||||
|
||||
3
.github/workflows/nightly.yml
vendored
3
.github/workflows/nightly.yml
vendored
@ -12,6 +12,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
if: github.repository == 'agentgateway/agentgateway'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
has_commits: ${{ steps.check.outputs.has_commits }}
|
||||
@ -50,4 +51,6 @@ jobs:
|
||||
with:
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
extra_tag: latest-dev
|
||||
# Helm is special and requires a semver.
|
||||
extra_helm_tag: 0.0.0-latest-dev
|
||||
secrets: inherit
|
||||
|
||||
34
.github/workflows/pull_request.yml
vendored
34
.github/workflows/pull_request.yml
vendored
@ -16,7 +16,7 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CI: true
|
||||
RUST_VERSION: "1.93.1"
|
||||
GO_VERSION: "1.26.1"
|
||||
GO_VERSION: "1.26.2"
|
||||
|
||||
jobs:
|
||||
#### Proxy jobs ####
|
||||
@ -24,13 +24,14 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
validate: true
|
||||
- os: blacksmith-4vcpu-ubuntu-2404
|
||||
name: "Proxy Test"
|
||||
- os: windows-2025
|
||||
validate: false
|
||||
name: "Proxy Test (Windows)"
|
||||
- os: macos-15
|
||||
validate: false
|
||||
name: "Proxy Test (Mac)"
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
@ -39,20 +40,25 @@ jobs:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
# Github cache is too tiny to handle the full matrix :-(
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
|
||||
with:
|
||||
# Github cache will restore from 'main' OR the current branch.
|
||||
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
|
||||
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Start validation dependencies
|
||||
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
|
||||
run: tools/manage-validation-deps.sh start
|
||||
- name: Test
|
||||
run: make test
|
||||
- name: Validate
|
||||
if: ${{ matrix.validate }}
|
||||
run: make validate
|
||||
env:
|
||||
KEYCLOAK_AVAILABLE: ${{ startsWith(matrix.os, 'blacksmith-') && '1' || '' }}
|
||||
- name: Stop validation dependencies
|
||||
if: ${{ always() && startsWith(matrix.os, 'blacksmith-') }}
|
||||
run: tools/manage-validation-deps.sh stop
|
||||
|
||||
proxy-lint:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
@ -88,7 +94,7 @@ jobs:
|
||||
|
||||
#### Controller jobs ####
|
||||
controller-test:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
@ -101,7 +107,7 @@ jobs:
|
||||
run: go test -race ./...
|
||||
|
||||
controller-lint:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
@ -121,7 +127,7 @@ jobs:
|
||||
run: make generate-apis check-clean-repo
|
||||
|
||||
controller-e2e:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Check Runner Info
|
||||
@ -173,7 +179,7 @@ jobs:
|
||||
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
controller-conformance:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
|
||||
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
@ -13,6 +13,11 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
extra_helm_tag:
|
||||
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
@ -24,12 +29,17 @@ on:
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
extra_helm_tag:
|
||||
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CI: true
|
||||
RUST_VERSION: "1.93.1"
|
||||
GO_VERSION: "1.26.1"
|
||||
GO_VERSION: "1.26.2"
|
||||
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/agentgateway
|
||||
CONTROLLER_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/controller
|
||||
# Note: /charts is added to this
|
||||
@ -70,9 +80,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os: ubuntu-24.04
|
||||
os: blacksmith-4vcpu-ubuntu-2404
|
||||
- platform: linux/arm64
|
||||
os: ubuntu-24.04-arm
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
@ -195,9 +205,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os: ubuntu-24.04
|
||||
os: blacksmith-4vcpu-ubuntu-2404
|
||||
- platform: linux/arm64
|
||||
os: ubuntu-24.04-arm
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
@ -325,7 +335,7 @@ jobs:
|
||||
os: ubuntu-24.04
|
||||
goarch: amd64
|
||||
- platform: linux/arm64
|
||||
os: ubuntu-24.04-arm
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
goarch: arm64
|
||||
defaults:
|
||||
run:
|
||||
@ -489,6 +499,7 @@ jobs:
|
||||
run: make -C controller release-charts
|
||||
env:
|
||||
IMAGE_REGISTRY: ${{ env.CHART_REGISTRY_IMAGE_BASE }}
|
||||
EXTRA_HELM_TAG: ${{ inputs.extra_helm_tag }}
|
||||
|
||||
build:
|
||||
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
|
||||
@ -502,20 +513,24 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
- os: blacksmith-4vcpu-ubuntu-2404
|
||||
target: x86_64-unknown-linux-musl
|
||||
# Performance is horrendous on musl without jemalloc
|
||||
features: jemalloc
|
||||
- os: ubuntu-24.04-arm
|
||||
name: linux
|
||||
- os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
target: aarch64-unknown-linux-musl
|
||||
# TODO: arm64 build fails with jemalloc for some reason? https://github.com/tikv/jemallocator/issues/146
|
||||
features: default
|
||||
name: linux-arm
|
||||
- os: macos-26
|
||||
target: aarch64-apple-darwin
|
||||
features: default
|
||||
name: mac
|
||||
- os: windows-2025
|
||||
target: x86_64-pc-windows-msvc
|
||||
features: default
|
||||
name: windows
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
@ -533,8 +548,8 @@ jobs:
|
||||
cd ui
|
||||
npm install
|
||||
npm run build
|
||||
- name: Install musl-tools
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
- name: Prepare Linux target
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y musl-tools
|
||||
@ -549,7 +564,7 @@ jobs:
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
with:
|
||||
name: release-binary-${{ matrix.os }}
|
||||
name: release-binary-${{ matrix.name }}
|
||||
path: |
|
||||
target/${{ matrix.target }}/release/agentgateway
|
||||
target/${{ matrix.target }}/release/agentgateway.exe
|
||||
@ -563,7 +578,7 @@ jobs:
|
||||
- push-controller-image
|
||||
- push-helm-charts
|
||||
- build
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
@ -578,13 +593,13 @@ jobs:
|
||||
run: |
|
||||
ls -R
|
||||
mkdir outputs
|
||||
mv release-binary-macos-26/agentgateway outputs/agentgateway-darwin-arm64
|
||||
mv release-binary-mac/agentgateway outputs/agentgateway-darwin-arm64
|
||||
sha256sum outputs/agentgateway-darwin-arm64 > outputs/agentgateway-darwin-arm64.sha256
|
||||
mv release-binary-ubuntu-24.04/agentgateway outputs/agentgateway-linux-amd64
|
||||
mv release-binary-linux/agentgateway outputs/agentgateway-linux-amd64
|
||||
sha256sum outputs/agentgateway-linux-amd64 > outputs/agentgateway-linux-amd64.sha256
|
||||
mv release-binary-ubuntu-24.04-arm/agentgateway outputs/agentgateway-linux-arm64
|
||||
mv release-binary-linux-arm/agentgateway outputs/agentgateway-linux-arm64
|
||||
sha256sum outputs/agentgateway-linux-arm64 > outputs/agentgateway-linux-arm64.sha256
|
||||
mv release-binary-windows-2025/agentgateway.exe outputs/agentgateway-windows-amd64.exe
|
||||
mv release-binary-windows/agentgateway.exe outputs/agentgateway-windows-amd64.exe
|
||||
sha256sum outputs/agentgateway-windows-amd64.exe > outputs/agentgateway-windows-amd64.exe.sha256
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
|
||||
|
||||
464
Cargo.lock
generated
464
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
16
Cargo.toml
16
Cargo.toml
@ -50,7 +50,7 @@ anyhow = "1.0"
|
||||
arc-swap = "1.9"
|
||||
arcstr = { version = "1.2", features = ["serde"] }
|
||||
assert_matches = "1.5.0"
|
||||
async-openai = { git = "https://github.com/64bit/async-openai", rev = "6e482db7185e3e186fe49bae0ec2f214fc822e4a", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
|
||||
async-openai = { version = "0.34", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
|
||||
async-stream = "0.3"
|
||||
async-trait = "0.1"
|
||||
aws-config = { version = "1.8", default-features = false, features = ["default-https-client", "rt-tokio"] }
|
||||
@ -84,7 +84,7 @@ futures = "0.3"
|
||||
futures-channel = "0.3"
|
||||
futures-core = "0.3"
|
||||
futures-util = "0.3"
|
||||
google-cloud-auth = { version = "1.7", default-features = false, features = [
|
||||
google-cloud-auth = { version = "1.8", default-features = false, features = [
|
||||
"idtoken",
|
||||
# They use AWS-LC which is what we want so its fine. If they changed we would need to switch
|
||||
# To installing a global default which is annoying so prefer to do it this way.
|
||||
@ -106,7 +106,7 @@ hyper-util = { version = "0.1", features = ["full"] }
|
||||
hyper-util-fork = { path = "crates/hyper-util-fork" }
|
||||
include_dir = "0.7"
|
||||
indexmap = { version = "2.13", features = ["serde"] }
|
||||
insta = { version = "1.46", features = ["json", "redactions", "filters", "yaml"] }
|
||||
insta = { version = "1.47", features = ["json", "redactions", "filters", "yaml"] }
|
||||
ipnet = { version = "2.12", features = ["serde"] }
|
||||
itertools = "0.14"
|
||||
jsonwebtoken = { version = "10.3", features = ["aws_lc_rs"] }
|
||||
@ -114,7 +114,7 @@ lazy_static = "1.5"
|
||||
libc = "0.2"
|
||||
notify = "8.2"
|
||||
notify-debouncer-full = "0.7"
|
||||
md-5 = "0.10"
|
||||
md-5 = "0.11"
|
||||
num_cpus = "1.17"
|
||||
once_cell = "1.21"
|
||||
openapiv3 = "2.2"
|
||||
@ -170,8 +170,8 @@ serde-untagged = "0.1"
|
||||
serde_json_path_to_error = "0.1"
|
||||
serde_regex = "1.1"
|
||||
serde_yaml = "0.9"
|
||||
sha1 = "0.10"
|
||||
sha2 = "0.10"
|
||||
sha1 = "0.11"
|
||||
sha2 = "0.11"
|
||||
shellexpand = "3.1"
|
||||
socket2 = "0.6"
|
||||
split-iter = "0.1"
|
||||
@ -204,7 +204,7 @@ tracing-subscriber = { version = "0.3", features = [
|
||||
"json",
|
||||
] }
|
||||
url = "2.5"
|
||||
uuid = { version = "1.22", features = ["v4"] }
|
||||
uuid = { version = "1.23", features = ["v4"] }
|
||||
wiremock = { version = "0.6", features = ["tls"] }
|
||||
x509-parser = { version = "0.18", default-features = false, features = ["verify-aws"] }
|
||||
which = "8.0"
|
||||
@ -236,7 +236,7 @@ async-compression = { version = "0.4", features = [
|
||||
"tokio",
|
||||
] }
|
||||
core_affinity = "0.8"
|
||||
frozen-collections = "0.8"
|
||||
frozen-collections = "0.9"
|
||||
heck = "0.5"
|
||||
macro_rules_attribute = "0.2"
|
||||
|
||||
|
||||
52
README.md
52
README.md
@ -29,7 +29,7 @@
|
||||
|
||||
---
|
||||
|
||||
**Agentgateway** is an open source data plane optimized for agentic AI connectivity within or across any agent framework or environment. Agentgateway provides drop-in security, observability, and governance for agent-to-agent and agent-to-tool communication and supports leading interoperable protocols, including [Agent2Agent (A2A)](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/) and [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction).
|
||||
**Agentgateway** is an open source proxy built on AI-native protocols ([MCP](https://modelcontextprotocol.io/introduction) & [A2A](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/)) that provides drop-in security, observability, and governance for agent-to-LLM, agent-to-tool, and agent-to-agent communication across any framework and environment.
|
||||
|
||||
<br>
|
||||
<div align="center">
|
||||
@ -41,20 +41,31 @@
|
||||
|
||||
[](https://youtu.be/SomP92JWPmE)
|
||||
|
||||
## Key Features:
|
||||
## Key Features
|
||||
|
||||
- [x] **Highly performant:** agentgateway is written in rust, and is designed from the ground up to handle any scale you can throw at it.
|
||||
- [x] **Security First:** agentgateway includes a robust MCP/A2A focused RBAC system.
|
||||
- [x] **Multi Tenant:** agentgateway supports multiple tenants, each with their own set of resources and users.
|
||||
- [x] **Dynamic:** agentgateway supports dynamic configuration updates via xDS, without any downtime.
|
||||
- [x] **Run Anywhere:** agentgateway can run anywhere with any agent framework, from a single machine to a large scale multi-tenant deployment.
|
||||
- [x] **Legacy API Support:** agentgateway can transform legacy APIs into MCP resources. Currently supports OpenAPI. (gRPC coming soon)
|
||||
- [x] **Kubernetes Native:** agentgateway includes a built-in Kubernetes controller for dynamic provisioning and management via the Kubernetes Gateway API.
|
||||
- **LLM Gateway**<br>
|
||||
Route traffic to major LLM providers (OpenAI, Anthropic, Gemini, Bedrock, and more) through a unified OpenAI-compatible API with budget and spend controls, prompt enrichment, load balancing, and failover.
|
||||
|
||||
- **MCP Gateway**<br>
|
||||
Connect LLMs to tools and external data sources via MCP with tool federation, stdio/HTTP/SSE/Streamable HTTP transports, OpenAPI integration, and OAuth authentication.
|
||||
|
||||
- **A2A Gateway**<br>
|
||||
Enable secure agent-to-agent communication using A2A, with capability discovery, modality negotiation, and task collaboration.
|
||||
|
||||
- **Inference Routing**<br>
|
||||
Intelligent routing to self-hosted models using Kubernetes Inference Gateway extensions, with decisions based on GPU utilization, KV cache, LoRA adapters, and queue depth.
|
||||
|
||||
- **Guardrails**<br>
|
||||
Multi-layered content filtering with regex, OpenAI moderation, AWS Bedrock Guardrails, Google Model Armor, and custom webhooks.
|
||||
|
||||
- **Security & Observability**<br>
|
||||
Auth (JWT, API keys, OAuth), fine-grained RBAC with CEL policy engine, rate limiting, TLS, and OpenTelemetry metrics/logs/tracing.
|
||||
<br>
|
||||
|
||||
## Getting Started
|
||||
## Getting Started
|
||||
|
||||
To get started with agentgateway, please check out the [Getting Started Guide](https://agentgateway.dev/docs/quickstart).
|
||||
- [Standalone Quickstart](https://agentgateway.dev/docs/quickstart) — Get started with agentgateway in minutes.
|
||||
- [Kubernetes Quickstart](https://agentgateway.dev/docs/kubernetes/latest) — Deploy on Kubernetes using the built-in controller and Gateway API.
|
||||
|
||||
## Documentation
|
||||
|
||||
@ -69,6 +80,23 @@ Agentgateway has a built-in UI for you to explore agentgateway connecting agent-
|
||||
<img alt="agentgateway UI" src="img/UI-homepage.png">
|
||||
</div>
|
||||
|
||||
## Sponsors
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" width="33.3%">
|
||||
<a href="https://blacksmith.sh/">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith-light.svg">
|
||||
<img src="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith.svg" alt="Blacksmith" height="48">
|
||||
</picture>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Thank you to our sponsors for helping to fund the development of agentgateway!
|
||||
|
||||
## Contributing
|
||||
|
||||
For instructions on how to contribute to the agentgateway project, see the [CONTRIBUTION.md](CONTRIBUTION.md) file.
|
||||
@ -80,7 +108,7 @@ Recordings of the community meetings will be published on our [google drive](htt
|
||||
|
||||
## Roadmap
|
||||
|
||||
`agentgateway` is currently in active development. If you want a feature missing, open an issue in our [Github repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
`agentgateway` is currently in active development. If you'd like a feature that's missing, open an issue in our [GitHub repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
@ -7854,6 +7854,7 @@ 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
|
||||
}
|
||||
@ -7902,6 +7903,13 @@ 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"`
|
||||
@ -8337,10 +8345,9 @@ 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"`
|
||||
LimitOverride *TrafficPolicySpec_RemoteRateLimit_LimitOverride `protobuf:"bytes,3,opt,name=limit_override,json=limitOverride,proto3,oneof" json:"limit_override,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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -8389,13 +8396,6 @@ 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,56 +8448,6 @@ 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"`
|
||||
@ -8509,7 +8459,7 @@ type TrafficPolicySpec_ExternalAuth_BodyOptions struct {
|
||||
|
||||
func (x *TrafficPolicySpec_ExternalAuth_BodyOptions) Reset() {
|
||||
*x = TrafficPolicySpec_ExternalAuth_BodyOptions{}
|
||||
mi := &file_resource_proto_msgTypes[91]
|
||||
mi := &file_resource_proto_msgTypes[90]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -8521,7 +8471,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[91]
|
||||
mi := &file_resource_proto_msgTypes[90]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -8568,7 +8518,7 @@ type TrafficPolicySpec_ExternalAuth_GRPCProtocol struct {
|
||||
|
||||
func (x *TrafficPolicySpec_ExternalAuth_GRPCProtocol) Reset() {
|
||||
*x = TrafficPolicySpec_ExternalAuth_GRPCProtocol{}
|
||||
mi := &file_resource_proto_msgTypes[92]
|
||||
mi := &file_resource_proto_msgTypes[91]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -8580,7 +8530,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[92]
|
||||
mi := &file_resource_proto_msgTypes[91]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -8623,7 +8573,7 @@ type TrafficPolicySpec_ExternalAuth_HTTPProtocol struct {
|
||||
|
||||
func (x *TrafficPolicySpec_ExternalAuth_HTTPProtocol) Reset() {
|
||||
*x = TrafficPolicySpec_ExternalAuth_HTTPProtocol{}
|
||||
mi := &file_resource_proto_msgTypes[93]
|
||||
mi := &file_resource_proto_msgTypes[92]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -8635,7 +8585,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[93]
|
||||
mi := &file_resource_proto_msgTypes[92]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -8686,6 +8636,58 @@ 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"`
|
||||
@ -10459,13 +10461,14 @@ 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"`
|
||||
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"`
|
||||
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
|
||||
}
|
||||
|
||||
func (x *BackendPolicySpec_Ai_PromptCaching) Reset() {
|
||||
@ -10526,6 +10529,13 @@ 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"`
|
||||
@ -11598,7 +11608,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\"\xd2=\n" +
|
||||
"\x0frequired_claims\x18\x01 \x03(\tR\x0erequiredClaims\"\xc7>\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" +
|
||||
@ -11624,25 +11634,19 @@ 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\xc8\x06\n" +
|
||||
"\fhost_rewrite\x18\x15 \x01(\v28.agentgateway.dev.resource.TrafficPolicySpec.HostRewriteH\x00R\vhostRewrite\x1a\x8c\x05\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\xcc\x02\n" +
|
||||
"\ffailure_mode\x18\x04 \x01(\x0e2H.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.FailureModeR\vfailureMode\x1a\xc1\x01\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\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" +
|
||||
"\x04type\x18\x02 \x01(\x0e2A.agentgateway.dev.resource.TrafficPolicySpec.RemoteRateLimit.TypeR\x04type\x1a/\n" +
|
||||
"\x05Entry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value\x1a/\n" +
|
||||
"\rLimitOverride\x12\x1e\n" +
|
||||
"\n" +
|
||||
"expression\x18\x01 \x01(\tR\n" +
|
||||
"expression\" \n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value\" \n" +
|
||||
"\x04Type\x12\f\n" +
|
||||
"\bREQUESTS\x10\x00\x12\n" +
|
||||
"\n" +
|
||||
@ -11710,10 +11714,14 @@ 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\xda\x01\n" +
|
||||
"\vjwks_source\x1a\x8b\x04\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\"0\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" +
|
||||
"\x04Mode\x12\f\n" +
|
||||
"\bOPTIONAL\x10\x00\x12\n" +
|
||||
"\n" +
|
||||
@ -11793,7 +11801,7 @@ const file_resource_proto_rawDesc = "" +
|
||||
"\vPolicyPhase\x12\t\n" +
|
||||
"\x05ROUTE\x10\x00\x12\v\n" +
|
||||
"\aGATEWAY\x10\x01B\x06\n" +
|
||||
"\x04kind\"\xb6B\n" +
|
||||
"\x04kind\"\x86C\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" +
|
||||
@ -11813,7 +11821,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\x93\"\n" +
|
||||
"\x0ebackend_tunnel\x18\x10 \x01(\v2:.agentgateway.dev.resource.BackendPolicySpec.BackendTunnelH\x00R\rbackendTunnel\x1a\xe3\"\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" +
|
||||
@ -11880,15 +11888,17 @@ 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\xad\x01\n" +
|
||||
"\bresponse\x18\x02 \x03(\v2=.agentgateway.dev.resource.BackendPolicySpec.Ai.ResponseGuardR\bresponse\x1a\xfd\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\x01B\r\n" +
|
||||
"\v_min_tokens\x1a;\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" +
|
||||
"\rDefaultsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a<\n" +
|
||||
@ -12261,14 +12271,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_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_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_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
|
||||
@ -12477,101 +12487,103 @@ 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
|
||||
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
|
||||
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
|
||||
12, // 153: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.failure_mode:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.FailureMode
|
||||
121, // 154: agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.include_request_body:type_name -> agentgateway.dev.resource.TrafficPolicySpec.ExternalAuth.BodyOptions
|
||||
120, // 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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
func init() { file_resource_proto_init() }
|
||||
@ -12737,8 +12749,7 @@ func file_resource_proto_init() {
|
||||
(*TrafficPolicySpec_JWTProvider_Inline)(nil),
|
||||
}
|
||||
file_resource_proto_msgTypes[80].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[88].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[93].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[92].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[109].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[111].OneofWrappers = []any{}
|
||||
file_resource_proto_msgTypes[119].OneofWrappers = []any{
|
||||
|
||||
@ -743,17 +743,6 @@ 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)
|
||||
@ -842,6 +831,17 @@ func (this *TrafficPolicySpec_JWT) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for TrafficPolicySpec_JWT_MCP
|
||||
func (this *TrafficPolicySpec_JWT_MCP) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for TrafficPolicySpec_JWT_MCP
|
||||
func (this *TrafficPolicySpec_JWT_MCP) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for TrafficPolicySpec_BasicAuthentication
|
||||
func (this *TrafficPolicySpec_BasicAuthentication) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
|
||||
@ -104,10 +104,6 @@ linters:
|
||||
alias: gwv1a2
|
||||
- pkg: sigs.k8s.io/gateway-api/apis/v1beta1
|
||||
alias: gwv1b1
|
||||
- pkg: github.com/envoyproxy/go-control-plane/envoy/config/(\w+)/(v[\w\d]+)
|
||||
alias: envoy$1$2
|
||||
- pkg: github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3
|
||||
alias: envoytlsv3
|
||||
- pkg: github.com/agentgateway/agentgateway/controller/api/annotations
|
||||
alias: apiannotations
|
||||
- pkg: github.com/agentgateway/agentgateway/controller/api/settings
|
||||
|
||||
@ -461,6 +461,7 @@ HELM ?= helm
|
||||
HELM_CHART_VERSION_NO_V ?= $(patsubst v%,%,$(VERSION))
|
||||
HELM_CHART_VERSION_V ?= v$(HELM_CHART_VERSION_NO_V)
|
||||
HELM_PACKAGE_ARGS ?= --version $(HELM_CHART_VERSION_NO_V) --app-version $(HELM_CHART_VERSION_NO_V)
|
||||
EXTRA_HELM_TAG ?=
|
||||
HELM_CHART_DIR_AGW=install/helm/agentgateway
|
||||
HELM_CHART_DIR_AGW_CRD=install/helm/agentgateway-crds
|
||||
HELM_ADDITIONAL_VALUES ?= hack/helm/dev.yaml
|
||||
@ -490,18 +491,29 @@ release-charts: package-agentgateway-charts
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(HELM_CHART_VERSION_V) --app-version $(HELM_CHART_VERSION_V) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR);
|
||||
@if [ -n "$(EXTRA_HELM_TAG)" ]; then \
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR); \
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR); \
|
||||
fi
|
||||
@for chart in $(CHART_NAMES); do \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_NO_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
if [ -n "$(EXTRA_HELM_TAG)" ]; then \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(EXTRA_HELM_TAG).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
.PHONY: deploy-agentgateway-crd-chart
|
||||
deploy-agentgateway-crd-chart: ## Deploy the agentgateway crd chart
|
||||
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(VERSION).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
|
||||
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(HELM_CHART_VERSION_NO_V).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
|
||||
|
||||
.PHONY: deploy-agentgateway-chart
|
||||
deploy-agentgateway-chart: ## Deploy the agentgateway chart
|
||||
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(VERSION).tgz \
|
||||
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(HELM_CHART_VERSION_NO_V).tgz \
|
||||
--namespace $(INSTALL_NAMESPACE) --create-namespace \
|
||||
--set image.registry=$(IMAGE_REGISTRY) \
|
||||
--set image.tag=$(VERSION) \
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
package annotations
|
||||
|
||||
// LegacyMCPServiceHTTPPath is the legacy annotation used to specify the HTTP path for the MCP service. Users should switch to MCPServiceHTTPPath.
|
||||
const LegacyMCPServiceHTTPPath = "kgateway.dev/mcp-path"
|
||||
|
||||
// MCPServiceHTTPPath is the annotation used to specify the HTTP path for the MCP service
|
||||
const MCPServiceHTTPPath = "kgateway.dev/mcp-path"
|
||||
const MCPServiceHTTPPath = "agentgateway.dev/mcp-path"
|
||||
|
||||
@ -161,13 +161,6 @@ type Settings struct {
|
||||
// is deprecated in v2.1 and will not be supported in v2.2.
|
||||
EnableInferExt bool `split_words:"true"`
|
||||
|
||||
// DefaultImageRegistry is the default image registry to use for the agentgateway image.
|
||||
DefaultImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
|
||||
// DefaultImageTag is the default image tag to use for the agentgateway image.
|
||||
DefaultImageTag string `split_words:"true" default:""`
|
||||
// DefaultImagePullPolicy is the default image pull policy to use for the agentgateway image.
|
||||
DefaultImagePullPolicy string `split_words:"true" default:"IfNotPresent"`
|
||||
|
||||
// ProxyImageRegistry is the default image registry to use for the proxy image.
|
||||
ProxyImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
|
||||
// ProxyImageRepository is the default image repository to use for the proxy image.
|
||||
|
||||
@ -27,9 +27,6 @@ func allEnvVarsSet() map[string]string {
|
||||
"AGW_AGENTGATEWAY_XDS_SERVICE_PORT": "5678",
|
||||
"AGW_NO_LISTENERS_DUMMY_PORT": "8443",
|
||||
"AGW_ENABLE_INFER_EXT": "true",
|
||||
"AGW_DEFAULT_IMAGE_REGISTRY": "custom-registry.io",
|
||||
"AGW_DEFAULT_IMAGE_TAG": "v1.0.0",
|
||||
"AGW_DEFAULT_IMAGE_PULL_POLICY": "Always",
|
||||
"AGW_LOG_LEVEL": "debug",
|
||||
"AGW_DISCOVERY_NAMESPACE_SELECTORS": `[{"matchLabels":{"app":"test"}}]`,
|
||||
"AGW_ENABLE_BUILTIN_DEFAULT_METRICS": "true",
|
||||
@ -74,9 +71,6 @@ func TestSettings(t *testing.T) {
|
||||
AgentgatewayXdsServicePort: 9978,
|
||||
NoListenersDummyPort: 443,
|
||||
EnableInferExt: false,
|
||||
DefaultImageRegistry: "cr.agentgateway.dev",
|
||||
DefaultImageTag: "",
|
||||
DefaultImagePullPolicy: "IfNotPresent",
|
||||
LogLevel: "info",
|
||||
DiscoveryNamespaceSelectors: "[]",
|
||||
EnableBuiltinDefaultMetrics: false,
|
||||
@ -105,9 +99,6 @@ func TestSettings(t *testing.T) {
|
||||
AgentgatewayXdsServicePort: 5678,
|
||||
NoListenersDummyPort: 8443,
|
||||
EnableInferExt: true,
|
||||
DefaultImageRegistry: "custom-registry.io",
|
||||
DefaultImageTag: "v1.0.0",
|
||||
DefaultImagePullPolicy: "Always",
|
||||
LogLevel: "debug",
|
||||
DiscoveryNamespaceSelectors: `[{"matchLabels":{"app":"test"}}]`,
|
||||
EnableBuiltinDefaultMetrics: true,
|
||||
@ -188,9 +179,6 @@ func TestSettings(t *testing.T) {
|
||||
XdsServiceName: "agentgateway",
|
||||
AgentgatewayXdsServicePort: 9978,
|
||||
EnableInferExt: false,
|
||||
DefaultImageRegistry: "cr.agentgateway.dev",
|
||||
DefaultImageTag: "",
|
||||
DefaultImagePullPolicy: "IfNotPresent",
|
||||
NoListenersDummyPort: 443,
|
||||
LogLevel: "info",
|
||||
DiscoveryNamespaceSelectors: "[]",
|
||||
|
||||
@ -41,6 +41,28 @@ spec:
|
||||
matchExpressions:
|
||||
- 'true'
|
||||
---
|
||||
_err: unknown fields
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-static-target-authentication
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: target
|
||||
static:
|
||||
host: example.com
|
||||
port: 443
|
||||
policies:
|
||||
mcp:
|
||||
authentication:
|
||||
issuer: https://issuer.example.com/
|
||||
jwks:
|
||||
backendRef:
|
||||
name: jwks
|
||||
port: 443
|
||||
jwksPath: /.well-known/jwks.json
|
||||
---
|
||||
_err: path and pathPrefix are mutually exclusive
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
@ -73,4 +95,47 @@ spec:
|
||||
ai:
|
||||
provider:
|
||||
openai: {}
|
||||
host: example.com
|
||||
host: example.com
|
||||
---
|
||||
_err: exactly one of the fields in [host backendRef] must be set
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-missing-port
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
host: mcp.example.com
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
---
|
||||
_err: exactly one of the fields in [host backendRef] must be set
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-no-target
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
port: 8080
|
||||
---
|
||||
_err: mcp target policies may not be used with backendRef
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-with-policies
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
policies:
|
||||
tls: {}
|
||||
|
||||
@ -63,6 +63,20 @@ kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-full
|
||||
spec:
|
||||
policies:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Deny
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
authentication:
|
||||
issuer: https://issuer.example.com/
|
||||
jwks:
|
||||
backendRef:
|
||||
name: jwks
|
||||
port: 443
|
||||
jwksPath: /.well-known/jwks.json
|
||||
mcp:
|
||||
targets:
|
||||
- name: everything
|
||||
@ -71,12 +85,6 @@ spec:
|
||||
port: 443
|
||||
policies:
|
||||
tls: {}
|
||||
mcp:
|
||||
authorization:
|
||||
action: Deny
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
- name: k8s
|
||||
selector:
|
||||
namespaces:
|
||||
@ -137,10 +145,23 @@ spec:
|
||||
static:
|
||||
host: example.com
|
||||
port: 443
|
||||
policies:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
policies:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: local-svc
|
||||
static:
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
|
||||
@ -294,6 +294,21 @@ spec:
|
||||
- name: X-Test
|
||||
value: '"test"'
|
||||
---
|
||||
_err: 'jwtAuthentication.mcp requires mode Strict'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: traffic-jwt-mcp-nonstrict
|
||||
spec:
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
mode: Optional
|
||||
providers:
|
||||
- issuer: https://example.com
|
||||
jwks:
|
||||
inline: '{"keys":[]}'
|
||||
mcp: {}
|
||||
---
|
||||
_err: 'pseudo-headers must be one of'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
@ -419,6 +434,28 @@ spec:
|
||||
- field: a
|
||||
value: b
|
||||
---
|
||||
_err: 'traffic.jwtAuthentication may not be used with backend.mcp.authentication in the same policy'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-and-mcp-authentication
|
||||
spec:
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
providers:
|
||||
- issuer: https://example.com
|
||||
jwks:
|
||||
inline: '{"keys":[]}'
|
||||
backend:
|
||||
mcp:
|
||||
authentication:
|
||||
issuer: https://example.com
|
||||
jwks:
|
||||
backendRef:
|
||||
kind: Service
|
||||
name: jwks
|
||||
jwksPath: /.well-known/jwks.json
|
||||
---
|
||||
_err: "targetRefs may only"
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package agentgateway
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
)
|
||||
@ -417,10 +418,18 @@ type McpSelector struct {
|
||||
}
|
||||
|
||||
// McpTarget defines a single MCPBackend target configuration.
|
||||
// +kubebuilder:validation:ExactlyOneOf=host;backendRef
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.backendRef) || !has(self.policies)",message="mcp target policies may not be used with backendRef"
|
||||
type McpTarget struct {
|
||||
// Host is the hostname or IP address of the MCP target.
|
||||
// +required
|
||||
Host ShortString `json:"host"`
|
||||
// +optional
|
||||
Host *ShortString `json:"host,omitempty"`
|
||||
|
||||
// `backendRef` references a namespace-local `Service` resource by name.
|
||||
// When set, this replaces `host` only; `port`, `path`, and `protocol`
|
||||
// remain configured on this target.
|
||||
// +optional
|
||||
BackendRef *corev1.LocalObjectReference `json:"backendRef,omitempty"`
|
||||
|
||||
// Port is the port number of the MCP target.
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
@ -443,8 +452,10 @@ type McpTarget struct {
|
||||
// Policies may also be set in `AgentgatewayPolicy`, or in the top-level
|
||||
// `AgentgatewayBackend`. Policies are merged on a field-level basis, with
|
||||
// order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend` MCP (this field).
|
||||
// This field may only be used with host-based static targets, not
|
||||
// `backendRef`.
|
||||
// +optional
|
||||
Policies *BackendWithMCP `json:"policies,omitempty"`
|
||||
Policies *BackendSimple `json:"policies,omitempty"`
|
||||
}
|
||||
|
||||
// MCPProtocol defines the protocol to use for the `MCPBackend` target.
|
||||
|
||||
@ -35,7 +35,7 @@ type AgentgatewayPolicy struct {
|
||||
|
||||
// status defines the current state of AgentgatewayPolicy.
|
||||
// +optional
|
||||
Status gwv1.PolicyStatus `json:"status,omitempty"`
|
||||
Status gwv1.PolicyStatus `json:"status,omitzero"`
|
||||
// TODO: embed this into a typed Status field when
|
||||
// https://github.com/kubernetes/kubernetes/issues/131533 is resolved
|
||||
}
|
||||
@ -51,6 +51,7 @@ type AgentgatewayPolicyList struct {
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.traffic) || has(self.frontend) || has(self.backend)",message="At least one of traffic, frontend, or backend must be provided."
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.backend) || !has(self.backend.mcp) || ((!has(self.targetRefs) || !self.targetRefs.exists(t, t.kind == 'Service')) && (!has(self.targetSelectors) || !self.targetSelectors.exists(t, t.kind == 'Service')))",message="backend.mcp may not be used with a Service target"
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.backend) || !has(self.backend.ai) || ((!has(self.targetRefs) || !self.targetRefs.exists(t, t.kind == 'Service')) && (!has(self.targetSelectors) || !self.targetSelectors.exists(t, t.kind == 'Service')))",message="backend.ai may not be used with a Service target"
|
||||
// +kubebuilder:validation:XValidation:rule="!(has(self.traffic) && has(self.traffic.jwtAuthentication) && has(self.backend) && has(self.backend.mcp) && has(self.backend.mcp.authentication))",message="traffic.jwtAuthentication may not be used with backend.mcp.authentication in the same policy"
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.frontend) && has(self.targetRefs) ? self.targetRefs.all(t, t.kind == 'Gateway' && !has(t.sectionName)) : true",message="the 'frontend' field can only target a Gateway"
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.frontend) && has(self.targetSelectors) ? self.targetSelectors.all(t, t.kind == 'Gateway' && !has(t.sectionName)) : true",message="the 'frontend' field can only target a Gateway"
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.traffic) && has(self.targetRefs) ? self.targetRefs.all(t, t.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'ListenerSet']) : true",message="the 'traffic' field can only target a Gateway, ListenerSet, GRPCRoute, or HTTPRoute"
|
||||
@ -219,16 +220,6 @@ type BackendEviction struct {
|
||||
HealthThreshold *int32 `json:"healthThreshold,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type BackendWithMCP struct {
|
||||
BackendSimple `json:",inline"`
|
||||
|
||||
// `mcp` specifies settings for MCP workloads. This is only applicable when
|
||||
// connecting to a `Backend` of type `mcp`.
|
||||
// +optional
|
||||
MCP *BackendMCP `json:"mcp,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type BackendWithAI struct {
|
||||
BackendSimple `json:",inline"`
|
||||
@ -250,6 +241,10 @@ type BackendFull struct {
|
||||
|
||||
// `mcp` specifies settings for MCP workloads. This is only applicable when
|
||||
// connecting to a `Backend` of type `mcp`.
|
||||
//
|
||||
// This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
|
||||
// other policies such as transformation and rate limiting.
|
||||
//
|
||||
// +optional
|
||||
MCP *BackendMCP `json:"mcp,omitempty"`
|
||||
}
|
||||
@ -666,15 +661,24 @@ const (
|
||||
JWTAuthenticationModePermissive JWTAuthenticationMode = "Permissive"
|
||||
)
|
||||
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.mcp) || size(self.providers) == 1",message="jwtAuthentication.mcp requires exactly one provider"
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.mcp) || !has(self.mode) || self.mode == 'Strict'",message="jwtAuthentication.mcp requires mode Strict"
|
||||
type JWTAuthentication struct {
|
||||
// `mode` is the validation mode for JWT authentication.
|
||||
// +kubebuilder:default=Strict
|
||||
// +optional
|
||||
Mode JWTAuthenticationMode `json:"mode,omitempty"`
|
||||
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
// +kubebuilder:validation:MaxItems=64
|
||||
// +required
|
||||
Providers []JWTProvider `json:"providers"`
|
||||
|
||||
// `mcp` optionally enables MCP OAuth metadata endpoint handling
|
||||
// and MCP-specific authentication behavior on top of standard JWT validation.
|
||||
// When set, the gateway will serve the MCP OAuth metadata discovery endpoints.
|
||||
// +optional
|
||||
MCP *JWTMCPConfig `json:"mcp,omitempty"`
|
||||
}
|
||||
|
||||
type JWTProvider struct {
|
||||
@ -696,6 +700,19 @@ type JWTProvider struct {
|
||||
JWKS JWKS `json:"jwks"`
|
||||
}
|
||||
|
||||
// JWTMCPConfig holds MCP-specific extensions for JWT authentication.
|
||||
type JWTMCPConfig struct {
|
||||
// `resourceMetadata` defines the metadata to use for MCP resources,
|
||||
// served at the MCP OAuth metadata endpoints.
|
||||
// +optional
|
||||
ResourceMetadata map[string]apiextensionsv1.JSON `json:"resourceMetadata,omitempty"`
|
||||
|
||||
// `provider` specifies the identity provider to use for MCP authentication flows.
|
||||
// +kubebuilder:validation:Enum=Auth0;Keycloak
|
||||
// +optional
|
||||
Provider *McpIDP `json:"provider,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:validation:ExactlyOneOf=remote;inline
|
||||
type JWKS struct {
|
||||
// `remote` specifies how to reach the JSON Web Key Set from a remote
|
||||
|
||||
@ -401,4 +401,13 @@ type PromptCachingConfig struct {
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:default=1024
|
||||
MinTokens int `json:"minTokens,omitempty"`
|
||||
|
||||
// CacheMessageOffset shifts the message cache point further back in the
|
||||
// conversation. 0 (default) places it at the second-to-last message.
|
||||
// Higher values move it N additional messages towards the start, clamped
|
||||
// to bounds.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:default=0
|
||||
CacheMessageOffset int `json:"cacheMessageOffset,omitempty"`
|
||||
}
|
||||
|
||||
@ -1218,27 +1218,6 @@ func (in *BackendWithAI) DeepCopy() *BackendWithAI {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackendWithMCP) DeepCopyInto(out *BackendWithMCP) {
|
||||
*out = *in
|
||||
in.BackendSimple.DeepCopyInto(&out.BackendSimple)
|
||||
if in.MCP != nil {
|
||||
in, out := &in.MCP, &out.MCP
|
||||
*out = new(BackendMCP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendWithMCP.
|
||||
func (in *BackendWithMCP) DeepCopy() *BackendWithMCP {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BackendWithMCP)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BasicAuthentication) DeepCopyInto(out *BasicAuthentication) {
|
||||
*out = *in
|
||||
@ -1899,6 +1878,11 @@ func (in *JWTAuthentication) DeepCopyInto(out *JWTAuthentication) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.MCP != nil {
|
||||
in, out := &in.MCP, &out.MCP
|
||||
*out = new(JWTMCPConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTAuthentication.
|
||||
@ -1911,6 +1895,33 @@ func (in *JWTAuthentication) DeepCopy() *JWTAuthentication {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JWTMCPConfig) DeepCopyInto(out *JWTMCPConfig) {
|
||||
*out = *in
|
||||
if in.ResourceMetadata != nil {
|
||||
in, out := &in.ResourceMetadata, &out.ResourceMetadata
|
||||
*out = make(map[string]apiextensionsv1.JSON, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = *val.DeepCopy()
|
||||
}
|
||||
}
|
||||
if in.Provider != nil {
|
||||
in, out := &in.Provider, &out.Provider
|
||||
*out = new(McpIDP)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTMCPConfig.
|
||||
func (in *JWTMCPConfig) DeepCopy() *JWTMCPConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(JWTMCPConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JWTProvider) DeepCopyInto(out *JWTProvider) {
|
||||
*out = *in
|
||||
@ -2147,6 +2158,16 @@ func (in *McpSelector) DeepCopy() *McpSelector {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *McpTarget) DeepCopyInto(out *McpTarget) {
|
||||
*out = *in
|
||||
if in.Host != nil {
|
||||
in, out := &in.Host, &out.Host
|
||||
*out = new(ShortString)
|
||||
**out = **in
|
||||
}
|
||||
if in.BackendRef != nil {
|
||||
in, out := &in.BackendRef, &out.BackendRef
|
||||
*out = new(corev1.LocalObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.Path != nil {
|
||||
in, out := &in.Path, &out.Path
|
||||
*out = new(LongString)
|
||||
@ -2159,7 +2180,7 @@ func (in *McpTarget) DeepCopyInto(out *McpTarget) {
|
||||
}
|
||||
if in.Policies != nil {
|
||||
in, out := &in.Policies, &out.Policies
|
||||
*out = new(BackendWithMCP)
|
||||
*out = new(BackendSimple)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/setup"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/setup"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/version"
|
||||
)
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package v1
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
embedded "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
|
||||
"github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@ -4,7 +4,7 @@ Name|Version|License
|
||||
[anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go)|v1.27.1|MIT License
|
||||
[retry-go/v4](https://github.com/avast/retry-go)|v4.7.0|MIT License
|
||||
[xds/go](https://github.com/cncf/xds)|v0.0.0-20260202195803-dba9d589def2|Apache License 2.0
|
||||
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260313105501-0df655d8a214|Apache License 2.0
|
||||
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260402053555-4e9843ddb8d0|Apache License 2.0
|
||||
[ghodss/yaml](https://github.com/ghodss/yaml)|v1.0.1-0.20190212211648-25d852aebe32|MIT License
|
||||
[go-jose/v4](https://github.com/go-jose/go-jose)|v4.1.3|Apache License 2.0
|
||||
[go-logr/logr](https://github.com/go-logr/logr)|v1.4.3|Apache License 2.0
|
||||
@ -37,7 +37,7 @@ Name|Version|License
|
||||
[helm/v3](https://helm.sh/helm/v3)|v3.20.1|Apache License 2.0
|
||||
[istio.io/api](https://istio.io/api)|v1.29.0-alpha.0.0.20260315093121-ce7e56c13e1d|Apache License 2.0
|
||||
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260315093321-a99807642da7|Apache License 2.0
|
||||
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260320151437-efc2b41130da|Apache License 2.0
|
||||
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260407051556-b9f70d130eb6|Apache License 2.0
|
||||
[k8s.io/api](https://k8s.io/api)|v0.35.3|Apache License 2.0
|
||||
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.3|Apache License 2.0
|
||||
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.3|Apache License 2.0
|
||||
|
||||
@ -6773,6 +6773,23 @@ spec:
|
||||
in-cluster `Service` resources, it is recommended to use `selector`
|
||||
instead.
|
||||
properties:
|
||||
backendRef:
|
||||
description: |-
|
||||
`backendRef` references a namespace-local `Service` resource by name.
|
||||
When set, this replaces `host` only; `port`, `path`, and `protocol`
|
||||
remain configured on this target.
|
||||
properties:
|
||||
name:
|
||||
default: ""
|
||||
description: |-
|
||||
Name of the referent.
|
||||
This field is effectively required, but due to backwards compatibility is
|
||||
allowed to be empty. Instances of this type with an empty value here are
|
||||
almost certainly wrong.
|
||||
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
||||
type: string
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
host:
|
||||
description: Host is the hostname or IP address of the
|
||||
MCP target.
|
||||
@ -6793,6 +6810,8 @@ spec:
|
||||
Policies may also be set in `AgentgatewayPolicy`, or in the top-level
|
||||
`AgentgatewayBackend`. Policies are merged on a field-level basis, with
|
||||
order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend` MCP (this field).
|
||||
This field may only be used with host-based static targets, not
|
||||
`backendRef`.
|
||||
properties:
|
||||
auth:
|
||||
description: '`auth` defines settings for managing
|
||||
@ -7023,223 +7042,6 @@ spec:
|
||||
- HTTP2
|
||||
type: string
|
||||
type: object
|
||||
mcp:
|
||||
description: |-
|
||||
`mcp` specifies settings for MCP workloads. This is only applicable when
|
||||
connecting to a `Backend` of type `mcp`.
|
||||
properties:
|
||||
authentication:
|
||||
description: '`authentication` defines `MCPBackend`-specific
|
||||
authentication rules.'
|
||||
properties:
|
||||
audiences:
|
||||
description: |-
|
||||
`audiences` specifies the list of allowed audiences that are allowed
|
||||
access. This corresponds to the `aud` claim
|
||||
(https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).
|
||||
If unset, any audience is allowed.
|
||||
items:
|
||||
type: string
|
||||
maxItems: 64
|
||||
minItems: 1
|
||||
type: array
|
||||
issuer:
|
||||
description: |-
|
||||
`issuer` identifies the IdP that issued the JWT. This corresponds to the
|
||||
`iss` claim (https://tools.ietf.org/html/rfc7519#section-4.1.1).
|
||||
maxLength: 256
|
||||
minLength: 1
|
||||
type: string
|
||||
jwks:
|
||||
description: |-
|
||||
`jwks` defines the remote JSON Web Key used to validate the signature of
|
||||
the JWT.
|
||||
properties:
|
||||
backendRef:
|
||||
description: |-
|
||||
`backendRef` references the remote JWKS server to reach.
|
||||
Supported types are `Service` and static `Backend`. An
|
||||
`AgentgatewayPolicy` containing backend TLS config can then be attached
|
||||
to the `Service` or `Backend` in order to set TLS options for a
|
||||
connection to the remote `jwks` source.
|
||||
properties:
|
||||
group:
|
||||
default: ""
|
||||
description: |-
|
||||
Group is the group of the referent. For example, "gateway.networking.k8s.io".
|
||||
When unspecified or empty string, core API group is inferred.
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
default: Service
|
||||
description: |-
|
||||
Kind is the Kubernetes resource kind of the referent. For example
|
||||
"Service".
|
||||
|
||||
Defaults to "Service" when not specified.
|
||||
|
||||
ExternalName services can refer to CNAME DNS records that may live
|
||||
outside of the cluster and as such are difficult to reason about in
|
||||
terms of conformance. They also may not be safe to forward to (see
|
||||
CVE-2021-25740 for more information). Implementations SHOULD NOT
|
||||
support ExternalName Services.
|
||||
|
||||
Support: Core (Services with a type other than ExternalName)
|
||||
|
||||
Support: Implementation-specific (Services with type ExternalName)
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
name:
|
||||
description: Name is the name of
|
||||
the referent.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
namespace:
|
||||
description: |-
|
||||
Namespace is the namespace of the backend. When unspecified, the local
|
||||
namespace is inferred.
|
||||
|
||||
Note that when a namespace different than the local namespace is specified,
|
||||
a ReferenceGrant object is required in the referent namespace to allow that
|
||||
namespace's owner to accept the reference. See the ReferenceGrant
|
||||
documentation for details.
|
||||
|
||||
Support: Core
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
type: string
|
||||
port:
|
||||
description: |-
|
||||
Port specifies the destination port number to use for this resource.
|
||||
Port is required when the referent is a Kubernetes Service. In this
|
||||
case, the port number is the service port number, not the target port.
|
||||
For other resources, destination port might be derived from the referent
|
||||
resource or this field.
|
||||
format: int32
|
||||
maximum: 65535
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: Must have port for Service
|
||||
reference
|
||||
rule: '(size(self.group) == 0 && self.kind
|
||||
== ''Service'') ? has(self.port)
|
||||
: true'
|
||||
cacheDuration:
|
||||
default: 5m
|
||||
type: string
|
||||
x-kubernetes-validations:
|
||||
- message: invalid duration value
|
||||
rule: matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')
|
||||
- message: cacheDuration must be at
|
||||
least 5m.
|
||||
rule: duration(self) >= duration('5m')
|
||||
jwksPath:
|
||||
description: |-
|
||||
Path to the IdP `jwks` endpoint, relative to the root, commonly
|
||||
`".well-known/jwks.json"`.
|
||||
maxLength: 2000
|
||||
minLength: 1
|
||||
type: string
|
||||
required:
|
||||
- backendRef
|
||||
- jwksPath
|
||||
type: object
|
||||
mode:
|
||||
default: Strict
|
||||
description: '`mode` is the validation mode
|
||||
for JWT authentication.'
|
||||
enum:
|
||||
- Strict
|
||||
- Optional
|
||||
- Permissive
|
||||
type: string
|
||||
provider:
|
||||
description: '`provider` specifies the identity
|
||||
provider to use for authentication.'
|
||||
enum:
|
||||
- Auth0
|
||||
- Keycloak
|
||||
type: string
|
||||
resourceMetadata:
|
||||
additionalProperties:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
description: ResourceMetadata defines the
|
||||
metadata to use for MCP resources.
|
||||
type: object
|
||||
required:
|
||||
- jwks
|
||||
type: object
|
||||
authorization:
|
||||
description: |-
|
||||
authorization defines MCPBackend level authorization. Unlike authorization at the HTTP level, which will reject
|
||||
unauthorized requests with a `403` error, this policy works at the
|
||||
`MCPBackend` level.
|
||||
|
||||
List operations, such as `list_tools`, will have each item evaluated.
|
||||
Items that do not meet the rule will be filtered.
|
||||
|
||||
Get or call operations, such as `call_tool`, will evaluate the specific
|
||||
item and reject requests that do not meet the rule.
|
||||
properties:
|
||||
action:
|
||||
default: Allow
|
||||
description: |-
|
||||
`action` defines whether the rule allows, denies, or requires the request if
|
||||
matched. If unspecified, the default is `Allow`.
|
||||
Require policies are conjunctive across merged policies: all require policies must match.
|
||||
enum:
|
||||
- Allow
|
||||
- Deny
|
||||
- Require
|
||||
type: string
|
||||
policy:
|
||||
description: |-
|
||||
`policy` specifies the authorization rule to evaluate.
|
||||
|
||||
* For `Allow` rules: any policy allows the request.
|
||||
* For `Require` rules: all policies must match for the request to be allowed.
|
||||
* For `Deny` rules: any matching policy denies the request. Note: a CEL expression that fails to evaluate is not
|
||||
considered to match, making this a risky policy; prefer to use `Require`.
|
||||
|
||||
The presence of at least one `Allow` rule triggers a deny-by-default policy, requiring at least 1 match to allow.
|
||||
With no rules, all requires are allowed.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: |-
|
||||
MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
|
||||
These expressions should be in the form of a Common Expression Language
|
||||
(`CEL`) expression.
|
||||
items:
|
||||
description: CELExpression represents
|
||||
a Common Expression Language (CEL)
|
||||
expression.
|
||||
maxLength: 16384
|
||||
minLength: 1
|
||||
type: string
|
||||
maxItems: 256
|
||||
minItems: 1
|
||||
type: array
|
||||
required:
|
||||
- matchExpressions
|
||||
type: object
|
||||
required:
|
||||
- policy
|
||||
type: object
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: at least one of the fields in [authentication
|
||||
authorization] must be set
|
||||
rule: '[has(self.authentication),has(self.authorization)].filter(x,x==true).size()
|
||||
>= 1'
|
||||
tcp:
|
||||
description: tcp defines settings for managing TCP
|
||||
connections to the backend.
|
||||
@ -7756,12 +7558,6 @@ spec:
|
||||
- backendRef
|
||||
type: object
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: at least one of the fields in [auth health
|
||||
http mcp tcp tls transformation tunnel] must be
|
||||
set
|
||||
rule: '[has(self.auth),has(self.health),has(self.http),has(self.mcp),has(self.tcp),has(self.tls),has(self.transformation),has(self.tunnel)].filter(x,x==true).size()
|
||||
>= 1'
|
||||
port:
|
||||
description: Port is the port number of the MCP target.
|
||||
format: int32
|
||||
@ -7777,9 +7573,15 @@ spec:
|
||||
- SSE
|
||||
type: string
|
||||
required:
|
||||
- host
|
||||
- port
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: mcp target policies may not be used with backendRef
|
||||
rule: '!has(self.backendRef) || !has(self.policies)'
|
||||
- message: exactly one of the fields in [host backendRef]
|
||||
must be set
|
||||
rule: '[has(self.host),has(self.backendRef)].filter(x,x==true).size()
|
||||
== 1'
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
@ -12756,6 +12558,9 @@ spec:
|
||||
description: |-
|
||||
`mcp` specifies settings for MCP workloads. This is only applicable when
|
||||
connecting to a `Backend` of type `mcp`.
|
||||
|
||||
This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
|
||||
other policies such as transformation and rate limiting.
|
||||
properties:
|
||||
authentication:
|
||||
description: '`authentication` defines `MCPBackend`-specific
|
||||
|
||||
@ -5030,6 +5030,9 @@ spec:
|
||||
description: |-
|
||||
`mcp` specifies settings for MCP workloads. This is only applicable when
|
||||
connecting to a `Backend` of type `mcp`.
|
||||
|
||||
This field is deprecated; prefer to use traffic policy `jwtAuthentication.mcp`, which ensures authentication runs before
|
||||
other policies such as transformation and rate limiting.
|
||||
properties:
|
||||
authentication:
|
||||
description: '`authentication` defines `MCPBackend`-specific
|
||||
@ -7612,6 +7615,27 @@ spec:
|
||||
description: '`jwtAuthentication` authenticates users based on
|
||||
JWT tokens.'
|
||||
properties:
|
||||
mcp:
|
||||
description: |-
|
||||
`mcp` optionally enables MCP OAuth metadata endpoint handling
|
||||
and MCP-specific authentication behavior on top of standard JWT validation.
|
||||
When set, the gateway will serve the MCP OAuth metadata discovery endpoints.
|
||||
properties:
|
||||
provider:
|
||||
description: '`provider` specifies the identity provider
|
||||
to use for MCP authentication flows.'
|
||||
enum:
|
||||
- Auth0
|
||||
- Keycloak
|
||||
type: string
|
||||
resourceMetadata:
|
||||
additionalProperties:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
description: |-
|
||||
`resourceMetadata` defines the metadata to use for MCP resources,
|
||||
served at the MCP OAuth metadata endpoints.
|
||||
type: object
|
||||
type: object
|
||||
mode:
|
||||
default: Strict
|
||||
description: '`mode` is the validation mode for JWT authentication.'
|
||||
@ -7768,6 +7792,11 @@ spec:
|
||||
required:
|
||||
- providers
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: jwtAuthentication.mcp requires exactly one provider
|
||||
rule: '!has(self.mcp) || size(self.providers) == 1'
|
||||
- message: jwtAuthentication.mcp requires mode Strict
|
||||
rule: '!has(self.mcp) || !has(self.mode) || self.mode == ''Strict'''
|
||||
phase:
|
||||
description: |-
|
||||
The phase to apply the traffic policy to. If the phase is `PreRouting`,
|
||||
@ -8365,6 +8394,10 @@ spec:
|
||||
rule: '!has(self.backend) || !has(self.backend.ai) || ((!has(self.targetRefs)
|
||||
|| !self.targetRefs.exists(t, t.kind == ''Service'')) && (!has(self.targetSelectors)
|
||||
|| !self.targetSelectors.exists(t, t.kind == ''Service'')))'
|
||||
- message: traffic.jwtAuthentication may not be used with backend.mcp.authentication
|
||||
in the same policy
|
||||
rule: '!(has(self.traffic) && has(self.traffic.jwtAuthentication) &&
|
||||
has(self.backend) && has(self.backend.mcp) && has(self.backend.mcp.authentication))'
|
||||
- message: the 'frontend' field can only target a Gateway
|
||||
rule: 'has(self.frontend) && has(self.targetRefs) ? self.targetRefs.all(t,
|
||||
t.kind == ''Gateway'' && !has(t.sectionName)) : true'
|
||||
|
||||
@ -44,6 +44,14 @@ spec:
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- else }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
{{- end }}
|
||||
image: "{{ .Values.controller.image.registry | default .Values.image.registry }}/{{ .Values.controller.image.repository }}:{{ include "agentgateway.imageTag" (.Values.controller.image.tag | default .Values.image.tag | default .Chart.AppVersion) }}"
|
||||
imagePullPolicy: {{ .Values.controller.image.pullPolicy | default .Values.image.pullPolicy }}
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/admin"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/admin"
|
||||
)
|
||||
|
||||
func TestSnapshotResponseDataMarshalJSONString(t *testing.T) {
|
||||
@ -12,18 +12,16 @@ import (
|
||||
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/controller"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/controller"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/version"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) error {
|
||||
func RunAdminServer(ctx context.Context, setupOpts *controller.SetupOpts) {
|
||||
// serverHandlers defines the custom handlers that the Admin Server will support
|
||||
serverHandlers := getServerHandlers(ctx, setupOpts.KrtDebugger)
|
||||
|
||||
startHandlers(ctx, serverHandlers)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// use a function for the profile descriptions so that every time the admin page is displayed, it can show
|
||||
@ -81,7 +79,7 @@ func startHandlers(ctx context.Context, addHandlers ...func(mux *http.ServeMux,
|
||||
mux.HandleFunc("/", idx)
|
||||
mux.HandleFunc("/snapshots/", idx)
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf("localhost:%d", wellknown.KgatewayAdminPort),
|
||||
Addr: fmt.Sprintf("localhost:%d", wellknown.AdminPort),
|
||||
Handler: mux,
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
}
|
||||
@ -41,6 +41,7 @@ func NewConfigMapSyncer(client apiclient.Client, storePrefix, deploymentNamespac
|
||||
cmCollection := krt.NewFilteredInformer[*corev1.ConfigMap](client,
|
||||
kclient.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
Namespace: deploymentNamespace,
|
||||
LabelSelector: JwksStoreLabelSelector(storePrefix)},
|
||||
krtOptions.ToOptions("config_map_syncer/ConfigMaps")...)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/common"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/logging"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
)
|
||||
|
||||
// JwksStore is a top-level abstraction that relies on jwksCache and jwksFetcher to
|
||||
@ -34,7 +34,7 @@ type JwksStore struct {
|
||||
l sync.Mutex
|
||||
}
|
||||
|
||||
func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *collections.CommonCollections, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
|
||||
func BuildJwksStore(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
|
||||
logger.Info("creating jwks store")
|
||||
|
||||
jwksCache := NewJwksCache()
|
||||
@ -43,7 +43,7 @@ func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *colle
|
||||
jwksCache: jwksCache,
|
||||
jwksChanges: jwksChanges,
|
||||
jwksFetcher: NewJwksFetcher(jwksCache),
|
||||
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, commonCols.KrtOpts),
|
||||
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, krtOpts),
|
||||
cmNameToJwks: make(map[string]string),
|
||||
}
|
||||
BuildJwksConfigMapNamespacedNameFunc(storePrefix, deploymentNamespace)
|
||||
|
||||
@ -13,9 +13,9 @@ import (
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type JwksUrlBuilder interface {
|
||||
@ -191,7 +191,7 @@ func GetTLSConfig(
|
||||
certPool := x509.NewCertPool()
|
||||
for _, ref := range btls.CACertificateRefs {
|
||||
nn := types.NamespacedName{
|
||||
Name: string(ref.Name),
|
||||
Name: ref.Name,
|
||||
Namespace: namespace,
|
||||
}
|
||||
cfgmap := krt.FetchOne(krtctx, cfgmaps, krt.FilterObjectName(nn))
|
||||
|
||||
@ -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
|
||||
|
||||
@ -12,12 +12,13 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
a2aProtocol = "kgateway.dev/a2a"
|
||||
legacyA2aProtocol = "kgateway.dev/a2a"
|
||||
a2aProtocol = "agentgateway.dev/a2a"
|
||||
)
|
||||
|
||||
// NewA2APlugin creates a new A2A policy plugin
|
||||
@ -48,7 +49,8 @@ func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service,
|
||||
}).UnsortedList()
|
||||
|
||||
for _, port := range svc.Spec.Ports {
|
||||
if port.AppProtocol != nil && *port.AppProtocol == a2aProtocol {
|
||||
// support legacy kgateway.dev/a2a and agentgateway.dev/a2a
|
||||
if port.AppProtocol != nil && (*port.AppProtocol == a2aProtocol || *port.AppProtocol == legacyA2aProtocol) {
|
||||
logger.Debug("found A2A service", "service", svc.Name, "namespace", svc.Namespace, "port", port.Port)
|
||||
hostname := fmt.Sprintf("%s.%s.svc.%s", svc.Name, svc.Namespace, clusterDomain)
|
||||
policy := &api.Policy{
|
||||
|
||||
@ -275,7 +275,7 @@ func processGoogleModelArmor(ctx PolicyCtx, namespace string, armor *agentgatewa
|
||||
|
||||
// Set location with default value if not specified
|
||||
if armor.Location != nil {
|
||||
pgArmor.Location = ptr.Of(string(*armor.Location))
|
||||
pgArmor.Location = ptr.Of(*armor.Location)
|
||||
} else {
|
||||
pgArmor.Location = ptr.Of("us-central1")
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"istio.io/istio/pkg/slices"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@ -19,9 +20,8 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -240,7 +240,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
if scrt == nil {
|
||||
errs = append(errs, fmt.Errorf("secret %s not found", nn))
|
||||
} else {
|
||||
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
errs = append(errs, fmt.Errorf("secret %v contains invalid certificate: %v", nn, err))
|
||||
}
|
||||
p.Cert = scrt.Data[corev1.TLSCertKey]
|
||||
@ -262,7 +262,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
errs = append(errs, fmt.Errorf("ConfigMap %s not found", nn))
|
||||
continue
|
||||
}
|
||||
pem, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
pem, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("error extracting CA cert from ConfigMap %s: %w", nn, err))
|
||||
continue
|
||||
@ -417,15 +417,36 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (
|
||||
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
authnPolicy := policy.Spec.Backend.MCP.Authentication
|
||||
|
||||
idp := api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
|
||||
if authnPolicy.McpIDP != nil {
|
||||
if *authnPolicy.McpIDP == agentgateway.Keycloak {
|
||||
idp = api.BackendPolicySpec_McpAuthentication_KEYCLOAK
|
||||
} else if *authnPolicy.McpIDP == agentgateway.Auth0 {
|
||||
idp = api.BackendPolicySpec_McpAuthentication_AUTH0
|
||||
}
|
||||
mcpAuthn, err := translateMCPAuthenticationSpec(ctx, types.NamespacedName{
|
||||
Namespace: policy.Namespace,
|
||||
Name: policy.Name,
|
||||
}, authnPolicy)
|
||||
mcpAuthnPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_McpAuthentication_{
|
||||
McpAuthentication: mcpAuthn,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
logger.Debug("generated MCP authentication policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", mcpAuthnPolicy.Name)
|
||||
|
||||
return mcpAuthnPolicy, err
|
||||
}
|
||||
|
||||
func translateMCPAuthenticationSpec(
|
||||
ctx PolicyCtx,
|
||||
policy types.NamespacedName,
|
||||
authnPolicy *agentgateway.MCPAuthentication,
|
||||
) (*api.BackendPolicySpec_McpAuthentication, error) {
|
||||
idp := translateMcpIDP(authnPolicy.McpIDP)
|
||||
|
||||
// default mode is Strict
|
||||
mode := api.BackendPolicySpec_McpAuthentication_STRICT
|
||||
if authnPolicy.Mode == agentgateway.JWTAuthenticationModeStrict {
|
||||
@ -451,8 +472,55 @@ func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.Agent
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
extraResourceMetadata, metadataErr := translateMCPResourceMetadata(authnPolicy.ResourceMetadata)
|
||||
if metadataErr != nil {
|
||||
errs = append(errs, metadataErr)
|
||||
}
|
||||
|
||||
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
|
||||
Issuer: authnPolicy.Issuer,
|
||||
Audiences: authnPolicy.Audiences,
|
||||
Provider: idp,
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
JwksInline: translatedInlineJwks,
|
||||
Mode: mode,
|
||||
}
|
||||
return mcpAuthn, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateJWTMCPConfig(mcp *agentgateway.JWTMCPConfig) (*api.TrafficPolicySpec_JWT_MCP, error) {
|
||||
extraResourceMetadata, err := translateMCPResourceMetadata(mcp.ResourceMetadata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.TrafficPolicySpec_JWT_MCP{
|
||||
Provider: translateMcpIDP(mcp.Provider),
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func translateMcpIDP(provider *agentgateway.McpIDP) api.BackendPolicySpec_McpAuthentication_McpIDP {
|
||||
if provider == nil {
|
||||
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
|
||||
}
|
||||
if *provider == agentgateway.Keycloak {
|
||||
return api.BackendPolicySpec_McpAuthentication_KEYCLOAK
|
||||
}
|
||||
if *provider == agentgateway.Auth0 {
|
||||
return api.BackendPolicySpec_McpAuthentication_AUTH0
|
||||
}
|
||||
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
|
||||
}
|
||||
|
||||
func translateMCPResourceMetadata(resourceMetadata map[string]apiextensionsv1.JSON) (map[string]*structpb.Value, error) {
|
||||
var errs []error
|
||||
var extraResourceMetadata map[string]*structpb.Value
|
||||
for k, v := range authnPolicy.ResourceMetadata {
|
||||
for k, v := range resourceMetadata {
|
||||
if extraResourceMetadata == nil {
|
||||
extraResourceMetadata = make(map[string]*structpb.Value)
|
||||
}
|
||||
@ -467,34 +535,7 @@ func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.Agent
|
||||
|
||||
extraResourceMetadata[k] = proto
|
||||
}
|
||||
|
||||
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
|
||||
Issuer: authnPolicy.Issuer,
|
||||
Audiences: authnPolicy.Audiences,
|
||||
Provider: idp,
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
JwksInline: translatedInlineJwks,
|
||||
Mode: mode,
|
||||
}
|
||||
mcpAuthnPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_McpAuthentication_{
|
||||
McpAuthentication: mcpAuthn,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
logger.Debug("generated MCP authentication policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", mcpAuthnPolicy.Name)
|
||||
|
||||
return mcpAuthnPolicy, errors.Join(errs...)
|
||||
return extraResourceMetadata, errors.Join(errs...)
|
||||
}
|
||||
|
||||
// translateBackendAI processes AI configuration and creates corresponding Agw policies
|
||||
@ -581,6 +622,9 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
|
||||
CacheTools: aiSpec.PromptCaching.CacheTools,
|
||||
}
|
||||
translatedAIPolicy.PromptCaching.MinTokens = ptr.Of(uint32(aiSpec.PromptCaching.MinTokens)) //nolint:gosec // G115: MinTokens is validated by kubebuilder to be >= 0
|
||||
if aiSpec.PromptCaching.CacheMessageOffset > 0 {
|
||||
translatedAIPolicy.PromptCaching.CacheMessageOffset = ptr.Of(uint32(aiSpec.PromptCaching.CacheMessageOffset)) //nolint:gosec // G115: CacheMessageOffset is validated by kubebuilder to be >= 0
|
||||
}
|
||||
}
|
||||
|
||||
if aiSpec.Routes != nil {
|
||||
|
||||
@ -20,8 +20,8 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// NewBackendTLSPlugin creates a new BackendTLSPolicy plugin
|
||||
@ -130,16 +130,14 @@ func translatePoliciesForBackendTLS(
|
||||
}
|
||||
}
|
||||
|
||||
backendTLSPoliciesForThisTarget := krt.FetchOne(krtctx, targetIndex, krt.FilterKey(tgtRef.String()))
|
||||
if backendTLSPoliciesForThisTarget != nil {
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
backendTLSPoliciesForThisTarget := krtutil.FetchIndexObjects(krtctx, targetIndex, tgtRef)
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
}
|
||||
|
||||
switch string(target.Kind) {
|
||||
@ -211,7 +209,7 @@ func translatePoliciesForBackendTLS(
|
||||
if scrt == nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
res.Cert = scrt.Data[corev1.TLSCertKey]
|
||||
@ -254,9 +252,9 @@ func translatePoliciesForBackendTLS(
|
||||
func checkConflicted(
|
||||
btls *gwv1.BackendTLSPolicy,
|
||||
target gwv1.LocalPolicyTargetReferenceWithSectionName,
|
||||
allMatches *krt.IndexObject[utils.TypedNamespacedName, *gwv1.BackendTLSPolicy],
|
||||
allMatches []*gwv1.BackendTLSPolicy,
|
||||
) error {
|
||||
for _, m := range allMatches.Objects {
|
||||
for _, m := range allMatches {
|
||||
if m.UID == btls.UID {
|
||||
// This is ourself, skip it
|
||||
continue
|
||||
@ -353,7 +351,7 @@ func getBackendTLSCACert(
|
||||
}
|
||||
return nil, fmt.Errorf("certificate reference not found: %v", ref)
|
||||
}
|
||||
caCert, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
caCert, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
if err != nil {
|
||||
conds[string(gwv1.BackendTLSPolicyReasonResolvedRefs)].error = &ConfigError{
|
||||
Reason: string(gwv1.BackendTLSPolicyReasonInvalidCACertificateRef),
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"istio.io/istio/pkg/kube/kclient"
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
"istio.io/istio/pkg/kube/kubetypes"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
discovery "k8s.io/api/discovery/v1"
|
||||
inf "sigs.k8s.io/gateway-api-inference-extension/api/v1"
|
||||
@ -14,18 +15,23 @@ import (
|
||||
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
|
||||
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
||||
apisettings "github.com/agentgateway/agentgateway/controller/api/settings"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
kgwversioned "github.com/agentgateway/agentgateway/controller/pkg/client/clientset/versioned"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type AgwCollections struct {
|
||||
OurClient kgwversioned.Interface
|
||||
Client apiclient.Client
|
||||
KrtOpts krtutil.KrtOptions
|
||||
Settings apisettings.Settings
|
||||
|
||||
GatewaysForDeployer krt.Collection[collections.GatewayForDeployer]
|
||||
|
||||
// Core Kubernetes resources
|
||||
Namespaces krt.Collection[*corev1.Namespace]
|
||||
@ -76,82 +82,108 @@ type AgwCollections struct {
|
||||
// Collections that rely on plugins aren't initialized here,
|
||||
// and InitPlugins must be called.
|
||||
func NewAgwCollections(
|
||||
commoncol *collections.CommonCollections,
|
||||
krtOptions krtutil.KrtOptions,
|
||||
client apiclient.Client,
|
||||
agwControllerName string,
|
||||
settings apisettings.Settings,
|
||||
systemNamespace string,
|
||||
clusterID string,
|
||||
) (*AgwCollections, error) {
|
||||
filter := kclient.Filter{ObjectFilter: client.ObjectFilter()}
|
||||
gateways := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](
|
||||
client, wellknown.GatewayGVR, filter), krtOptions.ToOptions("informer/Gateways")...)
|
||||
gatewayClasses := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](
|
||||
client, wellknown.GatewayClassGVR, filter), krtOptions.ToOptions("informer/GatewayClasses")...)
|
||||
listenerSets := krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](
|
||||
client, wellknown.ListenerSetGVR, kubetypes.StandardInformer, filter), krtOptions.ToOptions("informer/ListenerSets")...)
|
||||
|
||||
byParentRefIndex := krtpkg.UnnamedIndex(listenerSets, func(in *gwv1.ListenerSet) []collections.TargetRefIndexKey {
|
||||
pRef := in.Spec.ParentRef
|
||||
ns := ptr.OrDefault(pRef.Namespace, gwv1.Namespace(in.GetNamespace()))
|
||||
// lookup by the root object
|
||||
return []collections.TargetRefIndexKey{{
|
||||
Group: wellknown.GatewayGroup,
|
||||
Kind: wellknown.GatewayKind,
|
||||
Name: string(pRef.Name),
|
||||
Namespace: string(ns),
|
||||
// this index intentionally doesn't include sectionName
|
||||
}}
|
||||
})
|
||||
|
||||
agwCollections := &AgwCollections{
|
||||
Client: commoncol.Client,
|
||||
KrtOpts: commoncol.KrtOpts,
|
||||
ControllerName: agwControllerName,
|
||||
SystemNamespace: systemNamespace,
|
||||
IstioNamespace: commoncol.Settings.IstioNamespace,
|
||||
IstioRevision: commoncol.Settings.IstioRevision,
|
||||
ClusterID: clusterID,
|
||||
Client: client,
|
||||
KrtOpts: krtOptions,
|
||||
Settings: settings,
|
||||
GatewaysForDeployer: krt.NewCollection(gateways, collections.GatewaysForDeployerTransformationFunc(gatewayClasses, listenerSets, byParentRefIndex, agwControllerName)),
|
||||
ControllerName: agwControllerName,
|
||||
SystemNamespace: systemNamespace,
|
||||
IstioNamespace: settings.IstioNamespace,
|
||||
IstioRevision: settings.IstioRevision,
|
||||
ClusterID: clusterID,
|
||||
|
||||
// Core Kubernetes resources
|
||||
Namespaces: krt.NewInformer[*corev1.Namespace](commoncol.Client, commoncol.KrtOpts.ToOptions("informer/Namespaces")...),
|
||||
Nodes: krt.NewFilteredInformer[*corev1.Node](commoncol.Client, kclient.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}, commoncol.KrtOpts.ToOptions("informer/Nodes")...),
|
||||
Pods: krt.NewFilteredInformer[*corev1.Pod](commoncol.Client, kclient.Filter{
|
||||
Namespaces: krt.NewInformer[*corev1.Namespace](client, krtOptions.ToOptions("informer/Namespaces")...),
|
||||
Nodes: krt.NewFilteredInformer[*corev1.Node](client, kclient.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}, krtOptions.ToOptions("informer/Nodes")...),
|
||||
Pods: krt.NewFilteredInformer[*corev1.Pod](client, kclient.Filter{
|
||||
ObjectTransform: istiokube.StripPodUnusedFields,
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}, commoncol.KrtOpts.ToOptions("informer/Pods")...),
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}, krtOptions.ToOptions("informer/Pods")...),
|
||||
|
||||
Secrets: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.Secret](commoncol.Client, kubetypes.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
kclient.NewFiltered[*corev1.Secret](client, kubetypes.Filter{
|
||||
FieldSelector: apiclient.SecretsFieldSelector,
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}),
|
||||
),
|
||||
ConfigMaps: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.ConfigMap](commoncol.Client, kubetypes.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
kclient.NewFiltered[*corev1.ConfigMap](client, kubetypes.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}),
|
||||
commoncol.KrtOpts.ToOptions("informer/ConfigMaps")...,
|
||||
krtOptions.ToOptions("informer/ConfigMaps")...,
|
||||
),
|
||||
Services: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.Service](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/Services")...),
|
||||
kclient.NewFiltered[*corev1.Service](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/Services")...),
|
||||
EndpointSlices: krt.WrapClient(
|
||||
kclient.NewFiltered[*discovery.EndpointSlice](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/EndpointSlices")...),
|
||||
kclient.NewFiltered[*discovery.EndpointSlice](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/EndpointSlices")...),
|
||||
|
||||
// Istio resources
|
||||
WorkloadEntries: krt.WrapClient(
|
||||
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](commoncol.Client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/WorkloadEntries")...),
|
||||
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/WorkloadEntries")...),
|
||||
ServiceEntries: krt.WrapClient(
|
||||
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](commoncol.Client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/ServiceEntries")...),
|
||||
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/ServiceEntries")...),
|
||||
|
||||
// Gateway API resources
|
||||
GatewayClasses: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](commoncol.Client, wellknown.GatewayClassGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GatewayClasses")...),
|
||||
Gateways: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](commoncol.Client, wellknown.GatewayGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/Gateways")...),
|
||||
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](commoncol.Client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/HTTPRoutes")...),
|
||||
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](commoncol.Client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GRPCRoutes")...),
|
||||
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](commoncol.Client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TLSRoutes")...),
|
||||
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](commoncol.Client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/BackendTLSPolicies")...),
|
||||
ListenerSets: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](commoncol.Client, gvr.ListenerSet, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ListenerSets")...),
|
||||
GatewayClasses: gatewayClasses,
|
||||
Gateways: gateways,
|
||||
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/HTTPRoutes")...),
|
||||
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/GRPCRoutes")...),
|
||||
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TLSRoutes")...),
|
||||
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/BackendTLSPolicies")...),
|
||||
ListenerSets: listenerSets,
|
||||
|
||||
// Gateway API alpha
|
||||
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](commoncol.Client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TCPRoutes")...),
|
||||
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](commoncol.Client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ReferenceGrants")...),
|
||||
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TCPRoutes")...),
|
||||
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/ReferenceGrants")...),
|
||||
// BackendTrafficPolicy?
|
||||
|
||||
// inference extensions need to be enabled so control plane has permissions to watch resource. Disable by default
|
||||
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, commoncol.KrtOpts.ToOptions("disable/inferencepools")...),
|
||||
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, krtOptions.ToOptions("disable/inferencepools")...),
|
||||
|
||||
// agentgateway-specific CRDs
|
||||
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](commoncol.Client),
|
||||
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](commoncol.Client),
|
||||
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](client),
|
||||
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](client),
|
||||
}
|
||||
|
||||
if commoncol.Settings.EnableInferExt {
|
||||
if settings.EnableInferExt {
|
||||
// inference extensions cluster watch permissions are controlled by enabling EnableInferExt
|
||||
inferencePoolGVR := wellknown.InferencePoolGVK.GroupVersion().WithResource("inferencepools")
|
||||
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](commoncol.Client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/InferencePools")...)
|
||||
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/InferencePools")...)
|
||||
}
|
||||
agwCollections.SetupIndexes()
|
||||
|
||||
@ -162,3 +194,7 @@ func (c *AgwCollections) SetupIndexes() {
|
||||
c.SecretsByNamespace = krt.NewNamespaceIndex(c.Secrets)
|
||||
c.ServicesByNamespace = krt.NewNamespaceIndex(c.Services)
|
||||
}
|
||||
|
||||
func (c *AgwCollections) HasSynced() bool {
|
||||
return c.GatewaysForDeployer.HasSynced()
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -128,7 +128,7 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
|
||||
|
||||
var path *string
|
||||
if tracing.Path != nil {
|
||||
path = ptr.Of(string(*tracing.Path))
|
||||
path = ptr.Of(*tracing.Path)
|
||||
}
|
||||
|
||||
var protocol api.FrontendPolicySpec_Tracing_Protocol
|
||||
@ -212,7 +212,7 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
|
||||
|
||||
var path *string
|
||||
if otlp.Path != nil {
|
||||
path = ptr.Of(string(*otlp.Path))
|
||||
path = ptr.Of(*otlp.Path)
|
||||
}
|
||||
|
||||
spec.OtlpAccessLog = &api.FrontendPolicySpec_Logging_OtlpAccessLog{
|
||||
|
||||
@ -17,8 +17,8 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -136,9 +136,9 @@ func validateInferencePoolEndpointPickerRef(krtctx krt.HandlerContext, pool *inf
|
||||
kind := epr.Kind
|
||||
if kind == "" {
|
||||
// InferencePool defaults this field to Service.
|
||||
kind = inf.Kind(wellknown.ServiceKind)
|
||||
kind = wellknown.ServiceKind
|
||||
}
|
||||
if kind != inf.Kind(wellknown.ServiceKind) {
|
||||
if kind != wellknown.ServiceKind {
|
||||
errs = append(errs, fmt.Sprintf("endpointPickerRef.kind must be %q, got %q", wellknown.ServiceKind, kind))
|
||||
}
|
||||
|
||||
@ -254,8 +254,8 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
return []inf.ParentReference{}
|
||||
}
|
||||
return []inf.ParentReference{{
|
||||
Kind: inf.Kind(defaultInferencePoolStatusKind),
|
||||
Name: inf.ObjectName(defaultInferencePoolStatusName),
|
||||
Kind: defaultInferencePoolStatusKind,
|
||||
Name: defaultInferencePoolStatusName,
|
||||
}}
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
for _, g := range gateways {
|
||||
refs = append(refs, inf.ParentReference{
|
||||
Group: ptr.Of(inf.Group(wellknown.GatewayGroup)),
|
||||
Kind: inf.Kind(wellknown.GatewayKind),
|
||||
Kind: wellknown.GatewayKind,
|
||||
Namespace: inf.Namespace(g.Namespace),
|
||||
Name: inf.ObjectName(g.Name),
|
||||
})
|
||||
|
||||
@ -13,12 +13,13 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type ReferenceTypes struct {
|
||||
PolicyTargets func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) (*api.PolicyTarget, bool)
|
||||
PolicyTargets func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool)
|
||||
PolicyBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
|
||||
RouteBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
|
||||
}
|
||||
@ -43,29 +44,29 @@ func (e *BackendReferenceError) Error() string {
|
||||
func DefaultReferenceTypes(agw *AgwCollections) ReferenceTypes {
|
||||
return ReferenceTypes{
|
||||
// AgentgatewayPolicy targets
|
||||
PolicyTargets: func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) (*api.PolicyTarget, bool) {
|
||||
PolicyTargets: func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
|
||||
key := namespace + "/" + string(name)
|
||||
switch gk {
|
||||
case wellknown.GatewayGVK.GroupKind():
|
||||
return &api.PolicyTarget{
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.GatewayTarget(namespace, string(name), sectionName),
|
||||
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
|
||||
case wellknown.HTTPRouteGVK.GroupKind():
|
||||
return &api.PolicyTarget{
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.RouteTarget(namespace, string(name), wellknown.HTTPRouteGVK.Kind, sectionName),
|
||||
}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
|
||||
case wellknown.GRPCRouteGVK.GroupKind():
|
||||
return &api.PolicyTarget{
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.RouteTarget(namespace, string(name), wellknown.GRPCRouteGVK.Kind, sectionName),
|
||||
}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
|
||||
case wellknown.AgentgatewayBackendGVK.GroupKind():
|
||||
return &api.PolicyTarget{
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.BackendTarget(namespace, string(name), sectionName),
|
||||
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
|
||||
case wellknown.ServiceGVK.GroupKind():
|
||||
return &api.PolicyTarget{
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.ServiceTarget(namespace, string(name), sectionName),
|
||||
}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
|
||||
}
|
||||
return nil, false
|
||||
},
|
||||
@ -275,13 +276,13 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
|
||||
return sets.New(object.NamespacedName)
|
||||
case wellknown.HTTPRouteGVK.Kind, wellknown.GRPCRouteGVK.Kind, wellknown.TCPRouteGVK.Kind, wellknown.TLSRouteGVK.Kind:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krt.FetchOne(ctx, p.attachments, krt.FilterKey(object.String())).Objects {
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.attachments, object) {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
default:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krt.FetchOne(ctx, p.Ancestors, krt.FilterKey(object.String())).Objects {
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.Ancestors, object) {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
@ -289,21 +290,19 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) LookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
|
||||
return p.lookupGatewaysForBackend(ctx, object, map[string]struct{}{})
|
||||
return p.lookupGatewaysForBackend(ctx, object, sets.New[utils.TypedNamespacedName]())
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen map[string]struct{}) sets.Set[types.NamespacedName] {
|
||||
key := object.String()
|
||||
if _, ok := seen[key]; ok {
|
||||
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen sets.Set[utils.TypedNamespacedName]) sets.Set[types.NamespacedName] {
|
||||
if seen.InsertContains(object) {
|
||||
return sets.New[types.NamespacedName]()
|
||||
}
|
||||
seen[key] = struct{}{}
|
||||
|
||||
base := p.LookupGatewaysForTarget(ctx, object)
|
||||
if p.PolicyAttachments == nil {
|
||||
return base
|
||||
}
|
||||
for _, pref := range krt.FetchOne(ctx, p.PolicyAttachments, krt.FilterKey(key)).Objects {
|
||||
for _, pref := range krtutil.FetchIndexObjects(ctx, p.PolicyAttachments, object) {
|
||||
base = base.Union(p.lookupGatewaysForBackend(ctx, pref.Target, seen))
|
||||
}
|
||||
return base
|
||||
@ -314,7 +313,7 @@ func (p ReferenceIndex) WithPolicyAttachments(references krt.IndexCollection[uti
|
||||
return p
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) (*api.PolicyTarget, bool) {
|
||||
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
|
||||
return p.explicitReferences.PolicyTargets(krtctx, namespace, name, gk, sectionName)
|
||||
}
|
||||
|
||||
|
||||
109
controller/pkg/agentgateway/plugins/testdata/trafficpolicy/jwt-mcp.yaml
vendored
Normal file
109
controller/pkg/agentgateway/plugins/testdata/trafficpolicy/jwt-mcp.yaml
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
mode: Strict
|
||||
providers:
|
||||
- issuer: https://auth.example.com/
|
||||
audiences:
|
||||
- my-api
|
||||
jwks:
|
||||
inline: |
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"kty": "RSA",
|
||||
"e": "AQAB",
|
||||
"use": "sig",
|
||||
"kid": "test-key",
|
||||
"alg": "RS256",
|
||||
"n": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
mcp:
|
||||
provider: Auth0
|
||||
resourceMetadata:
|
||||
oauthScopesSupported:
|
||||
- read
|
||||
- write
|
||||
resourceDocumentation: https://docs.example.com/mcp
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/jwt-mcp:jwt:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
jwt:
|
||||
mcp:
|
||||
provider: AUTH0
|
||||
resourceMetadata:
|
||||
extra:
|
||||
oauthScopesSupported:
|
||||
- read
|
||||
- write
|
||||
resourceDocumentation: https://docs.example.com/mcp
|
||||
mode: STRICT
|
||||
providers:
|
||||
- audiences:
|
||||
- my-api
|
||||
inline: |
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"kty": "RSA",
|
||||
"e": "AQAB",
|
||||
"use": "sig",
|
||||
"kid": "test-key",
|
||||
"alg": "RS256",
|
||||
"n": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
issuer: https://auth.example.com/
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,4 +1,4 @@
|
||||
package sslutils
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
@ -7,14 +7,6 @@ import (
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/client-go/util/cert"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
)
|
||||
|
||||
// Temporary home for constants for conformance testing that are not yet in a released version of Gateway API (https://github.com/kubernetes-sigs/gateway-api/blob/aa1ab6fd282dee4f74eeca803ec48b333297c637/apis/v1/gateway_types.go#L1606-L1614)
|
||||
const (
|
||||
ListenerReasonInvalidCACertificateRef gwv1.ListenerConditionReason = "InvalidCACertificateRef"
|
||||
ListenerReasonInvalidCACertificateKind gwv1.ListenerConditionReason = "InvalidCACertificateKind"
|
||||
ListenerReasonNoValidCACertificate gwv1.ListenerConditionReason = "NoValidCACertificate"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -29,16 +21,6 @@ var (
|
||||
ErrInvalidCACertificate = func(n, ns string, err error) error {
|
||||
return fmt.Errorf("invalid ca.crt in ConfigMap %s/%s: %v", ns, n, err)
|
||||
}
|
||||
|
||||
ErrVerifySubjectAltNamesRequiresCA = errors.New("verify-subject-alt-names annotation requires a trusted CA to be configured")
|
||||
|
||||
ErrInvalidCACertificateRef = errors.New(string(ListenerReasonInvalidCACertificateRef))
|
||||
ErrInvalidCACertificateKind = errors.New(string(ListenerReasonInvalidCACertificateKind))
|
||||
|
||||
ErrInvalidCACertificateKindDetails = func(n, ns, kind string) error {
|
||||
return fmt.Errorf("invalid ca.crt kind %s in %s/%s: %w", kind, ns, n, ErrInvalidCACertificateKind)
|
||||
}
|
||||
ErrMissingCaCertificateRefGrant = errors.New("missing CA certificate reference grant")
|
||||
)
|
||||
|
||||
func ValidateTlsSecretData(n, ns string, sslSecretData map[string][]byte) (cleanedCertChain string, err error) {
|
||||
@ -32,10 +32,10 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/logging"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -135,25 +135,27 @@ func TranslateAgentgatewayPolicy(ctx krt.HandlerContext, policy *agentgateway.Ag
|
||||
for _, target := range policy.Spec.TargetRefs {
|
||||
gk := schema.GroupKind{Group: string(target.Group), Kind: string(target.Kind)}
|
||||
|
||||
policyTarget, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
|
||||
if policyTarget == nil {
|
||||
policyTargets, targetExists := references.PolicyTarget(ctx, policy.Namespace, target.Name, gk, target.SectionName)
|
||||
if len(policyTargets) == 0 {
|
||||
// This should be impossible, verified by CEL validation
|
||||
logger.Warn("unsupported target kind", "kind", target.Kind, "policy", policy.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
gatewayTargets := references.LookupGatewaysForTarget(ctx, utils.TypedNamespacedName{
|
||||
gatewayTargets := references.LookupGatewaysForBackend(ctx, utils.TypedNamespacedName{
|
||||
NamespacedName: types.NamespacedName{Namespace: policy.Namespace, Name: string(target.Name)},
|
||||
Kind: gk.Kind,
|
||||
}).UnsortedList()
|
||||
|
||||
translatedPolicies := clonePoliciesForTarget(baseTranslatedPolicies, policyTarget)
|
||||
for _, translatedPolicy := range translatedPolicies {
|
||||
for _, gatewayTarget := range gatewayTargets {
|
||||
agwPolicies = append(agwPolicies, AgwPolicy{
|
||||
Gateway: ptr.Of(gatewayTarget),
|
||||
Policy: translatedPolicy,
|
||||
})
|
||||
for _, policyTarget := range policyTargets {
|
||||
translatedPolicies := clonePoliciesForTarget(baseTranslatedPolicies, policyTarget)
|
||||
for _, translatedPolicy := range translatedPolicies {
|
||||
for _, gatewayTarget := range gatewayTargets {
|
||||
agwPolicies = append(agwPolicies, AgwPolicy{
|
||||
Gateway: ptr.Of(gatewayTarget),
|
||||
Policy: translatedPolicy,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +304,7 @@ func resolvePolicyAncestorRefs(
|
||||
NamespacedName: types.NamespacedName{Namespace: policyNamespace, Name: string(targetName)},
|
||||
Kind: targetGK.Kind,
|
||||
}
|
||||
gatewayTargets := references.LookupGatewaysForTarget(ctx, object).UnsortedList()
|
||||
gatewayTargets := references.LookupGatewaysForBackend(ctx, object).UnsortedList()
|
||||
if len(gatewayTargets) == 0 {
|
||||
return nil, fmt.Sprintf("Policy is not attached: %s %s/%s is not attached to any Gateway", targetGK.Kind, policyNamespace, targetName)
|
||||
}
|
||||
@ -588,6 +590,19 @@ func processJWTAuthenticationPolicy(ctx PolicyCtx, jwt *agentgateway.JWTAuthenti
|
||||
}
|
||||
}
|
||||
|
||||
if jwt.MCP != nil {
|
||||
if len(jwt.Providers) != 1 {
|
||||
errs = append(errs, fmt.Errorf("jwtAuthentication.mcp requires exactly one provider, found %d", len(jwt.Providers)))
|
||||
} else {
|
||||
mcp, err := translateJWTMCPConfig(jwt.MCP)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
} else {
|
||||
p.Mcp = mcp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jwtPolicy := &api.Policy{
|
||||
Key: basePolicyName + jwtPolicySuffix,
|
||||
Name: TypedResourceFromName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"istio.io/istio/pkg/slices"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
)
|
||||
|
||||
var _ status.WorkerQueue = &TestStatusQueue{}
|
||||
|
||||
@ -29,12 +29,12 @@ import (
|
||||
agwv1alpha1 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/controller"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/controller"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
func CompareGolden(t test.Failer, content []byte, goldenFile string) {
|
||||
@ -150,7 +150,7 @@ type testOutput[Status any, Output any] struct {
|
||||
Output []Output `json:"output"`
|
||||
}
|
||||
|
||||
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *agentgatewaysyncer.Syncer) {
|
||||
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *syncer.Syncer) {
|
||||
fc := fake.NewClient(t)
|
||||
stop := test.NewStop(t)
|
||||
debugger := new(krt.DebugHandler)
|
||||
@ -161,7 +161,7 @@ func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (
|
||||
t.Log(string(b))
|
||||
}
|
||||
})
|
||||
syncer := agentgatewaysyncer.NewAgwSyncer(
|
||||
syncer := syncer.NewAgwSyncer(
|
||||
wellknown.DefaultAgwControllerName,
|
||||
// Only used for NACK, so no need to do anything special here.
|
||||
fc,
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// ParentErrorReason is the error string for a ParentError (reason parent could not be referenced)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
|
||||
)
|
||||
|
||||
func TestReferences(t *testing.T) {
|
||||
@ -66,7 +66,7 @@ func TestBackends(t *testing.T) {
|
||||
return a.ResourceName()
|
||||
})
|
||||
a := ri.Outputs.Addresses.List()
|
||||
a = slices.SortBy(a, func(a agentgatewaysyncer.Address) string {
|
||||
a = slices.SortBy(a, func(a syncer.Address) string {
|
||||
return a.ResourceName()
|
||||
})
|
||||
res := []any{}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -28,11 +28,11 @@ import (
|
||||
agwir "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// AgwRouteCollection creates the collection of translated Routes
|
||||
@ -261,7 +261,7 @@ func ProcessParentReferences[T any](
|
||||
msg = "Parent listener not usable or not permitted"
|
||||
} else if parent.OriginalReference.SectionName != nil || parent.OriginalReference.Port != nil {
|
||||
// Use string literal to avoid compile issues if the constant name differs.
|
||||
reason = gwv1.RouteConditionReason("NoMatchingParent")
|
||||
reason = "NoMatchingParent"
|
||||
msg = "No listener with the specified sectionName on the parent Gateway"
|
||||
}
|
||||
pr.SetCondition(reporter.RouteCondition{
|
||||
@ -352,7 +352,7 @@ func reasonResolvedRefs(cond *reporter.RouteCondition, ok bool) gwv1.RouteCondit
|
||||
if cond != nil && cond.Reason != "" {
|
||||
return cond.Reason
|
||||
}
|
||||
return gwv1.RouteConditionReason("Invalid")
|
||||
return "Invalid"
|
||||
}
|
||||
|
||||
// buildAttachedRoutesMapAllowed is the same as buildAttachedRoutesMap,
|
||||
|
||||
@ -11,7 +11,7 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 9090
|
||||
targetPort: 9090
|
||||
appProtocol: kgateway.dev/a2a
|
||||
appProtocol: agentgateway.dev/a2a
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
|
||||
@ -10,11 +10,11 @@ spec:
|
||||
test: test
|
||||
ports:
|
||||
- protocol: TCP
|
||||
appProtocol: kgateway.dev/mcp
|
||||
appProtocol: agentgateway.dev/mcp
|
||||
port: 80
|
||||
targetPort: test
|
||||
- protocol: TCP
|
||||
appProtocol: kgateway.dev/mcp-sse
|
||||
appProtocol: agentgateway.dev/mcp-sse
|
||||
port: 90
|
||||
targetPort: test-2
|
||||
---
|
||||
|
||||
64
controller/pkg/agentgateway/translator/testdata/backends/mcp-service-backendref.yaml
vendored
Normal file
64
controller/pkg/agentgateway/translator/testdata/backends/mcp-service-backendref.yaml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
namespace: default
|
||||
name: mcp-service-backendref
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: explicit-service
|
||||
static:
|
||||
backendRef:
|
||||
name: mcp-service-http
|
||||
port: 9090
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mcp-service-http
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- name: mcp-http
|
||||
port: 9090
|
||||
appProtocol: agentgateway.dev/mcp
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: basic
|
||||
Namespace: default
|
||||
resource:
|
||||
backend:
|
||||
key: default/mcp-service-backendref
|
||||
mcp:
|
||||
targets:
|
||||
- backend:
|
||||
port: 9090
|
||||
service:
|
||||
hostname: mcp-service-http.default.svc.cluster.local
|
||||
namespace: default
|
||||
name: explicit-service
|
||||
name:
|
||||
name: mcp-service-backendref
|
||||
namespace: default
|
||||
- canonical: true
|
||||
hostname: mcp-service-http.default.svc.cluster.local
|
||||
name: mcp-service-http
|
||||
namespace: default
|
||||
ports:
|
||||
- servicePort: 9090
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-service-backendref
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Backend successfully accepted
|
||||
reason: Accepted
|
||||
status: "True"
|
||||
type: Accepted
|
||||
@ -21,12 +21,12 @@ metadata:
|
||||
labels:
|
||||
app: mcp-server
|
||||
annotations:
|
||||
kgateway.dev/mcp-http-path: /custom-path
|
||||
agentgateway.dev/mcp-http-path: /custom-path
|
||||
spec:
|
||||
ports:
|
||||
- name: mcp
|
||||
port: 8080
|
||||
appProtocol: kgateway.dev/mcp-sse
|
||||
appProtocol: agentgateway.dev/mcp-sse
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
|
||||
@ -23,7 +23,7 @@ spec:
|
||||
ports:
|
||||
- name: mcp-http
|
||||
port: 9090
|
||||
appProtocol: kgateway.dev/mcp
|
||||
appProtocol: agentgateway.dev/mcp
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
|
||||
@ -6,13 +6,13 @@ metadata:
|
||||
labels:
|
||||
app: mcp-app
|
||||
annotations:
|
||||
kgateway.dev/mcp-path: /test
|
||||
agentgateway.dev/mcp-path: /test
|
||||
spec:
|
||||
selector:
|
||||
test: test
|
||||
ports:
|
||||
- protocol: TCP
|
||||
appProtocol: kgateway.dev/mcp
|
||||
appProtocol: agentgateway.dev/mcp
|
||||
port: 80
|
||||
targetPort: test
|
||||
---
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: processor
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: processor
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9002
|
||||
targetPort: 9002
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: client-tls
|
||||
namespace: default
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiakNDQVJPZ0F3SUJBZ0lVTFpDLzFkMEhpMlRFUGk5MUtwamVZbzgzZ1pBd0NnWUlLb1pJemowRUF3SXcKRERFS01BZ0dBMVVFQXd3QllUQWVGdzB5TlRFeE1qVXlNRFE0TURLYUZ3MHlOVEV4TWpZeU1EUTRNREphTUF3eApDakFJQmdOVkJBTU1BV0V3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVIvc1UybWRnbkhab2Z6CmR0b0tRZm5FMWdrVE9HY2JJaWFUeDdXUGpZcXF1c1p5ZWYybTBpbkgrcnJVRFBJY2tTRlQ5dnlzRVJFVTBKcGMKL3JTZmVVOG9vMU13VVRBZEJnTlZIUTRFRmdRVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dId1lEVlIwagpCQmd3Rm9BVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxCmhrak9QUVFEQWdOSkFEQkdBaUVBcW9ISTVENUt2VFR4YVVubW1mc0Nzem1vazZWR0dsZ3hpVm5HVmpKNHJ5VUMKSVFENExVcTRZMjVPbG4zQnNlbE1nT0M5VWNFS3dLRGlOTDZlMkc4S09EcU0wZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUxRblhESm5qZFRianhhV2NKQkJOK0FDVjh3UDRxR3RZdVA0VjdZSXdJdGRvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFZjdGTnBuWUp4MmFIODNiYUNrSDV4TllKRXpobkd5SW1rOGUxajQyS3Fyckdjbm45cHRJcAp4L3E2MUF6eUhKRWhVL2I4ckJFUkZOQ2FYUDYwbjNsUEtBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
|
||||
---
|
||||
# ext-proc policy targets Gateway, with backendRef to processor Service
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: ext-proc
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
phase: PreRouting
|
||||
extProc:
|
||||
backendRef:
|
||||
name: processor
|
||||
port: 9002
|
||||
---
|
||||
# backend TLS policy targets the processor Service (not the Gateway)
|
||||
# This should still be associated with the gateway via the ext-proc policy's backendRef
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: processor-backend-tls
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Service
|
||||
name: processor
|
||||
group: ""
|
||||
backend:
|
||||
tls:
|
||||
mtlsCertificateRef:
|
||||
- name: client-tls
|
||||
sni: processor.default.svc.cluster.local
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
backendTls:
|
||||
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiakNDQVJPZ0F3SUJBZ0lVTFpDLzFkMEhpMlRFUGk5MUtwamVZbzgzZ1pBd0NnWUlLb1pJemowRUF3SXcKRERFS01BZ0dBMVVFQXd3QllUQWVGdzB5TlRFeE1qVXlNRFE0TURLYUZ3MHlOVEV4TWpZeU1EUTRNREphTUF3eApDakFJQmdOVkJBTU1BV0V3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVIvc1UybWRnbkhab2Z6CmR0b0tRZm5FMWdrVE9HY2JJaWFUeDdXUGpZcXF1c1p5ZWYybTBpbkgrcnJVRFBJY2tTRlQ5dnlzRVJFVTBKcGMKL3JTZmVVOG9vMU13VVRBZEJnTlZIUTRFRmdRVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dId1lEVlIwagpCQmd3Rm9BVWdNQ01qYnRKZnQ2VjAyT1JWMzZQcmpBWWNPd3dEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxCmhrak9QUVFEQWdOSkFEQkdBaUVBcW9ISTVENUt2VFR4YVVubW1mc0Nzem1vazZWR0dsZ3hpVm5HVmpKNHJ5VUMKSVFENExVcTRZMjVPbG4zQnNlbE1nT0M5VWNFS3dLRGlOTDZlMkc4S09EcU0wZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
hostname: processor.default.svc.cluster.local
|
||||
key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUxRblhESm5qZFRianhhV2NKQkJOK0FDVjh3UDRxR3RZdVA0VjdZSXdJdGRvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFZjdGTnBuWUp4MmFIODNiYUNrSDV4TllKRXpobkd5SW1rOGUxajQyS3Fyckdjbm45cHRJcAp4L3E2MUF6eUhKRWhVL2I4ckJFUkZOQ2FYUDYwbjNsUEtBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
|
||||
key: default/processor-backend-tls:tls:default/processor.default.svc.cluster.local
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: processor-backend-tls
|
||||
namespace: default
|
||||
target:
|
||||
service:
|
||||
hostname: processor.default.svc.cluster.local
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/ext-proc:extproc:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: ext-proc
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
extProc:
|
||||
target:
|
||||
port: 9002
|
||||
service:
|
||||
hostname: processor.default.svc.cluster.local
|
||||
namespace: default
|
||||
phase: GATEWAY
|
||||
status: []
|
||||
78
controller/pkg/agentgateway/translator/testdata/routes/to-backend-cross-ns.yaml
vendored
Normal file
78
controller/pkg/agentgateway/translator/testdata/routes/to-backend-cross-ns.yaml
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: test-route
|
||||
namespace: default
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: test-gateway
|
||||
hostnames:
|
||||
- example.com
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /api
|
||||
backendRefs:
|
||||
- name: be
|
||||
namespace: other
|
||||
kind: AgentgatewayBackend
|
||||
group: agentgateway.dev
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: be
|
||||
namespace: other
|
||||
spec:
|
||||
static:
|
||||
host: primary.example.com
|
||||
port: 80
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test-gateway
|
||||
Namespace: default
|
||||
resource:
|
||||
route:
|
||||
backends:
|
||||
- weight: 1
|
||||
hostnames:
|
||||
- example.com
|
||||
key: default/test-route.00.http
|
||||
listenerKey: default/test-gateway.http
|
||||
matches:
|
||||
- path:
|
||||
pathPrefix: /api
|
||||
name:
|
||||
kind: HTTPRoute
|
||||
name: test-route
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: test-route
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
parents:
|
||||
- conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: ""
|
||||
reason: Accepted
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: backendRef be/other not accessible to a HTTPRoute in namespace "default"
|
||||
(missing a ReferenceGrant?)
|
||||
reason: RefNotPermitted
|
||||
status: "False"
|
||||
type: ResolvedRefs
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
parentRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test-gateway
|
||||
namespace: default
|
||||
78
controller/pkg/agentgateway/translator/testdata/routes/to-backend.yaml
vendored
Normal file
78
controller/pkg/agentgateway/translator/testdata/routes/to-backend.yaml
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: test-route
|
||||
namespace: default
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: test-gateway
|
||||
hostnames:
|
||||
- example.com
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /api
|
||||
backendRefs:
|
||||
- name: be
|
||||
kind: AgentgatewayBackend
|
||||
group: agentgateway.dev
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: be
|
||||
namespace: default
|
||||
spec:
|
||||
static:
|
||||
host: primary.example.com
|
||||
port: 80
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test-gateway
|
||||
Namespace: default
|
||||
resource:
|
||||
route:
|
||||
backends:
|
||||
- backend:
|
||||
backend: default/be
|
||||
weight: 1
|
||||
hostnames:
|
||||
- example.com
|
||||
key: default/test-route.00.http
|
||||
listenerKey: default/test-gateway.http
|
||||
matches:
|
||||
- path:
|
||||
pathPrefix: /api
|
||||
name:
|
||||
kind: HTTPRoute
|
||||
name: test-route
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: test-route
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
parents:
|
||||
- conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: ""
|
||||
reason: Accepted
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: ""
|
||||
reason: ResolvedRefs
|
||||
status: "True"
|
||||
type: ResolvedRefs
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
parentRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test-gateway
|
||||
namespace: default
|
||||
@ -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"
|
||||
)
|
||||
|
||||
|
||||
17
controller/pkg/apiclient/filters.go
Normal file
17
controller/pkg/apiclient/filters.go
Normal file
@ -0,0 +1,17 @@
|
||||
package apiclient
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
)
|
||||
|
||||
// SecretsFieldSelector is an optimization to avoid excessive secret bloat.
|
||||
// We only care about TLS certificates.
|
||||
// Unfortunately, it is not as simple as selecting type=kubernetes.io/tls; we support generic types.
|
||||
// Its also likely users have started to use random types and expect them to continue working.
|
||||
// This makes the assumption we will never care about Helm secrets or SA token secrets - two common
|
||||
// large secrets in clusters.
|
||||
// This is a best effort optimization only; the code would behave correctly if we watched all secrets.
|
||||
var SecretsFieldSelector = fields.AndSelectors(
|
||||
fields.OneTermNotEqualSelector("type", "helm.sh/release.v1"),
|
||||
fields.OneTermNotEqualSelector("type", string(corev1.SecretTypeServiceAccountToken))).String()
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
|
||||
agwv1alpha1 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// RegisterTypes registers all the types used by our API Client
|
||||
|
||||
@ -1,21 +1,18 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"golang.org/x/time/rate"
|
||||
"istio.io/istio/pkg/kube/kubetypes"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
internaldeployer "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
)
|
||||
|
||||
// rateLimiter uses token bucket for overall rate limiting and exponential backoff for per-item rate limiting
|
||||
@ -25,12 +22,9 @@ var rateLimiter = workqueue.NewTypedMaxOfRateLimiter(
|
||||
&workqueue.TypedBucketRateLimiter[any]{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
|
||||
)
|
||||
|
||||
// TODO [danehans]: Refactor so controller config is organized into shared and Gateway/InferencePool-specific controllers.
|
||||
type GatewayConfig struct {
|
||||
Client apiclient.Client
|
||||
Mgr manager.Manager
|
||||
// Dev enables development mode for the controller.
|
||||
Dev bool
|
||||
// AgwControllerName is the name of the agentgateway controller. Any GatewayClass objects
|
||||
// managed by this controller must have this name as their ControllerName.
|
||||
AgwControllerName string
|
||||
@ -38,12 +32,8 @@ type GatewayConfig struct {
|
||||
ImageDefaults *agentgateway.Image
|
||||
// ControlPlane sets the default control plane information the deployer will use.
|
||||
ControlPlane deployer.ControlPlaneInfo
|
||||
// ImageInfo sets the default image information the deployer will use.
|
||||
ImageInfo *deployer.ImageInfo
|
||||
// DiscoveryNamespaceFilter filters namespaced objects based on the discovery namespace filter.
|
||||
DiscoveryNamespaceFilter kubetypes.DynamicObjectFilter
|
||||
// CommonCollections used to fetch ir.Gateways for the deployer to generate the ports for the proxy service
|
||||
CommonCollections *collections.CommonCollections
|
||||
// AgwCollections used to fetch ir.Gateways for the deployer to generate the ports for the proxy service
|
||||
AgwCollections *agwplugins.AgwCollections
|
||||
// AgentgatewayClassName is the configured agent gateway class name.
|
||||
AgentgatewayClassName string
|
||||
// Additional GatewayClass definitions to support extending to other well-known gateway classes
|
||||
@ -55,7 +45,6 @@ type GatewayConfig struct {
|
||||
type HelmValuesGeneratorOverrideFunc func(inputs *deployer.Inputs) deployer.HelmValuesGenerator
|
||||
|
||||
func NewBaseGatewayController(
|
||||
ctx context.Context,
|
||||
cfg GatewayConfig,
|
||||
classInfos map[string]*deployer.GatewayClassInfo,
|
||||
helmValuesGeneratorOverride HelmValuesGeneratorOverrideFunc,
|
||||
@ -88,22 +77,20 @@ func watchGw(
|
||||
)
|
||||
|
||||
inputs := &deployer.Inputs{
|
||||
Dev: cfg.Dev,
|
||||
ImageDefaults: cfg.ImageDefaults,
|
||||
ControlPlane: cfg.ControlPlane,
|
||||
NoListenersDummyPort: cfg.CommonCollections.Settings.NoListenersDummyPort,
|
||||
ImageInfo: cfg.ImageInfo,
|
||||
CommonCollections: cfg.CommonCollections,
|
||||
NoListenersDummyPort: cfg.AgwCollections.Settings.NoListenersDummyPort,
|
||||
AgwCollections: cfg.AgwCollections,
|
||||
AgentgatewayClassName: cfg.AgentgatewayClassName,
|
||||
AgentgatewayControllerName: cfg.AgwControllerName,
|
||||
}
|
||||
|
||||
gwParams := internaldeployer.NewGatewayParameters(cfg.Client, inputs)
|
||||
gwParams := deployer.NewGatewayParameters(cfg.Client, inputs)
|
||||
if helmValuesGeneratorOverride != nil {
|
||||
gwParams.WithHelmValuesGeneratorOverride(helmValuesGeneratorOverride(inputs))
|
||||
}
|
||||
|
||||
d, err := internaldeployer.NewGatewayDeployer(
|
||||
d, err := deployer.NewGatewayDeployer(
|
||||
cfg.AgwControllerName,
|
||||
cfg.AgentgatewayClassName,
|
||||
cfg.Mgr.GetScheme(),
|
||||
@ -22,9 +22,9 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
var _ manager.LeaderElectionRunnable = (*gatewayClassReconciler)(nil)
|
||||
@ -31,14 +31,14 @@ import (
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
internaldeployer "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/logging"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
var logger = logging.New("gateway-controller")
|
||||
@ -47,7 +47,7 @@ var _ manager.LeaderElectionRunnable = (*gatewayReconciler)(nil)
|
||||
|
||||
type gatewayReconciler struct {
|
||||
deployer *deployer.Deployer
|
||||
gwParams *internaldeployer.GatewayParameters
|
||||
gwParams *deployer.GatewayParameters
|
||||
scheme *runtime.Scheme
|
||||
agwControllerName string
|
||||
|
||||
@ -69,7 +69,7 @@ type gatewayReconciler struct {
|
||||
func NewGatewayReconciler(
|
||||
cfg GatewayConfig,
|
||||
deployer *deployer.Deployer,
|
||||
gwParams *internaldeployer.GatewayParameters,
|
||||
gwParams *deployer.GatewayParameters,
|
||||
controllerExtension pluginsdk.GatewayControllerExtension,
|
||||
) *gatewayReconciler {
|
||||
filter := kclient.Filter{ObjectFilter: cfg.Client.ObjectFilter()}
|
||||
@ -87,7 +87,10 @@ func NewGatewayReconciler(
|
||||
deploymentClient: kclient.NewFiltered[*appsv1.Deployment](cfg.Client, filter),
|
||||
svcAccountClient: kclient.NewFiltered[*corev1.ServiceAccount](cfg.Client, filter),
|
||||
configMapClient: kclient.NewFiltered[*corev1.ConfigMap](cfg.Client, filter),
|
||||
secretClient: kclient.NewFiltered[*corev1.Secret](cfg.Client, filter),
|
||||
secretClient: kclient.NewFiltered[*corev1.Secret](cfg.Client, kclient.Filter{
|
||||
FieldSelector: apiclient.SecretsFieldSelector,
|
||||
ObjectFilter: cfg.Client.ObjectFilter(),
|
||||
}),
|
||||
}
|
||||
|
||||
// Reuse the parameter clients from the deployer to avoid duplicate watches
|
||||
@ -207,7 +210,7 @@ func NewGatewayReconciler(
|
||||
// this is necessary for two reasons:
|
||||
// 1. we don't Fetch() the GatewayForDeployer, so we must reconcile to prevent a stale reference
|
||||
// 2. if a ListenerSet adds a port to a GatewayForDeployer, we need to deploy the new ports
|
||||
cfg.CommonCollections.GatewaysForDeployer.Register(func(o krt.Event[collections.GatewayForDeployer]) {
|
||||
cfg.AgwCollections.GatewaysForDeployer.Register(func(o krt.Event[collections.GatewayForDeployer]) {
|
||||
gw := o.Latest()
|
||||
ref := types.NamespacedName{Namespace: gw.Namespace, Name: gw.Name}
|
||||
logger.Debug("explicitly reconciling Gateway for deployer due to GatewayForDeployer change", "ref", ref)
|
||||
@ -303,7 +306,7 @@ func (r *gatewayReconciler) Reconcile(req types.NamespacedName) (rErr error) {
|
||||
ctx := context.Background()
|
||||
objs, err := r.deployer.GetObjsToDeploy(ctx, gw)
|
||||
if err != nil {
|
||||
if errors.Is(err, internaldeployer.ErrNoValidPorts) {
|
||||
if errors.Is(err, deployer.ErrNoValidPorts) {
|
||||
// status is reported from translator, so return normally
|
||||
return err
|
||||
}
|
||||
@ -6,7 +6,6 @@ import (
|
||||
"log/slog"
|
||||
"maps"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
istiolog "istio.io/istio/pkg/log"
|
||||
@ -24,20 +23,16 @@ import (
|
||||
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
|
||||
agentgatewaybackend "github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/backend"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/backend"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/namespaces"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/version"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// TLSRootCAPath is the path to the TLS root CA
|
||||
const TLSRootCAPath = "/etc/xds-tls/ca.crt"
|
||||
|
||||
type SetupOpts struct {
|
||||
KrtDebugger *krt.DebugHandler
|
||||
|
||||
@ -73,29 +68,25 @@ type StartConfig struct {
|
||||
|
||||
Client apiclient.Client
|
||||
|
||||
AgwCollections *agwplugins.AgwCollections
|
||||
CommonCollections *collections.CommonCollections
|
||||
AgwCollections *agwplugins.AgwCollections
|
||||
|
||||
KrtOptions krtutil.KrtOptions
|
||||
ExtraAgwResourceStatusHandlers map[schema.GroupVersionKind]agentgatewaysyncer.ResourceStatusSyncer
|
||||
ExtraAgwResourceStatusHandlers map[schema.GroupVersionKind]syncer.ResourceStatusSyncer
|
||||
|
||||
// GatewayControllerExtension is an extension that can be used to extend Gateway controller
|
||||
GatewayControllerExtension pluginsdk.GatewayControllerExtension
|
||||
|
||||
// AgentgatewaySyncerOptions is the list of options to be passed when creating the AgentGatewaySyncer
|
||||
AgentgatewaySyncerOptions []agentgatewaysyncer.AgentgatewaySyncerOption
|
||||
AgentgatewaySyncerOptions []syncer.AgentgatewaySyncerOption
|
||||
}
|
||||
|
||||
// Start runs the controllers responsible for processing the K8s Gateway API objects
|
||||
// It is intended to be run in a goroutine as the function will block until the supplied
|
||||
// context is cancelled
|
||||
type ControllerBuilder struct {
|
||||
agwSyncer *agentgatewaysyncer.Syncer
|
||||
agwSyncer *syncer.Syncer
|
||||
cfg StartConfig
|
||||
mgr ctrl.Manager
|
||||
commoncol *collections.CommonCollections
|
||||
|
||||
ready atomic.Bool
|
||||
}
|
||||
|
||||
func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuilder, error) {
|
||||
@ -122,7 +113,7 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
|
||||
gvks = append(gvks, gvk)
|
||||
}
|
||||
|
||||
agwSyncer := agentgatewaysyncer.NewAgwSyncer(
|
||||
agwSyncer := syncer.NewAgwSyncer(
|
||||
cfg.AgwControllerName,
|
||||
cfg.Client,
|
||||
cfg.AgwCollections,
|
||||
@ -138,14 +129,14 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
agwStatusSyncer := agentgatewaysyncer.NewAgwStatusSyncer(
|
||||
agwStatusSyncer := syncer.NewAgwStatusSyncer(
|
||||
cfg.AgwControllerName,
|
||||
cfg.AgentgatewayClassName,
|
||||
cfg.Client,
|
||||
agwSyncer.StatusCollections(),
|
||||
agwSyncer.CacheSyncs(),
|
||||
cfg.ExtraAgwResourceStatusHandlers,
|
||||
cfg.CommonCollections.Settings.EnableInferExt,
|
||||
cfg.AgwCollections.Settings.EnableInferExt,
|
||||
)
|
||||
if err := cfg.Manager.Add(agwStatusSyncer); err != nil {
|
||||
setupLog.Error(err, "unable to add agentgateway StatusSyncer runnable")
|
||||
@ -157,7 +148,6 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
|
||||
agwSyncer: agwSyncer,
|
||||
cfg: cfg,
|
||||
mgr: cfg.Manager,
|
||||
commoncol: cfg.CommonCollections,
|
||||
}
|
||||
|
||||
// wait for the ControllerBuilder to Start
|
||||
@ -195,7 +185,7 @@ func agwPluginFactory(cfg StartConfig) func(ctx context.Context, agw *agwplugins
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Syncer, error) {
|
||||
func (c *ControllerBuilder) Build() (*syncer.Syncer, error) {
|
||||
slog.Info("creating gateway controllers")
|
||||
|
||||
globalSettings := c.cfg.SetupOpts.GlobalSettings
|
||||
@ -239,20 +229,13 @@ func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Sync
|
||||
XdsTLS: globalSettings.XdsTLS,
|
||||
XdsTlsCaPath: apisettings.TLSRootCAPath,
|
||||
},
|
||||
ImageInfo: &deployer.ImageInfo{
|
||||
Registry: globalSettings.DefaultImageRegistry,
|
||||
Tag: globalSettings.DefaultImageTag,
|
||||
PullPolicy: globalSettings.DefaultImagePullPolicy,
|
||||
},
|
||||
DiscoveryNamespaceFilter: c.cfg.Client.ObjectFilter(),
|
||||
CommonCollections: c.commoncol,
|
||||
AgentgatewayClassName: c.cfg.AgentgatewayClassName,
|
||||
CertWatcher: c.cfg.SetupOpts.CertWatcher,
|
||||
AgwCollections: c.cfg.AgwCollections,
|
||||
AgentgatewayClassName: c.cfg.AgentgatewayClassName,
|
||||
CertWatcher: c.cfg.SetupOpts.CertWatcher,
|
||||
}
|
||||
|
||||
setupLog.Info("creating base gateway controller")
|
||||
if err := NewBaseGatewayController(
|
||||
ctx,
|
||||
gwCfg,
|
||||
c.cfg.GatewayClassInfos,
|
||||
c.cfg.HelmValuesGeneratorOverride,
|
||||
@ -262,10 +245,6 @@ func (c *ControllerBuilder) Build(ctx context.Context) (*agentgatewaysyncer.Sync
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO (dmitri-d) don't think c.ready field is used anywhere and can be removed
|
||||
// mgr WaitForCacheSync is part of proxySyncer's HasSynced
|
||||
// so we can mark ready here before we call mgr.Start
|
||||
c.ready.Store(true)
|
||||
return c.agwSyncer, nil
|
||||
}
|
||||
|
||||
@ -19,11 +19,11 @@ import (
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer/strategicpatch"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const sessionKeyEnvVar = "SESSION_KEY"
|
||||
@ -54,7 +54,7 @@ func setIfNonZero[T comparable](dst *T, src T) {
|
||||
// ApplyToHelmValues applies the AgentgatewayParameters configs to the helm
|
||||
// values. This is called before rendering the helm chart. (We render a helm
|
||||
// chart, but we do not use helm beyond that point.)
|
||||
func (a *AgentgatewayParametersApplier) ApplyToHelmValues(vals *deployer.HelmConfig) {
|
||||
func (a *AgentgatewayParametersApplier) ApplyToHelmValues(vals *HelmConfig) {
|
||||
if a.params == nil || vals == nil || vals.Agentgateway == nil {
|
||||
return
|
||||
}
|
||||
@ -167,18 +167,21 @@ type agentgatewayParametersHelmValuesGenerator struct {
|
||||
agwParamClient kclient.Client[*agentgateway.AgentgatewayParameters]
|
||||
gwClassClient kclient.Client[*gwv1.GatewayClass]
|
||||
secretClient kclient.Client[*corev1.Secret]
|
||||
inputs *deployer.Inputs
|
||||
inputs *Inputs
|
||||
sessionKeyGen func() (string, error)
|
||||
}
|
||||
|
||||
func newAgentgatewayParametersHelmValuesGenerator(cli apiclient.Client, inputs *deployer.Inputs) *agentgatewayParametersHelmValuesGenerator {
|
||||
func newAgentgatewayParametersHelmValuesGenerator(cli apiclient.Client, inputs *Inputs) *agentgatewayParametersHelmValuesGenerator {
|
||||
filter := kclient.Filter{ObjectFilter: cli.ObjectFilter()}
|
||||
return &agentgatewayParametersHelmValuesGenerator{
|
||||
agwParamClient: kclient.NewFilteredDelayed[*agentgateway.AgentgatewayParameters](cli, wellknown.AgentgatewayParametersGVR, filter),
|
||||
gwClassClient: kclient.NewFilteredDelayed[*gwv1.GatewayClass](cli, wellknown.GatewayClassGVR, filter),
|
||||
secretClient: kclient.NewFiltered[*corev1.Secret](cli, filter),
|
||||
inputs: inputs,
|
||||
sessionKeyGen: generateSessionKey,
|
||||
secretClient: kclient.NewFiltered[*corev1.Secret](cli, kclient.Filter{
|
||||
FieldSelector: apiclient.SecretsFieldSelector,
|
||||
ObjectFilter: cli.ObjectFilter(),
|
||||
}),
|
||||
inputs: inputs,
|
||||
sessionKeyGen: generateSessionKey,
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +221,7 @@ func (g *agentgatewayParametersHelmValuesGenerator) GetValues(ctx context.Contex
|
||||
}
|
||||
|
||||
var jsonVals map[string]any
|
||||
err = deployer.JsonConvert(vals, &jsonVals)
|
||||
err = JsonConvert(vals, &jsonVals)
|
||||
return jsonVals, err
|
||||
}
|
||||
|
||||
@ -296,7 +299,7 @@ func usesManagedSessionKeyResolvedParameters(resolved *resolvedParameters) bool
|
||||
return usesManagedSessionKeyEnv(envs)
|
||||
}
|
||||
|
||||
func applyManagedSessionKeyDefaults(gtw *deployer.AgentgatewayHelmGateway, gatewayName string) {
|
||||
func applyManagedSessionKeyDefaults(gtw *AgentgatewayHelmGateway, gatewayName string) {
|
||||
if gtw == nil {
|
||||
return
|
||||
}
|
||||
@ -319,7 +322,7 @@ func (g *agentgatewayParametersHelmValuesGenerator) GetCacheSyncHandlers() []cac
|
||||
func (g *agentgatewayParametersHelmValuesGenerator) GetResolvedParametersForGateway(gw *gwv1.Gateway) (*resolvedParameters, error) {
|
||||
return g.resolveParameters(gw)
|
||||
}
|
||||
func DefaultGatewayIRGetter(gw *gwv1.Gateway, commonCollections *collections.CommonCollections) *collections.GatewayForDeployer {
|
||||
func DefaultGatewayIRGetter(gw *gwv1.Gateway, agwCollections *agwplugins.AgwCollections) *collections.GatewayForDeployer {
|
||||
gwKey := collections.ObjectSource{
|
||||
Group: wellknown.GatewayGVK.GroupKind().Group,
|
||||
Kind: wellknown.GatewayGVK.GroupKind().Kind,
|
||||
@ -327,33 +330,33 @@ func DefaultGatewayIRGetter(gw *gwv1.Gateway, commonCollections *collections.Com
|
||||
Namespace: gw.GetNamespace(),
|
||||
}
|
||||
|
||||
irGW := commonCollections.GatewaysForDeployer.GetKey(gwKey.ResourceName())
|
||||
irGW := agwCollections.GatewaysForDeployer.GetKey(gwKey.ResourceName())
|
||||
if irGW == nil {
|
||||
// If its not in the IR we cannot tell, so need to make a guess.
|
||||
controllerNameGuess := commonCollections.AgentgatewayControllerName
|
||||
controllerNameGuess := agwCollections.ControllerName
|
||||
irGW = GatewayIRFrom(gw, controllerNameGuess)
|
||||
}
|
||||
|
||||
return irGW
|
||||
}
|
||||
func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmValues(gw *gwv1.Gateway) (*deployer.HelmConfig, error) {
|
||||
irGW := DefaultGatewayIRGetter(gw, g.inputs.CommonCollections)
|
||||
ports := deployer.GetPortsValues(irGW, int32(g.inputs.NoListenersDummyPort))
|
||||
func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmValues(gw *gwv1.Gateway) (*HelmConfig, error) {
|
||||
irGW := DefaultGatewayIRGetter(gw, g.inputs.AgwCollections)
|
||||
ports := GetPortsValues(irGW, int32(g.inputs.NoListenersDummyPort))
|
||||
if len(ports) == 0 {
|
||||
return nil, ErrNoValidPorts
|
||||
}
|
||||
|
||||
gtw := &deployer.AgentgatewayHelmGateway{
|
||||
gtw := &AgentgatewayHelmGateway{
|
||||
Name: &gw.Name,
|
||||
GatewayClassName: func() *string {
|
||||
s := string(gw.Spec.GatewayClassName)
|
||||
return &s
|
||||
}(),
|
||||
Ports: ports,
|
||||
Xds: &deployer.HelmXds{
|
||||
Xds: &HelmXds{
|
||||
Host: &g.inputs.ControlPlane.XdsHost,
|
||||
Port: &g.inputs.ControlPlane.AgwXdsPort,
|
||||
Tls: &deployer.HelmXdsTls{
|
||||
Tls: &HelmXdsTls{
|
||||
Enabled: func() *bool { b := g.inputs.ControlPlane.XdsTLS; return &b }(),
|
||||
CaCert: &g.inputs.ControlPlane.XdsTlsCaPath,
|
||||
},
|
||||
@ -372,13 +375,13 @@ func (g *agentgatewayParametersHelmValuesGenerator) getDefaultAgentgatewayHelmVa
|
||||
PullPolicy: nil,
|
||||
}
|
||||
|
||||
gtw.Service = &deployer.AgentgatewayHelmService{}
|
||||
gtw.Service = &AgentgatewayHelmService{}
|
||||
// Extract loadBalancerIP from Gateway.spec.addresses and set it on the service
|
||||
if err := deployer.SetLoadBalancerIPFromGatewayForAgentgateway(gw, gtw.Service); err != nil {
|
||||
if err := SetLoadBalancerIPFromGatewayForAgentgateway(gw, gtw.Service); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &deployer.HelmConfig{Agentgateway: gtw}, nil
|
||||
return &HelmConfig{Agentgateway: gtw}, nil
|
||||
}
|
||||
|
||||
func gatewaySessionKeySecretName(gatewayName string) string {
|
||||
@ -21,7 +21,6 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
)
|
||||
|
||||
func newSyncedSecretClient(t *testing.T, objects ...client.Object) kclient.Client[*corev1.Secret] {
|
||||
@ -51,8 +50,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Image(t *testing.T) {
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -82,8 +81,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Resources(t *testing.T)
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -106,8 +105,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_Env(t *testing.T) {
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -130,8 +129,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_PreservesSessionKeyEnvV
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -143,7 +142,7 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_PreservesSessionKeyEnvV
|
||||
}
|
||||
|
||||
func TestApplyManagedSessionKeyDefaults_UsesUserProvidedSessionKey(t *testing.T) {
|
||||
vals := &deployer.AgentgatewayHelmGateway{
|
||||
vals := &AgentgatewayHelmGateway{
|
||||
AgentgatewayParametersConfigs: agentgateway.AgentgatewayParametersConfigs{
|
||||
Env: []corev1.EnvVar{
|
||||
{Name: "SESSION_KEY", Value: "inline-key"},
|
||||
@ -264,8 +263,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_RawConfig(t *testing.T)
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -310,8 +309,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_NoAliasing(t *testing.T
|
||||
origGWCLimits := gatewayClassAGWP.Spec.Resources.Limits.DeepCopy()
|
||||
|
||||
// Apply GatewayClass first, then Gateway — same order as GetValues.
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
NewAgentgatewayParametersApplier(gatewayClassAGWP).ApplyToHelmValues(vals)
|
||||
NewAgentgatewayParametersApplier(gatewayAGWP).ApplyToHelmValues(vals)
|
||||
@ -356,8 +355,8 @@ func TestAgentgatewayParametersApplier_ApplyToHelmValues_RawConfigWithLogging(t
|
||||
}
|
||||
|
||||
applier := NewAgentgatewayParametersApplier(params)
|
||||
vals := &deployer.HelmConfig{
|
||||
Agentgateway: &deployer.AgentgatewayHelmGateway{},
|
||||
vals := &HelmConfig{
|
||||
Agentgateway: &AgentgatewayHelmGateway{},
|
||||
}
|
||||
|
||||
applier.ApplyToHelmValues(vals)
|
||||
@ -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")
|
||||
|
||||
@ -4,14 +4,13 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
)
|
||||
|
||||
func NewGatewayDeployer(agwControllerName, agwGatewayClassName string, scheme *runtime.Scheme, client apiclient.Client, gwParams *GatewayParameters, opts ...deployer.Option) (*deployer.Deployer, error) {
|
||||
func NewGatewayDeployer(agwControllerName, agwGatewayClassName string, scheme *runtime.Scheme, client apiclient.Client, gwParams *GatewayParameters, opts ...Option) (*Deployer, error) {
|
||||
agentgatewayChart, err := LoadAgentgatewayChart()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return deployer.NewDeployerWithMultipleCharts(
|
||||
return NewDeployerWithMultipleCharts(
|
||||
agwControllerName, agwGatewayClassName, scheme, client, agentgatewayChart, gwParams, GatewayReleaseNameAndNamespace, opts...), nil
|
||||
}
|
||||
@ -16,14 +16,11 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
deployerinternal "github.com/agentgateway/agentgateway/controller/pkg/kgateway/deployer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
var scheme = schemes.DefaultScheme()
|
||||
@ -40,7 +37,7 @@ func TestDeployObjs(t *testing.T) {
|
||||
getDeployer := func(t *testing.T, fc apiclient.Client, patcher deployer.Patcher) *deployer.Deployer {
|
||||
t.Helper()
|
||||
|
||||
d, err := deployerinternal.NewGatewayDeployer(
|
||||
d, err := deployer.NewGatewayDeployer(
|
||||
wellknown.DefaultAgwControllerName,
|
||||
wellknown.DefaultAgwClassName,
|
||||
scheme,
|
||||
@ -198,7 +195,7 @@ func TestPruneRemovedResources(t *testing.T) {
|
||||
|
||||
getDeployer := func(t *testing.T, fc apiclient.Client) *deployer.Deployer {
|
||||
t.Helper()
|
||||
d, err := deployerinternal.NewGatewayDeployer(
|
||||
d, err := deployer.NewGatewayDeployer(
|
||||
wellknown.DefaultAgwControllerName,
|
||||
wellknown.DefaultAgwClassName,
|
||||
scheme,
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
package deployer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
GatewayParametersError = errors.New("could not retrieve GatewayParameters")
|
||||
GetGatewayParametersForGatewayError = func(err error, gwpNamespace, gwpName, gwNamespace, gwName, resourceType string) error {
|
||||
return fmt.Errorf("(%s.%s) for %s (%s.%s): %w",
|
||||
gwpNamespace, gwpName, resourceType, gwNamespace, gwName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err))
|
||||
}
|
||||
GetGatewayParametersForGatewayClassError = func(err error, gwpNamespace, gwpName, gwcName, resourceType string) error {
|
||||
return fmt.Errorf("(%s.%s) for %s (%s): %w",
|
||||
gwpNamespace, gwpName, resourceType, gwcName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err))
|
||||
}
|
||||
NilDeployerInputsErr = errors.New("nil inputs to NewDeployer")
|
||||
)
|
||||
@ -1,18 +1,35 @@
|
||||
package deployer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
"istio.io/istio/pkg/kube/kclient"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
agwplugins "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/helm"
|
||||
)
|
||||
|
||||
// Inputs is the set of options used to configure gateway/inference pool deployment.
|
||||
type Inputs struct {
|
||||
Dev bool
|
||||
ImageDefaults *agentgateway.Image
|
||||
ControlPlane ControlPlaneInfo
|
||||
NoListenersDummyPort uint16
|
||||
ImageInfo *ImageInfo
|
||||
CommonCollections *collections.CommonCollections
|
||||
AgwCollections *agwplugins.AgwCollections
|
||||
AgentgatewayClassName string
|
||||
AgentgatewayControllerName string
|
||||
}
|
||||
@ -24,3 +41,220 @@ type InMemoryGatewayParametersConfig struct {
|
||||
AgwControllerName string
|
||||
OmitDefaultSecurityContext bool
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrNoValidPorts is returned when no valid ports are found for the Gateway
|
||||
ErrNoValidPorts = errors.New("no valid ports")
|
||||
)
|
||||
|
||||
const sessionKeyChecksumAnnotation = "checksum/session-key"
|
||||
|
||||
func NewGatewayParameters(cli apiclient.Client, inputs *Inputs) *GatewayParameters {
|
||||
gp := &GatewayParameters{
|
||||
inputs: inputs,
|
||||
agwHelmValuesGenerator: newAgentgatewayParametersHelmValuesGenerator(cli, inputs),
|
||||
}
|
||||
|
||||
return gp
|
||||
}
|
||||
|
||||
type GatewayParameters struct {
|
||||
inputs *Inputs
|
||||
helmValuesGeneratorOverride HelmValuesGenerator
|
||||
agwHelmValuesGenerator *agentgatewayParametersHelmValuesGenerator
|
||||
}
|
||||
|
||||
func (gp *GatewayParameters) WithHelmValuesGeneratorOverride(generator HelmValuesGenerator) *GatewayParameters {
|
||||
gp.helmValuesGeneratorOverride = generator
|
||||
return gp
|
||||
}
|
||||
|
||||
func (gp *GatewayParameters) WithSessionKeyGenerator(generator func() (string, error)) *GatewayParameters {
|
||||
if gp.agwHelmValuesGenerator != nil && generator != nil {
|
||||
gp.agwHelmValuesGenerator.sessionKeyGen = generator
|
||||
}
|
||||
return gp
|
||||
}
|
||||
|
||||
// GetAgentgatewayParametersClient returns the AgentgatewayParameters client if Agentgateway is enabled, nil otherwise.
|
||||
// This allows the reconciler to reuse the same client for watching changes.
|
||||
func (gp *GatewayParameters) GetAgentgatewayParametersClient() kclient.Client[*agentgateway.AgentgatewayParameters] {
|
||||
if gp.agwHelmValuesGenerator != nil {
|
||||
return gp.agwHelmValuesGenerator.agwParamClient
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func LoadAgentgatewayChart() (*chart.Chart, error) {
|
||||
return loadChart(helm.AgentgatewayHelmChart)
|
||||
}
|
||||
|
||||
func (gp *GatewayParameters) GetValues(ctx context.Context, obj client.Object) (map[string]any, error) {
|
||||
generator, err := gp.getHelmValuesGenerator(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return generator.GetValues(ctx, obj)
|
||||
}
|
||||
|
||||
func (gp *GatewayParameters) GetCacheSyncHandlers() []cache.InformerSynced {
|
||||
if gp.helmValuesGeneratorOverride != nil {
|
||||
return gp.helmValuesGeneratorOverride.GetCacheSyncHandlers()
|
||||
}
|
||||
|
||||
var handlers []cache.InformerSynced
|
||||
if gp.agwHelmValuesGenerator != nil {
|
||||
handlers = append(handlers, gp.agwHelmValuesGenerator.GetCacheSyncHandlers()...)
|
||||
}
|
||||
return handlers
|
||||
}
|
||||
|
||||
// PostProcessObjects implements deployer.ObjectPostProcessor.
|
||||
// It applies GatewayParameters or AgentgatewayParameters overlays to the rendered objects.
|
||||
// When both GatewayClass and Gateway have parameters, the overlays
|
||||
// are applied in order: GatewayClass first, then Gateway on top.
|
||||
func (gp *GatewayParameters) PostProcessObjects(ctx context.Context, obj client.Object, rendered []client.Object) ([]client.Object, error) {
|
||||
// Check if override implements ObjectPostProcessor and delegate to it
|
||||
if gp.helmValuesGeneratorOverride != nil {
|
||||
if postProcessor, ok := gp.helmValuesGeneratorOverride.(ObjectPostProcessor); ok {
|
||||
return postProcessor.PostProcessObjects(ctx, obj, rendered)
|
||||
}
|
||||
}
|
||||
|
||||
gw, ok := obj.(*gwv1.Gateway)
|
||||
if !ok {
|
||||
return rendered, nil
|
||||
}
|
||||
|
||||
// Determine which controller this Gateway uses
|
||||
var gwClassClient kclient.Client[*gwv1.GatewayClass]
|
||||
if gp.agwHelmValuesGenerator != nil {
|
||||
gwClassClient = gp.agwHelmValuesGenerator.gwClassClient
|
||||
} else {
|
||||
return nil, fmt.Errorf("no controller enabled for Gateway %s/%s", gw.GetNamespace(), gw.GetName())
|
||||
}
|
||||
|
||||
gwc, err := getGatewayClassFromGateway(gwClassClient, gw)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get GatewayClass for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
|
||||
}
|
||||
|
||||
// Check if this is an agentgateway or envoy gateway
|
||||
if string(gwc.Spec.ControllerName) == gp.inputs.AgentgatewayControllerName {
|
||||
// Agentgateway overlays
|
||||
if gp.agwHelmValuesGenerator == nil {
|
||||
// Agentgateway not enabled; skip overlays (not an error since overlays are optional).
|
||||
return rendered, nil
|
||||
}
|
||||
resolved, err := gp.agwHelmValuesGenerator.GetResolvedParametersForGateway(gw)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to resolve AgentgatewayParameters for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
|
||||
}
|
||||
|
||||
// Apply overlays in order: GatewayClass first, then Gateway.
|
||||
if resolved.gatewayClassAGWP != nil {
|
||||
applier := NewAgentgatewayParametersApplier(resolved.gatewayClassAGWP)
|
||||
rendered, err = applier.ApplyOverlaysToObjects(rendered)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if resolved.gatewayAGWP != nil {
|
||||
applier := NewAgentgatewayParametersApplier(resolved.gatewayAGWP)
|
||||
rendered, err = applier.ApplyOverlaysToObjects(rendered)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if usesManagedSessionKeyResolvedParameters(resolved) {
|
||||
sessionKeySecret, err := gp.agwHelmValuesGenerator.buildSessionKeySecret(
|
||||
ctx,
|
||||
gw,
|
||||
gatewaySessionKeySecretName(gw.Name),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to build session key secret for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
|
||||
}
|
||||
if err := addSessionKeyChecksumAnnotation(rendered, sessionKeySecret); err != nil {
|
||||
return nil, fmt.Errorf("failed to annotate session key checksum for Gateway %s/%s: %w", gw.GetNamespace(), gw.GetName(), err)
|
||||
}
|
||||
rendered = append(rendered, sessionKeySecret)
|
||||
}
|
||||
}
|
||||
|
||||
return rendered, nil
|
||||
}
|
||||
|
||||
func addSessionKeyChecksumAnnotation(rendered []client.Object, secret *corev1.Secret) error {
|
||||
key, found := secret.Data["key"]
|
||||
if !found || len(key) == 0 {
|
||||
return fmt.Errorf("session key secret %s/%s missing key entry", secret.Namespace, secret.Name)
|
||||
}
|
||||
|
||||
checksum := sha256.Sum256(key)
|
||||
checksumHex := hex.EncodeToString(checksum[:])
|
||||
|
||||
for _, obj := range rendered {
|
||||
deployment, ok := obj.(*appsv1.Deployment)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if deployment.Spec.Template.Annotations == nil {
|
||||
deployment.Spec.Template.Annotations = map[string]string{}
|
||||
}
|
||||
deployment.Spec.Template.Annotations[sessionKeyChecksumAnnotation] = checksumHex
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GatewayReleaseNameAndNamespace(obj client.Object) (string, string) {
|
||||
// A helm release is never installed, only a template is generated, so the name doesn't matter
|
||||
// Use a hard-coded name to avoid going over the 53 character name limit
|
||||
return "release-name-placeholder", obj.GetNamespace()
|
||||
}
|
||||
|
||||
func (gp *GatewayParameters) getHelmValuesGenerator(obj client.Object) (HelmValuesGenerator, error) {
|
||||
gw, ok := obj.(*gwv1.Gateway)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected a Gateway resource, got %s", obj.GetObjectKind().GroupVersionKind().String())
|
||||
}
|
||||
|
||||
if gp.helmValuesGeneratorOverride != nil {
|
||||
slog.Debug("using override HelmValuesGenerator for Gateway",
|
||||
"gateway_name", gw.GetName(),
|
||||
"gateway_namespace", gw.GetNamespace(),
|
||||
)
|
||||
return gp.helmValuesGeneratorOverride, nil
|
||||
}
|
||||
|
||||
return gp.agwHelmValuesGenerator, nil
|
||||
}
|
||||
|
||||
func getGatewayClassFromGateway(cli kclient.Client[*gwv1.GatewayClass], gw *gwv1.Gateway) (*gwv1.GatewayClass, error) {
|
||||
if gw == nil {
|
||||
return nil, errors.New("nil Gateway")
|
||||
}
|
||||
if gw.Spec.GatewayClassName == "" {
|
||||
return nil, errors.New("GatewayClassName must not be empty")
|
||||
}
|
||||
|
||||
gwc := cli.Get(string(gw.Spec.GatewayClassName), metav1.NamespaceNone)
|
||||
if gwc == nil {
|
||||
return nil, fmt.Errorf("failed to get GatewayClass for Gateway %s/%s", gw.GetName(), gw.GetNamespace())
|
||||
}
|
||||
|
||||
return gwc, nil
|
||||
}
|
||||
|
||||
func translateInfraMeta[K ~string, V ~string](meta map[K]V) map[string]string {
|
||||
infra := make(map[string]string, len(meta))
|
||||
for k, v := range meta {
|
||||
if strings.HasPrefix(string(k), "gateway.networking.k8s.io/") {
|
||||
continue // ignore this prefix to avoid conflicts
|
||||
}
|
||||
infra[string(k)] = string(v)
|
||||
}
|
||||
return infra
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// ResourceOverlays contains all the overlays that can be applied to rendered objects.
|
||||
|
||||
@ -3,13 +3,11 @@ package deployer
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/deployer"
|
||||
)
|
||||
|
||||
// injectXdsCACertificate reads the CA certificate from the control plane's mounted TLS Secret
|
||||
// and injects it into the Helm values so it can be used by the proxy templates.
|
||||
func injectXdsCACertificate(caCertPath string, vals *deployer.HelmConfig) error {
|
||||
func injectXdsCACertificate(caCertPath string, vals *HelmConfig) error {
|
||||
if _, err := os.Stat(caCertPath); os.IsNotExist(err) {
|
||||
return fmt.Errorf("xDS TLS is enabled but CA certificate file not found at %s. "+
|
||||
"Ensure the xDS TLS secret is properly mounted and contains ca.crt", caCertPath,
|
||||
@ -24,10 +24,6 @@ var (
|
||||
// This file contains helper functions that generate helm values in the format needed
|
||||
// by the deployer.
|
||||
|
||||
var ComponentLogLevelEmptyError = func(key string, value string) error {
|
||||
return fmt.Errorf("an empty key or value was provided in componentLogLevels: key=%s, value=%s", key, value)
|
||||
}
|
||||
|
||||
// Extract the listener ports from a Gateway and corresponding listener sets. These will be used to populate:
|
||||
// 1. the ports exposed on the envoy container
|
||||
// 2. the ports exposed on the proxy service
|
||||
@ -48,7 +44,7 @@ func GetPortsValues(gw *collections.GatewayForDeployer, noListenersDummyPort int
|
||||
|
||||
if len(listenerPorts) == 0 && noListenersDummyPort != 0 {
|
||||
port := noListenersDummyPort
|
||||
portName := GenerateListenerNameFromPort(gwv1.PortNumber(port))
|
||||
portName := GenerateListenerNameFromPort(port)
|
||||
gwPorts = AppendPortValue(gwPorts, port, portName)
|
||||
}
|
||||
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
package agentgatewaysyncer
|
||||
|
||||
import (
|
||||
"istio.io/istio/pkg/kube/controllers"
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/translator"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
)
|
||||
|
||||
type PolicyStatusCollections = map[schema.GroupKind]krt.StatusCollection[controllers.Object, any]
|
||||
|
||||
func AgwPolicyCollection(agwPlugins plugins.AgwPlugin, references plugins.ReferenceIndex, krtopts krtutil.KrtOptions) (krt.Collection[ir.AgwResource], krt.Collection[*plugins.PolicyAttachment], PolicyStatusCollections) {
|
||||
var allPolicies []krt.Collection[plugins.AgwPolicy]
|
||||
var allReferences []krt.Collection[*plugins.PolicyAttachment]
|
||||
policyStatusMap := PolicyStatusCollections{}
|
||||
// Collect all policies from registered plugins.
|
||||
// Note: Only one plugin should be used per source GVK.
|
||||
// Avoid joining collections per-GVK before passing them to a plugin.
|
||||
for gvk, plugin := range agwPlugins.ContributesPolicies {
|
||||
policy, policyStatus, refs := plugin.ApplyPolicies(plugins.PolicyPluginInput{References: references})
|
||||
if refs != nil {
|
||||
allReferences = append(allReferences, refs)
|
||||
}
|
||||
allPolicies = append(allPolicies, policy)
|
||||
if policyStatus != nil {
|
||||
// some plugins may not have a status collection (a2a services, etc.)
|
||||
policyStatusMap[gvk] = policyStatus
|
||||
}
|
||||
}
|
||||
joinPolicies := krt.JoinCollection(allPolicies, krtopts.ToOptions("JoinPolicies")...)
|
||||
|
||||
allPoliciesCol := krt.NewCollection(joinPolicies, func(ctx krt.HandlerContext, i plugins.AgwPolicy) *ir.AgwResource {
|
||||
return ptr.Of(translator.ToResourceForGateway(*i.Gateway, i))
|
||||
}, krtopts.ToOptions("AllPolicies")...)
|
||||
|
||||
allRefsCol := krt.JoinCollection(allReferences, krtopts.ToOptions("PolicyReferences")...)
|
||||
|
||||
return allPoliciesCol, allRefsCol, policyStatusMap
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
These CRDs are needed by the setup suite and manually maintained.
|
||||
|
||||
When bumping gateway-api version, use the `bump-gtw` Makefile target to update these CRDs.
|
||||
@ -1,27 +0,0 @@
|
||||
package crds
|
||||
|
||||
import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed gateway-crds.yaml
|
||||
var GatewayCrds []byte
|
||||
|
||||
func getDirectory() string {
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
return path.Dir(filename)
|
||||
}
|
||||
|
||||
// directory is the absolute path to the directory containing the crd files
|
||||
// It can't change at runtime, so we can cache it
|
||||
var directory = getDirectory()
|
||||
|
||||
// AbsPathToCrd returns the absolute path to directory in which crds are stored (currently the same directory as this file)
|
||||
// Used for tests to find the crd files if needed
|
||||
func AbsPathToCrd(crdFile string) string {
|
||||
return filepath.Join(directory, crdFile)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,753 +0,0 @@
|
||||
# Copyright 2024 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#
|
||||
# Gateway API Experimental channel install
|
||||
#
|
||||
---
|
||||
#
|
||||
# config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml
|
||||
#
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/3328
|
||||
gateway.networking.k8s.io/bundle-version: v1.3.0
|
||||
gateway.networking.k8s.io/channel: experimental
|
||||
creationTimestamp: null
|
||||
name: tcproutes.gateway.networking.k8s.io
|
||||
spec:
|
||||
group: gateway.networking.k8s.io
|
||||
names:
|
||||
categories:
|
||||
- gateway-api
|
||||
kind: TCPRoute
|
||||
listKind: TCPRouteList
|
||||
plural: tcproutes
|
||||
singular: tcproute
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- jsonPath: .metadata.creationTimestamp
|
||||
name: Age
|
||||
type: date
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
TCPRoute provides a way to route TCP requests. When combined with a Gateway
|
||||
listener, it can be used to forward connections on the port specified by the
|
||||
listener to a set of backends specified by the TCPRoute.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: |-
|
||||
APIVersion defines the versioned schema of this representation of an object.
|
||||
Servers should convert recognized schemas to the latest internal value, and
|
||||
may reject unrecognized values.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
type: string
|
||||
kind:
|
||||
description: |-
|
||||
Kind is a string value representing the REST resource this object represents.
|
||||
Servers may infer this from the endpoint the client submits requests to.
|
||||
Cannot be updated.
|
||||
In CamelCase.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: Spec defines the desired state of TCPRoute.
|
||||
properties:
|
||||
parentRefs:
|
||||
description: |-
|
||||
ParentRefs references the resources (usually Gateways) that a Route wants
|
||||
to be attached to. Note that the referenced parent resource needs to
|
||||
allow this for the attachment to be complete. For Gateways, that means
|
||||
the Gateway needs to allow attachment from Routes of this kind and
|
||||
namespace. For Services, that means the Service must either be in the same
|
||||
namespace for a "producer" route, or the mesh implementation must support
|
||||
and allow "consumer" routes for the referenced Service. ReferenceGrant is
|
||||
not applicable for governing ParentRefs to Services - it is not possible to
|
||||
create a "producer" route for a Service in a different namespace from the
|
||||
Route.
|
||||
|
||||
There are two kinds of parent resources with "Core" support:
|
||||
|
||||
* Gateway (Gateway conformance profile)
|
||||
* Service (Mesh conformance profile, ClusterIP Services only)
|
||||
|
||||
This API may be extended in the future to support additional kinds of parent
|
||||
resources.
|
||||
|
||||
ParentRefs must be _distinct_. This means either that:
|
||||
|
||||
* They select different objects. If this is the case, then parentRef
|
||||
entries are distinct. In terms of fields, this means that the
|
||||
multi-part key defined by `group`, `kind`, `namespace`, and `name` must
|
||||
be unique across all parentRef entries in the Route.
|
||||
* They do not select different objects, but for each optional field used,
|
||||
each ParentRef that selects the same object must set the same set of
|
||||
optional fields to different values. If one ParentRef sets a
|
||||
combination of optional fields, all must set the same combination.
|
||||
|
||||
Some examples:
|
||||
|
||||
* If one ParentRef sets `sectionName`, all ParentRefs referencing the
|
||||
same object must also set `sectionName`.
|
||||
* If one ParentRef sets `port`, all ParentRefs referencing the same
|
||||
object must also set `port`.
|
||||
* If one ParentRef sets `sectionName` and `port`, all ParentRefs
|
||||
referencing the same object must also set `sectionName` and `port`.
|
||||
|
||||
It is possible to separately reference multiple distinct objects that may
|
||||
be collapsed by an implementation. For example, some implementations may
|
||||
choose to merge compatible Gateway Listeners together. If that is the
|
||||
case, the list of routes attached to those resources should also be
|
||||
merged.
|
||||
|
||||
Note that for ParentRefs that cross namespace boundaries, there are specific
|
||||
rules. Cross-namespace references are only valid if they are explicitly
|
||||
allowed by something in the namespace they are referring to. For example,
|
||||
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
|
||||
generic way to enable other kinds of cross-namespace reference.
|
||||
|
||||
|
||||
ParentRefs from a Route to a Service in the same namespace are "producer"
|
||||
routes, which apply default routing rules to inbound connections from
|
||||
any namespace to the Service.
|
||||
|
||||
ParentRefs from a Route to a Service in a different namespace are
|
||||
"consumer" routes, and these routing rules are only applied to outbound
|
||||
connections originating from the same namespace as the Route, for which
|
||||
the intended destination of the connections are a Service targeted as a
|
||||
ParentRef of the Route.
|
||||
items:
|
||||
description: |-
|
||||
ParentReference identifies an API object (usually a Gateway) that can be considered
|
||||
a parent of this resource (usually a route). There are two kinds of parent resources
|
||||
with "Core" support:
|
||||
|
||||
* Gateway (Gateway conformance profile)
|
||||
* Service (Mesh conformance profile, ClusterIP Services only)
|
||||
|
||||
This API may be extended in the future to support additional kinds of parent
|
||||
resources.
|
||||
|
||||
The API object must be valid in the cluster; the Group and Kind must
|
||||
be registered in the cluster for this reference to be valid.
|
||||
properties:
|
||||
group:
|
||||
default: gateway.networking.k8s.io
|
||||
description: |-
|
||||
Group is the group of the referent.
|
||||
When unspecified, "gateway.networking.k8s.io" is inferred.
|
||||
To set the core API group (such as for a "Service" kind referent),
|
||||
Group must be explicitly set to "" (empty string).
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
default: Gateway
|
||||
description: |-
|
||||
Kind is kind of the referent.
|
||||
|
||||
There are two kinds of parent resources with "Core" support:
|
||||
|
||||
* Gateway (Gateway conformance profile)
|
||||
* Service (Mesh conformance profile, ClusterIP Services only)
|
||||
|
||||
Support for other resources is Implementation-Specific.
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
name:
|
||||
description: |-
|
||||
Name is the name of the referent.
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
namespace:
|
||||
description: |-
|
||||
Namespace is the namespace of the referent. When unspecified, this refers
|
||||
to the local namespace of the Route.
|
||||
|
||||
Note that there are specific rules for ParentRefs which cross namespace
|
||||
boundaries. Cross-namespace references are only valid if they are explicitly
|
||||
allowed by something in the namespace they are referring to. For example:
|
||||
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
|
||||
generic way to enable any other kind of cross-namespace reference.
|
||||
|
||||
|
||||
ParentRefs from a Route to a Service in the same namespace are "producer"
|
||||
routes, which apply default routing rules to inbound connections from
|
||||
any namespace to the Service.
|
||||
|
||||
ParentRefs from a Route to a Service in a different namespace are
|
||||
"consumer" routes, and these routing rules are only applied to outbound
|
||||
connections originating from the same namespace as the Route, for which
|
||||
the intended destination of the connections are a Service targeted as a
|
||||
ParentRef of the Route.
|
||||
|
||||
|
||||
Support: Core
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
type: string
|
||||
port:
|
||||
description: |-
|
||||
Port is the network port this Route targets. It can be interpreted
|
||||
differently based on the type of parent resource.
|
||||
|
||||
When the parent resource is a Gateway, this targets all listeners
|
||||
listening on the specified port that also support this kind of Route(and
|
||||
select this Route). It's not recommended to set `Port` unless the
|
||||
networking behaviors specified in a Route must apply to a specific port
|
||||
as opposed to a listener(s) whose port(s) may be changed. When both Port
|
||||
and SectionName are specified, the name and port of the selected listener
|
||||
must match both specified values.
|
||||
|
||||
|
||||
When the parent resource is a Service, this targets a specific port in the
|
||||
Service spec. When both Port (experimental) and SectionName are specified,
|
||||
the name and port of the selected port must match both specified values.
|
||||
|
||||
|
||||
Implementations MAY choose to support other parent resources.
|
||||
Implementations supporting other types of parent resources MUST clearly
|
||||
document how/if Port is interpreted.
|
||||
|
||||
For the purpose of status, an attachment is considered successful as
|
||||
long as the parent resource accepts it partially. For example, Gateway
|
||||
listeners can restrict which Routes can attach to them by Route kind,
|
||||
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
|
||||
from the referencing Route, the Route MUST be considered successfully
|
||||
attached. If no Gateway listeners accept attachment from this Route,
|
||||
the Route MUST be considered detached from the Gateway.
|
||||
|
||||
Support: Extended
|
||||
format: int32
|
||||
maximum: 65535
|
||||
minimum: 1
|
||||
type: integer
|
||||
sectionName:
|
||||
description: |-
|
||||
SectionName is the name of a section within the target resource. In the
|
||||
following resources, SectionName is interpreted as the following:
|
||||
|
||||
* Gateway: Listener name. When both Port (experimental) and SectionName
|
||||
are specified, the name and port of the selected listener must match
|
||||
both specified values.
|
||||
* Service: Port name. When both Port (experimental) and SectionName
|
||||
are specified, the name and port of the selected listener must match
|
||||
both specified values.
|
||||
|
||||
Implementations MAY choose to support attaching Routes to other resources.
|
||||
If that is the case, they MUST clearly document how SectionName is
|
||||
interpreted.
|
||||
|
||||
When unspecified (empty string), this will reference the entire resource.
|
||||
For the purpose of status, an attachment is considered successful if at
|
||||
least one section in the parent resource accepts it. For example, Gateway
|
||||
listeners can restrict which Routes can attach to them by Route kind,
|
||||
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
|
||||
the referencing Route, the Route MUST be considered successfully
|
||||
attached. If no Gateway listeners accept attachment from this Route, the
|
||||
Route MUST be considered detached from the Gateway.
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
maxItems: 32
|
||||
type: array
|
||||
x-kubernetes-validations:
|
||||
- message: sectionName or port must be specified when parentRefs includes
|
||||
2 or more references to the same parent
|
||||
rule: 'self.all(p1, self.all(p2, p1.group == p2.group && p1.kind
|
||||
== p2.kind && p1.name == p2.name && (((!has(p1.__namespace__)
|
||||
|| p1.__namespace__ == '''') && (!has(p2.__namespace__) || p2.__namespace__
|
||||
== '''')) || (has(p1.__namespace__) && has(p2.__namespace__) &&
|
||||
p1.__namespace__ == p2.__namespace__)) ? ((!has(p1.sectionName)
|
||||
|| p1.sectionName == '''') == (!has(p2.sectionName) || p2.sectionName
|
||||
== '''') && (!has(p1.port) || p1.port == 0) == (!has(p2.port)
|
||||
|| p2.port == 0)): true))'
|
||||
- message: sectionName or port must be unique when parentRefs includes
|
||||
2 or more references to the same parent
|
||||
rule: self.all(p1, self.exists_one(p2, p1.group == p2.group && p1.kind
|
||||
== p2.kind && p1.name == p2.name && (((!has(p1.__namespace__)
|
||||
|| p1.__namespace__ == '') && (!has(p2.__namespace__) || p2.__namespace__
|
||||
== '')) || (has(p1.__namespace__) && has(p2.__namespace__) &&
|
||||
p1.__namespace__ == p2.__namespace__ )) && (((!has(p1.sectionName)
|
||||
|| p1.sectionName == '') && (!has(p2.sectionName) || p2.sectionName
|
||||
== '')) || ( has(p1.sectionName) && has(p2.sectionName) && p1.sectionName
|
||||
== p2.sectionName)) && (((!has(p1.port) || p1.port == 0) && (!has(p2.port)
|
||||
|| p2.port == 0)) || (has(p1.port) && has(p2.port) && p1.port
|
||||
== p2.port))))
|
||||
rules:
|
||||
description: Rules are a list of TCP matchers and actions.
|
||||
items:
|
||||
description: TCPRouteRule is the configuration for a given rule.
|
||||
properties:
|
||||
backendRefs:
|
||||
description: |-
|
||||
BackendRefs defines the backend(s) where matching requests should be
|
||||
sent. If unspecified or invalid (refers to a nonexistent resource or a
|
||||
Service with no endpoints), the underlying implementation MUST actively
|
||||
reject connection attempts to this backend. Connection rejections must
|
||||
respect weight; if an invalid backend is requested to have 80% of
|
||||
connections, then 80% of connections must be rejected instead.
|
||||
|
||||
Support: Core for Kubernetes Service
|
||||
|
||||
Support: Extended for Kubernetes ServiceImport
|
||||
|
||||
Support: Implementation-specific for any other resource
|
||||
|
||||
Support for weight: Extended
|
||||
items:
|
||||
description: |-
|
||||
BackendRef defines how a Route should forward a request to a Kubernetes
|
||||
resource.
|
||||
|
||||
Note that when a namespace different than the local namespace is specified, a
|
||||
ReferenceGrant object is required in the referent namespace to allow that
|
||||
namespace's owner to accept the reference. See the ReferenceGrant
|
||||
documentation for details.
|
||||
|
||||
|
||||
When the BackendRef points to a Kubernetes Service, implementations SHOULD
|
||||
honor the appProtocol field if it is set for the target Service Port.
|
||||
|
||||
Implementations supporting appProtocol SHOULD recognize the Kubernetes
|
||||
Standard Application Protocols defined in KEP-3726.
|
||||
|
||||
If a Service appProtocol isn't specified, an implementation MAY infer the
|
||||
backend protocol through its own means. Implementations MAY infer the
|
||||
protocol from the Route type referring to the backend Service.
|
||||
|
||||
If a Route is not able to send traffic to the backend using the specified
|
||||
protocol then the backend is considered invalid. Implementations MUST set the
|
||||
"ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason.
|
||||
|
||||
|
||||
Note that when the BackendTLSPolicy object is enabled by the implementation,
|
||||
there are some extra rules about validity to consider here. See the fields
|
||||
where this struct is used for more information about the exact behavior.
|
||||
properties:
|
||||
group:
|
||||
default: ""
|
||||
description: |-
|
||||
Group is the group of the referent. For example, "gateway.networking.k8s.io".
|
||||
When unspecified or empty string, core API group is inferred.
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
default: Service
|
||||
description: |-
|
||||
Kind is the Kubernetes resource kind of the referent. For example
|
||||
"Service".
|
||||
|
||||
Defaults to "Service" when not specified.
|
||||
|
||||
ExternalName services can refer to CNAME DNS records that may live
|
||||
outside of the cluster and as such are difficult to reason about in
|
||||
terms of conformance. They also may not be safe to forward to (see
|
||||
CVE-2021-25740 for more information). Implementations SHOULD NOT
|
||||
support ExternalName Services.
|
||||
|
||||
Support: Core (Services with a type other than ExternalName)
|
||||
|
||||
Support: Implementation-specific (Services with type ExternalName)
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
name:
|
||||
description: Name is the name of the referent.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
namespace:
|
||||
description: |-
|
||||
Namespace is the namespace of the backend. When unspecified, the local
|
||||
namespace is inferred.
|
||||
|
||||
Note that when a namespace different than the local namespace is specified,
|
||||
a ReferenceGrant object is required in the referent namespace to allow that
|
||||
namespace's owner to accept the reference. See the ReferenceGrant
|
||||
documentation for details.
|
||||
|
||||
Support: Core
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
type: string
|
||||
port:
|
||||
description: |-
|
||||
Port specifies the destination port number to use for this resource.
|
||||
Port is required when the referent is a Kubernetes Service. In this
|
||||
case, the port number is the service port number, not the target port.
|
||||
For other resources, destination port might be derived from the referent
|
||||
resource or this field.
|
||||
format: int32
|
||||
maximum: 65535
|
||||
minimum: 1
|
||||
type: integer
|
||||
weight:
|
||||
default: 1
|
||||
description: |-
|
||||
Weight specifies the proportion of requests forwarded to the referenced
|
||||
backend. This is computed as weight/(sum of all weights in this
|
||||
BackendRefs list). For non-zero values, there may be some epsilon from
|
||||
the exact proportion defined here depending on the precision an
|
||||
implementation supports. Weight is not a percentage and the sum of
|
||||
weights does not need to equal 100.
|
||||
|
||||
If only one backend is specified and it has a weight greater than 0, 100%
|
||||
of the traffic is forwarded to that backend. If weight is set to 0, no
|
||||
traffic should be forwarded for this entry. If unspecified, weight
|
||||
defaults to 1.
|
||||
|
||||
Support for this field varies based on the context where used.
|
||||
format: int32
|
||||
maximum: 1000000
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: Must have port for Service reference
|
||||
rule: '(size(self.group) == 0 && self.kind == ''Service'')
|
||||
? has(self.port) : true'
|
||||
maxItems: 16
|
||||
minItems: 1
|
||||
type: array
|
||||
name:
|
||||
description: |-
|
||||
Name is the name of the route rule. This name MUST be unique within a Route if it is set.
|
||||
|
||||
Support: Extended
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
type: object
|
||||
maxItems: 16
|
||||
minItems: 1
|
||||
type: array
|
||||
x-kubernetes-validations:
|
||||
- message: Rule name must be unique within the route
|
||||
rule: self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name)
|
||||
&& l1.name == l2.name))
|
||||
required:
|
||||
- rules
|
||||
type: object
|
||||
status:
|
||||
description: Status defines the current state of TCPRoute.
|
||||
properties:
|
||||
parents:
|
||||
description: |-
|
||||
Parents is a list of parent resources (usually Gateways) that are
|
||||
associated with the route, and the status of the route with respect to
|
||||
each parent. When this route attaches to a parent, the controller that
|
||||
manages the parent must add an entry to this list when the controller
|
||||
first sees the route and should update the entry as appropriate when the
|
||||
route or gateway is modified.
|
||||
|
||||
Note that parent references that cannot be resolved by an implementation
|
||||
of this API will not be added to this list. Implementations of this API
|
||||
can only populate Route status for the Gateways/parent resources they are
|
||||
responsible for.
|
||||
|
||||
A maximum of 32 Gateways will be represented in this list. An empty list
|
||||
means the route has not been attached to any Gateway.
|
||||
items:
|
||||
description: |-
|
||||
RouteParentStatus describes the status of a route with respect to an
|
||||
associated Parent.
|
||||
properties:
|
||||
conditions:
|
||||
description: |-
|
||||
Conditions describes the status of the route with respect to the Gateway.
|
||||
Note that the route's availability is also subject to the Gateway's own
|
||||
status conditions and listener status.
|
||||
|
||||
If the Route's ParentRef specifies an existing Gateway that supports
|
||||
Routes of this kind AND that Gateway's controller has sufficient access,
|
||||
then that Gateway's controller MUST set the "Accepted" condition on the
|
||||
Route, to indicate whether the route has been accepted or rejected by the
|
||||
Gateway, and why.
|
||||
|
||||
A Route MUST be considered "Accepted" if at least one of the Route's
|
||||
rules is implemented by the Gateway.
|
||||
|
||||
There are a number of cases where the "Accepted" condition may not be set
|
||||
due to lack of controller visibility, that includes when:
|
||||
|
||||
* The Route refers to a nonexistent parent.
|
||||
* The Route is of a type that the controller does not support.
|
||||
* The Route is in a namespace the controller does not have access to.
|
||||
items:
|
||||
description: Condition contains details for one aspect of
|
||||
the current state of this API Resource.
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: |-
|
||||
lastTransitionTime is the last time the condition transitioned from one status to another.
|
||||
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: |-
|
||||
message is a human readable message indicating details about the transition.
|
||||
This may be an empty string.
|
||||
maxLength: 32768
|
||||
type: string
|
||||
observedGeneration:
|
||||
description: |-
|
||||
observedGeneration represents the .metadata.generation that the condition was set based upon.
|
||||
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
|
||||
with respect to the current state of the instance.
|
||||
format: int64
|
||||
minimum: 0
|
||||
type: integer
|
||||
reason:
|
||||
description: |-
|
||||
reason contains a programmatic identifier indicating the reason for the condition's last transition.
|
||||
Producers of specific condition types may define expected values and meanings for this field,
|
||||
and whether the values are considered a guaranteed API.
|
||||
The value should be a CamelCase string.
|
||||
This field may not be empty.
|
||||
maxLength: 1024
|
||||
minLength: 1
|
||||
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||
type: string
|
||||
status:
|
||||
description: status of the condition, one of True, False,
|
||||
Unknown.
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
type: string
|
||||
type:
|
||||
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
maxLength: 316
|
||||
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||
type: string
|
||||
required:
|
||||
- lastTransitionTime
|
||||
- message
|
||||
- reason
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
maxItems: 8
|
||||
minItems: 1
|
||||
type: array
|
||||
x-kubernetes-list-map-keys:
|
||||
- type
|
||||
x-kubernetes-list-type: map
|
||||
controllerName:
|
||||
description: |-
|
||||
ControllerName is a domain/path string that indicates the name of the
|
||||
controller that wrote this status. This corresponds with the
|
||||
controllerName field on GatewayClass.
|
||||
|
||||
Example: "example.net/gateway-controller".
|
||||
|
||||
The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
|
||||
valid Kubernetes names
|
||||
(https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
|
||||
|
||||
Controllers MUST populate this field when writing status. Controllers should ensure that
|
||||
entries to status populated with their ControllerName are cleaned up when they are no
|
||||
longer necessary.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$
|
||||
type: string
|
||||
parentRef:
|
||||
description: |-
|
||||
ParentRef corresponds with a ParentRef in the spec that this
|
||||
RouteParentStatus struct describes the status of.
|
||||
properties:
|
||||
group:
|
||||
default: gateway.networking.k8s.io
|
||||
description: |-
|
||||
Group is the group of the referent.
|
||||
When unspecified, "gateway.networking.k8s.io" is inferred.
|
||||
To set the core API group (such as for a "Service" kind referent),
|
||||
Group must be explicitly set to "" (empty string).
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
default: Gateway
|
||||
description: |-
|
||||
Kind is kind of the referent.
|
||||
|
||||
There are two kinds of parent resources with "Core" support:
|
||||
|
||||
* Gateway (Gateway conformance profile)
|
||||
* Service (Mesh conformance profile, ClusterIP Services only)
|
||||
|
||||
Support for other resources is Implementation-Specific.
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
name:
|
||||
description: |-
|
||||
Name is the name of the referent.
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
namespace:
|
||||
description: |-
|
||||
Namespace is the namespace of the referent. When unspecified, this refers
|
||||
to the local namespace of the Route.
|
||||
|
||||
Note that there are specific rules for ParentRefs which cross namespace
|
||||
boundaries. Cross-namespace references are only valid if they are explicitly
|
||||
allowed by something in the namespace they are referring to. For example:
|
||||
Gateway has the AllowedRoutes field, and ReferenceGrant provides a
|
||||
generic way to enable any other kind of cross-namespace reference.
|
||||
|
||||
|
||||
ParentRefs from a Route to a Service in the same namespace are "producer"
|
||||
routes, which apply default routing rules to inbound connections from
|
||||
any namespace to the Service.
|
||||
|
||||
ParentRefs from a Route to a Service in a different namespace are
|
||||
"consumer" routes, and these routing rules are only applied to outbound
|
||||
connections originating from the same namespace as the Route, for which
|
||||
the intended destination of the connections are a Service targeted as a
|
||||
ParentRef of the Route.
|
||||
|
||||
|
||||
Support: Core
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
type: string
|
||||
port:
|
||||
description: |-
|
||||
Port is the network port this Route targets. It can be interpreted
|
||||
differently based on the type of parent resource.
|
||||
|
||||
When the parent resource is a Gateway, this targets all listeners
|
||||
listening on the specified port that also support this kind of Route(and
|
||||
select this Route). It's not recommended to set `Port` unless the
|
||||
networking behaviors specified in a Route must apply to a specific port
|
||||
as opposed to a listener(s) whose port(s) may be changed. When both Port
|
||||
and SectionName are specified, the name and port of the selected listener
|
||||
must match both specified values.
|
||||
|
||||
|
||||
When the parent resource is a Service, this targets a specific port in the
|
||||
Service spec. When both Port (experimental) and SectionName are specified,
|
||||
the name and port of the selected port must match both specified values.
|
||||
|
||||
|
||||
Implementations MAY choose to support other parent resources.
|
||||
Implementations supporting other types of parent resources MUST clearly
|
||||
document how/if Port is interpreted.
|
||||
|
||||
For the purpose of status, an attachment is considered successful as
|
||||
long as the parent resource accepts it partially. For example, Gateway
|
||||
listeners can restrict which Routes can attach to them by Route kind,
|
||||
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
|
||||
from the referencing Route, the Route MUST be considered successfully
|
||||
attached. If no Gateway listeners accept attachment from this Route,
|
||||
the Route MUST be considered detached from the Gateway.
|
||||
|
||||
Support: Extended
|
||||
format: int32
|
||||
maximum: 65535
|
||||
minimum: 1
|
||||
type: integer
|
||||
sectionName:
|
||||
description: |-
|
||||
SectionName is the name of a section within the target resource. In the
|
||||
following resources, SectionName is interpreted as the following:
|
||||
|
||||
* Gateway: Listener name. When both Port (experimental) and SectionName
|
||||
are specified, the name and port of the selected listener must match
|
||||
both specified values.
|
||||
* Service: Port name. When both Port (experimental) and SectionName
|
||||
are specified, the name and port of the selected listener must match
|
||||
both specified values.
|
||||
|
||||
Implementations MAY choose to support attaching Routes to other resources.
|
||||
If that is the case, they MUST clearly document how SectionName is
|
||||
interpreted.
|
||||
|
||||
When unspecified (empty string), this will reference the entire resource.
|
||||
For the purpose of status, an attachment is considered successful if at
|
||||
least one section in the parent resource accepts it. For example, Gateway
|
||||
listeners can restrict which Routes can attach to them by Route kind,
|
||||
namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
|
||||
the referencing Route, the Route MUST be considered successfully
|
||||
attached. If no Gateway listeners accept attachment from this Route, the
|
||||
Route MUST be considered detached from the Gateway.
|
||||
|
||||
Support: Core
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
required:
|
||||
- controllerName
|
||||
- parentRef
|
||||
type: object
|
||||
maxItems: 32
|
||||
type: array
|
||||
required:
|
||||
- parents
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: null
|
||||
storedVersions: null
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user