Compare commits
2 Commits
main
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b562b11802 | ||
|
|
959bf99c49 |
8
.gitattributes
vendored
8
.gitattributes
vendored
@ -1,5 +1,3 @@
|
||||
controller/api/applyconfiguration/** linguist-generated=true
|
||||
controller/pkg/client/** linguist-generated=true
|
||||
controller/pkg/generated/** linguist-generated=true
|
||||
crates/agentgateway/src/llm/tests/** text eol=lf
|
||||
crates/agentgateway/src/llm/tests/**/*.bin -text
|
||||
api/applyconfiguration/** linguist-generated=true
|
||||
pkg/client/** linguist-generated=true
|
||||
pkg/generated/** linguist-generated=true
|
||||
|
||||
83
.github/dependabot.yml
vendored
83
.github/dependabot.yml
vendored
@ -1,83 +0,0 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
time: "05:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
groups:
|
||||
cargo-weekly:
|
||||
patterns:
|
||||
- "*"
|
||||
ignore:
|
||||
- dependency-name: "nom"
|
||||
- dependency-name: "criterion"
|
||||
open-pull-requests-limit: 1
|
||||
|
||||
# Disable regular version updates while still allowing Dependabot security PRs.
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/api"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/tools"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/ui"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/controller/hack/testbox"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "uv"
|
||||
directory: "/examples/a2a/strands-agents"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "09:00"
|
||||
timezone: "America/Los_Angeles"
|
||||
open-pull-requests-limit: 0
|
||||
4
.github/workflows/debug_cache.yml
vendored
4
.github/workflows/debug_cache.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Restore cache
|
||||
uses: Andrej730/cache/restore@e294f7d180f76c94062d0251c60fe7362ce6667d
|
||||
@ -28,7 +28,7 @@ jobs:
|
||||
key: ${{ github.event.inputs.cache_key }}
|
||||
|
||||
- name: Upload cached folder as artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: cache-artifact
|
||||
path: |
|
||||
|
||||
56
.github/workflows/nightly.yml
vendored
56
.github/workflows/nightly.yml
vendored
@ -1,56 +0,0 @@
|
||||
name: Nightly Release
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
if: github.repository == 'agentgateway/agentgateway'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
has_commits: ${{ steps.check.outputs.has_commits }}
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Check for commits in the last 24 hours
|
||||
id: check
|
||||
run: |
|
||||
LAST_COMMIT=$(git log -1 --format="%ct")
|
||||
NOW=$(date +%s)
|
||||
DIFF=$((NOW - LAST_COMMIT))
|
||||
# 86400 = seconds in one day
|
||||
if [ "$DIFF" -lt 86400 ]; then
|
||||
echo "has_commits=true" >> $GITHUB_OUTPUT
|
||||
echo "Recent commit found (${DIFF}s ago)"
|
||||
else
|
||||
echo "has_commits=false" >> $GITHUB_OUTPUT
|
||||
echo "No recent commits (last commit was ${DIFF}s ago), skipping nightly release"
|
||||
fi
|
||||
|
||||
- name: Compute nightly version
|
||||
id: version
|
||||
run: |
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo "version=0.0.0-alpha.${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||
echo "Nightly version: 0.0.0-alpha.${SHORT_SHA}"
|
||||
|
||||
release:
|
||||
needs: prepare
|
||||
if: ${{ needs.prepare.outputs.has_commits == 'true' || github.event_name == 'workflow_dispatch' }}
|
||||
uses: ./.github/workflows/release.yml
|
||||
with:
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
extra_tag: latest-dev
|
||||
# Helm is special and requires a semver.
|
||||
extra_helm_tag: 0.0.0-latest-dev
|
||||
secrets: inherit
|
||||
86
.github/workflows/pull_request.yml
vendored
86
.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.2"
|
||||
GO_VERSION: "1.26.1"
|
||||
|
||||
jobs:
|
||||
#### Proxy jobs ####
|
||||
@ -24,48 +24,42 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: blacksmith-4vcpu-ubuntu-2404
|
||||
name: "Proxy Test"
|
||||
- os: ubuntu-24.04
|
||||
validate: true
|
||||
- os: windows-2025
|
||||
name: "Proxy Test (Windows)"
|
||||
validate: false
|
||||
- os: macos-15
|
||||
name: "Proxy Test (Mac)"
|
||||
validate: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
# Github cache is too tiny to handle the full matrix :-(
|
||||
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
with:
|
||||
# Github cache will restore from 'main' OR the current branch.
|
||||
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
|
||||
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Start validation dependencies
|
||||
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
|
||||
run: tools/manage-validation-deps.sh start
|
||||
- name: Test
|
||||
run: make test
|
||||
env:
|
||||
KEYCLOAK_AVAILABLE: ${{ startsWith(matrix.os, 'blacksmith-') && '1' || '' }}
|
||||
- name: Stop validation dependencies
|
||||
if: ${{ always() && startsWith(matrix.os, 'blacksmith-') }}
|
||||
run: tools/manage-validation-deps.sh stop
|
||||
- name: Validate
|
||||
if: ${{ matrix.validate }}
|
||||
run: make validate
|
||||
|
||||
proxy-lint:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# Github cache will restore from 'main' OR the current branch.
|
||||
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
|
||||
@ -83,8 +77,8 @@ jobs:
|
||||
run:
|
||||
working-directory: ui
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
- name: Lint
|
||||
@ -94,10 +88,10 @@ jobs:
|
||||
|
||||
#### Controller jobs ####
|
||||
controller-test:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
@ -107,10 +101,10 @@ jobs:
|
||||
run: go test -race ./...
|
||||
|
||||
controller-lint:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
@ -127,26 +121,20 @@ jobs:
|
||||
run: make generate-apis check-clean-repo
|
||||
|
||||
controller-e2e:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Check Runner Info
|
||||
run: |
|
||||
cat /sys/fs/cgroup/cpu.stat || true
|
||||
cat /proc/pressure/cpu || true
|
||||
lscpu || true
|
||||
openssl speed -seconds 1 -bytes 256 sha256 || rtue
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# Github cache will restore from 'main' OR the current branch.
|
||||
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
|
||||
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
@ -162,13 +150,13 @@ jobs:
|
||||
CGO_ENABLED=0 PERSIST_INSTALL=true go test -tags=e2e -v ./controller/test/e2e/tests -run '^TestAgentgatewayIntegration'
|
||||
- name: Archive bug report directory on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: bug-report
|
||||
path: ./controller/_test/bug_report/kind
|
||||
retention-days: 2
|
||||
- name: Upload cargo timings
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: cargo-timings-e2e
|
||||
path: target/cargo-timings/cargo-timing*.html
|
||||
@ -179,19 +167,19 @@ jobs:
|
||||
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
controller-conformance:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# We only read the cache from 'E2E' job, since they should have identical cache.
|
||||
save-if: "false"
|
||||
shared-key: "controller-e2e" # Pull E2E job's cache
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
@ -212,7 +200,7 @@ jobs:
|
||||
kubectl get pods -n agentgateway-system
|
||||
kubectl logs -n agentgateway-system -l app.kubernetes.io/name=agentgateway
|
||||
- name: Upload cargo timings
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: cargo-timings-conformance
|
||||
path: target/cargo-timings/cargo-timing*.html
|
||||
|
||||
165
.github/workflows/release.yml
vendored
165
.github/workflows/release.yml
vendored
@ -13,33 +13,12 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
extra_helm_tag:
|
||||
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version number (without v prefix)'
|
||||
required: true
|
||||
type: string
|
||||
extra_tag:
|
||||
description: 'Additional Docker image tag to push (e.g. latest-dev)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
extra_helm_tag:
|
||||
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CI: true
|
||||
RUST_VERSION: "1.93.1"
|
||||
GO_VERSION: "1.26.2"
|
||||
GO_VERSION: "1.26.1"
|
||||
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/agentgateway
|
||||
CONTROLLER_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/controller
|
||||
# Note: /charts is added to this
|
||||
@ -58,8 +37,8 @@ jobs:
|
||||
id: version
|
||||
run: |
|
||||
# Determine version source
|
||||
if [ -n "${{ inputs.version }}" ]; then
|
||||
VERSION="${{ inputs.version }}"
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
else
|
||||
VERSION="${{ github.ref_name }}"
|
||||
fi
|
||||
@ -80,9 +59,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os: blacksmith-4vcpu-ubuntu-2404
|
||||
os: ubuntu-24.04
|
||||
- platform: linux/arm64
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
os: ubuntu-24.04-arm
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
@ -93,23 +72,23 @@ jobs:
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
build-args: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
@ -128,7 +107,7 @@ jobs:
|
||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: digests-${{ env.PLATFORM_PAIR }}
|
||||
path: ${{ runner.temp }}/digests/*
|
||||
@ -148,33 +127,32 @@ jobs:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
|
||||
uses: sigstore/cosign-installer@v3
|
||||
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests
|
||||
pattern: digests-linux-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=raw,value=v${{ env.VERSION }}
|
||||
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: ${{ runner.temp }}/digests
|
||||
@ -185,10 +163,6 @@ jobs:
|
||||
- name: Sign the container image
|
||||
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
|
||||
|
||||
- name: Sign the extra tag
|
||||
if: ${{ inputs.extra_tag != '' }}
|
||||
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
|
||||
|
||||
- name: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
|
||||
@ -205,9 +179,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os: blacksmith-4vcpu-ubuntu-2404
|
||||
os: ubuntu-24.04
|
||||
- platform: linux/arm64
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
os: ubuntu-24.04-arm
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
@ -218,24 +192,24 @@ jobs:
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}-musl
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@ -255,7 +229,7 @@ jobs:
|
||||
touch "${{ runner.temp }}/digests-musl/${digest#sha256:}"
|
||||
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: digests-musl-${{ env.PLATFORM_PAIR }}
|
||||
path: ${{ runner.temp }}/digests-musl/*
|
||||
@ -275,33 +249,32 @@ jobs:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
|
||||
uses: sigstore/cosign-installer@v3
|
||||
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests-musl
|
||||
pattern: digests-musl*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=raw,value=v${{ env.VERSION }}
|
||||
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: ${{ runner.temp }}/digests-musl
|
||||
@ -312,10 +285,6 @@ jobs:
|
||||
- name: Sign the container image
|
||||
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
|
||||
|
||||
- name: Sign the extra tag
|
||||
if: ${{ inputs.extra_tag != '' }}
|
||||
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}-musl
|
||||
|
||||
- name: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
|
||||
@ -335,7 +304,7 @@ jobs:
|
||||
os: ubuntu-24.04
|
||||
goarch: amd64
|
||||
- platform: linux/arm64
|
||||
os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
os: ubuntu-24.04-arm
|
||||
goarch: arm64
|
||||
defaults:
|
||||
run:
|
||||
@ -349,17 +318,17 @@ jobs:
|
||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||
working-directory: .
|
||||
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
@ -377,16 +346,16 @@ jobs:
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: controller/_output/pkg/agentgateway
|
||||
file: controller/_output/pkg/agentgateway/Dockerfile.agentgateway
|
||||
@ -406,7 +375,7 @@ jobs:
|
||||
touch "${{ runner.temp }}/controller-digests/${digest#sha256:}"
|
||||
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: controller-digests-${{ env.PLATFORM_PAIR }}
|
||||
path: ${{ runner.temp }}/controller-digests/*
|
||||
@ -426,10 +395,10 @@ jobs:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
|
||||
uses: sigstore/cosign-installer@v3
|
||||
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/controller-digests
|
||||
pattern: controller-digests-*
|
||||
@ -443,23 +412,22 @@ jobs:
|
||||
find . -type f
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=raw,value=v${{ env.VERSION }}
|
||||
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: ${{ runner.temp }}/controller-digests
|
||||
@ -470,10 +438,6 @@ jobs:
|
||||
- name: Sign the container image
|
||||
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
|
||||
|
||||
- name: Sign the extra tag
|
||||
if: ${{ inputs.extra_tag != '' }}
|
||||
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
|
||||
|
||||
- name: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
|
||||
@ -490,7 +454,7 @@ jobs:
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Helm login to ${{ env.CHART_REGISTRY_IMAGE_BASE }}
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | ./tools/helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
@ -499,46 +463,39 @@ 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) }}
|
||||
if: ${{ github.event_name == 'push' || ! github.event.inputs.skip_gh_release }}
|
||||
needs:
|
||||
- setup
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: blacksmith-4vcpu-ubuntu-2404
|
||||
- os: ubuntu-24.04
|
||||
target: x86_64-unknown-linux-musl
|
||||
# Performance is horrendous on musl without jemalloc
|
||||
features: jemalloc
|
||||
name: linux
|
||||
- os: blacksmith-4vcpu-ubuntu-2404-arm
|
||||
- os: ubuntu-24.04-arm
|
||||
target: aarch64-unknown-linux-musl
|
||||
# TODO: arm64 build fails with jemalloc for some reason? https://github.com/tikv/jemallocator/issues/146
|
||||
features: default
|
||||
name: linux-arm
|
||||
- os: macos-26
|
||||
target: aarch64-apple-darwin
|
||||
features: default
|
||||
name: mac
|
||||
- os: windows-2025
|
||||
target: x86_64-pc-windows-msvc
|
||||
features: default
|
||||
name: windows
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
targets: ${{ matrix.target }}
|
||||
@ -548,8 +505,8 @@ jobs:
|
||||
cd ui
|
||||
npm install
|
||||
npm run build
|
||||
- name: Prepare Linux target
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' }}
|
||||
- name: Install musl-tools
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y musl-tools
|
||||
@ -562,15 +519,15 @@ jobs:
|
||||
run: |
|
||||
git status
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: release-binary-${{ matrix.name }}
|
||||
name: release-binary-${{ matrix.os }}
|
||||
path: |
|
||||
target/${{ matrix.target }}/release/agentgateway
|
||||
target/${{ matrix.target }}/release/agentgateway.exe
|
||||
|
||||
release:
|
||||
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
|
||||
if: ${{ github.event_name == 'push' || ! github.event.inputs.skip_gh_release }}
|
||||
needs:
|
||||
- setup
|
||||
- push-image
|
||||
@ -578,14 +535,14 @@ jobs:
|
||||
- push-controller-image
|
||||
- push-helm-charts
|
||||
- build
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
VERSION: ${{ needs.setup.outputs.version }}
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: release-binary-*
|
||||
|
||||
@ -593,16 +550,16 @@ jobs:
|
||||
run: |
|
||||
ls -R
|
||||
mkdir outputs
|
||||
mv release-binary-mac/agentgateway outputs/agentgateway-darwin-arm64
|
||||
mv release-binary-macos-26/agentgateway outputs/agentgateway-darwin-arm64
|
||||
sha256sum outputs/agentgateway-darwin-arm64 > outputs/agentgateway-darwin-arm64.sha256
|
||||
mv release-binary-linux/agentgateway outputs/agentgateway-linux-amd64
|
||||
mv release-binary-ubuntu-24.04/agentgateway outputs/agentgateway-linux-amd64
|
||||
sha256sum outputs/agentgateway-linux-amd64 > outputs/agentgateway-linux-amd64.sha256
|
||||
mv release-binary-linux-arm/agentgateway outputs/agentgateway-linux-arm64
|
||||
mv release-binary-ubuntu-24.04-arm/agentgateway outputs/agentgateway-linux-arm64
|
||||
sha256sum outputs/agentgateway-linux-arm64 > outputs/agentgateway-linux-arm64.sha256
|
||||
mv release-binary-windows/agentgateway.exe outputs/agentgateway-windows-amd64.exe
|
||||
mv release-binary-windows-2025/agentgateway.exe outputs/agentgateway-windows-amd64.exe
|
||||
sha256sum outputs/agentgateway-windows-amd64.exe > outputs/agentgateway-windows-amd64.exe.sha256
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: outputs/agentgateway-*
|
||||
tag_name: ${{ github.ref_name }}
|
||||
|
||||
@ -104,7 +104,7 @@ Only project maintainers can create releases. The process is:
|
||||
### Community
|
||||
|
||||
- Join our [Discord server](https://discord.gg/y9efgEmppm) for discussions
|
||||
- Participate in our [agentgateway community calls](https://calendar.google.com/calendar/u/0?cid=Y18zZTAzNGE0OTFiMGUyYzU2OWI1Y2ZlOWNmOWM4NjYyZTljNTNjYzVlOTdmMjdkY2I5ZTZmNmM5ZDZhYzRkM2ZmQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20)
|
||||
- Participate in [our All Things AI Agents community calls](https://github.com/kagent-dev/community?tab=readme-ov-file#community-meetings)
|
||||
- Help answer questions in GitHub issues
|
||||
- Review pull requests from other contributors
|
||||
|
||||
@ -114,4 +114,4 @@ By contributing to this project, you agree that your contributions will be licen
|
||||
|
||||
## Questions?
|
||||
|
||||
If you have any questions about contributing, please open an issue or reach out to the maintainers.
|
||||
If you have any questions about contributing, please open an issue or reach out to the maintainers.
|
||||
873
Cargo.lock
generated
873
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
80
Cargo.toml
80
Cargo.toml
@ -6,6 +6,7 @@ wiremock = { git = "https://github.com/howardjohn/wiremock-rs", rev = "e55f5b960
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"crates/a2a-sdk",
|
||||
"crates/agentgateway",
|
||||
"crates/agentgateway-app",
|
||||
"crates/cel-fork/cel",
|
||||
@ -13,11 +14,11 @@ members = [
|
||||
"crates/celx",
|
||||
"crates/core",
|
||||
"crates/hbone",
|
||||
"crates/protos",
|
||||
"crates/xds",
|
||||
"crates/xtask",
|
||||
]
|
||||
default-members = [
|
||||
"crates/a2a-sdk",
|
||||
"crates/agentgateway",
|
||||
"crates/agentgateway-app",
|
||||
"crates/cel-fork/cel",
|
||||
@ -25,7 +26,6 @@ default-members = [
|
||||
"crates/celx",
|
||||
"crates/core",
|
||||
"crates/hbone",
|
||||
"crates/protos",
|
||||
"crates/xds",
|
||||
]
|
||||
|
||||
@ -37,6 +37,7 @@ license = "Apache-2.0"
|
||||
publish = false
|
||||
|
||||
[workspace.dependencies]
|
||||
a2a-sdk = { version = "0.7.0", path = "crates/a2a-sdk" }
|
||||
agent-core = { path = "crates/core" }
|
||||
agent-celx = { path = "crates/celx" }
|
||||
agent-hbone = { path = "crates/hbone" }
|
||||
@ -44,47 +45,45 @@ agent-xds = { path = "crates/xds" }
|
||||
agentgateway = { path = "crates/agentgateway" }
|
||||
cel = { path = "crates/cel-fork/cel" }
|
||||
cel-derive = { path = "crates/cel-fork/cel-derive" }
|
||||
protos = { path = "crates/protos" }
|
||||
atomic_float = { version = "1.1.0", features = ["serde"] }
|
||||
anyhow = "1.0"
|
||||
arc-swap = "1.9"
|
||||
arc-swap = "1.7.1"
|
||||
arcstr = { version = "1.2", features = ["serde"] }
|
||||
assert_matches = "1.5.0"
|
||||
async-openai = { version = "0.34", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
|
||||
async-openai = { git = "https://github.com/64bit/async-openai", rev = "6e482db7185e3e186fe49bae0ec2f214fc822e4a", default-features = false, features = ["chat-completion-types", "moderation-types", "response-types", "realtime-types"] }
|
||||
async-stream = "0.3"
|
||||
async-trait = "0.1"
|
||||
aws-config = { version = "1.8", default-features = false, features = ["default-https-client", "rt-tokio"] }
|
||||
aws-config = { version = "1.8.5", default-features = false, features = ["default-https-client", "rt-tokio"] }
|
||||
aws-credential-types = "1.2"
|
||||
aws-sigv4 = "1.3"
|
||||
aws-smithy-eventstream = "0.60"
|
||||
aws-smithy-types = "1.3"
|
||||
aws-lc-rs = "1.16"
|
||||
aws-lc-rs = "1.15"
|
||||
axum = { version = "0.8", features = ["macros"] }
|
||||
axum-core = "0.5"
|
||||
axum-extra = { version = "0.12", features = ["json-lines", "typed-header"] }
|
||||
# Disable default features to avoid pulling in native-tls and requiring openssl
|
||||
# TODO: allow default features if we ever add an openssl feature
|
||||
azure_identity = { version = "0.33", default-features = false }
|
||||
azure_core = { version = "0.33", default-features = false }
|
||||
typespec_client_core = { default-features = false, version = "0.12" }
|
||||
azure_identity = { version = "0.31", default-features = false }
|
||||
azure_core = { version = "0.31", default-features = false }
|
||||
typespec_client_core = { default-features = false, version = "0.10" }
|
||||
base64 = "0.22"
|
||||
cookie = { version = "0.18", default-features = false }
|
||||
bcrypt = "0.19"
|
||||
bytes = { version = "1.11", features = ["serde"] }
|
||||
bcrypt = "0.18"
|
||||
bytes = { version = "1.10", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
clap = { version = "4.6", features = ["derive"] }
|
||||
clocksource = "1.0"
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
clocksource = "0.8"
|
||||
crossbeam = "0.8"
|
||||
divan = "0.1"
|
||||
durationfmt = "0.1"
|
||||
go-parse-duration = "0.1"
|
||||
flurry = "0.5.2"
|
||||
fs-err = { version = "3.3", features = ["tokio"] }
|
||||
fs-err = { version = "3.1", features = ["tokio"] }
|
||||
futures = "0.3"
|
||||
futures-channel = "0.3"
|
||||
futures-core = "0.3"
|
||||
futures-util = "0.3"
|
||||
google-cloud-auth = { version = "1.8", default-features = false, features = [
|
||||
google-cloud-auth = { version = "1.6", 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.
|
||||
@ -97,24 +96,24 @@ hex = "0.4"
|
||||
hickory-resolver = { version = "0.25", features = ["serde"] }
|
||||
htpasswd-verify-fork = { path = "crates/htpasswd-verify-fork" }
|
||||
httpdate = "1.0"
|
||||
http = "1.4"
|
||||
http = "1.3"
|
||||
http-body = "1"
|
||||
http-body-util = "0.1.3"
|
||||
hyper = { version = "1.8", features = ["full"] }
|
||||
hyper = { version = "1.6", features = ["full"] }
|
||||
hyper-rustls = "0.27"
|
||||
hyper-util = { version = "0.1", features = ["full"] }
|
||||
hyper-util-fork = { path = "crates/hyper-util-fork" }
|
||||
include_dir = "0.7"
|
||||
indexmap = { version = "2.13", features = ["serde"] }
|
||||
insta = { version = "1.47", features = ["json", "redactions", "filters", "yaml"] }
|
||||
ipnet = { version = "2.12", features = ["serde"] }
|
||||
indexmap = { version = "2.9", features = ["serde"] }
|
||||
insta = { version = "1.38", features = ["json", "redactions", "filters", "yaml"] }
|
||||
ipnet = { version = "2.11", features = ["serde"] }
|
||||
itertools = "0.14"
|
||||
jsonwebtoken = { version = "10.3", features = ["aws_lc_rs"] }
|
||||
lazy_static = "1.5"
|
||||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
notify = "8.2"
|
||||
notify = "8.0"
|
||||
notify-debouncer-full = "0.7"
|
||||
md-5 = "0.11"
|
||||
md-5 = "0.10"
|
||||
num_cpus = "1.17"
|
||||
once_cell = "1.21"
|
||||
openapiv3 = "2.2"
|
||||
@ -127,7 +126,7 @@ parking_lot = "0.12"
|
||||
percent-encoding = "2.3"
|
||||
phonenumber = "0.3"
|
||||
pin-project-lite = "0.2"
|
||||
pingora-pool = "0.8"
|
||||
pingora-pool = "0.7"
|
||||
ppp = "2.3"
|
||||
pprof = { version = "0.15", features = [
|
||||
"protobuf",
|
||||
@ -139,12 +138,12 @@ prometheus-client = "0.24"
|
||||
prost = "0.14"
|
||||
prost-build = "0.14"
|
||||
prost-types = "0.14"
|
||||
prost-wkt-types = { version = "0.7", features = ["vendored-protox"] }
|
||||
prost-wkt-build = "0.7"
|
||||
prost-wkt-types = { version = "0.7.0", features = ["vendored-protox"] }
|
||||
prost-wkt-build = "0.7.0"
|
||||
pwhash = "1"
|
||||
rand = "0.10"
|
||||
rcgen = { version = "0.14", default-features = false, features = ["pem", "x509-parser", "aws_lc_rs"] }
|
||||
regex = "1.12"
|
||||
regex = "1.11"
|
||||
reqwest = { version = "0.13", default-features = false, features = [
|
||||
"http2",
|
||||
"charset",
|
||||
@ -154,7 +153,7 @@ rstest = "0.26"
|
||||
rustc_version = "0.4"
|
||||
rustls = { version = "0.23", default-features = false, features = ["tls12", "aws_lc_rs"] }
|
||||
rustls-native-certs = "0.8"
|
||||
rustls-pki-types = "1.14"
|
||||
rustls-pki-types = "1.12"
|
||||
schemars = { version = "=1.0.4", git = "https://github.com/howardjohn/schemars", rev = "4364354fa41897a0c2001d891c0a9a38eafedb82", features = [
|
||||
#schemars = { version = "1.0", features = [
|
||||
"bytes1",
|
||||
@ -170,17 +169,16 @@ serde-untagged = "0.1"
|
||||
serde_json_path_to_error = "0.1"
|
||||
serde_regex = "1.1"
|
||||
serde_yaml = "0.9"
|
||||
sha1 = "0.11"
|
||||
sha2 = "0.11"
|
||||
sha1 = "0.10"
|
||||
shellexpand = "3.1"
|
||||
socket2 = "0.6"
|
||||
split-iter = "0.1"
|
||||
sse-stream = "0.2"
|
||||
stacker = "0.1"
|
||||
tempfile = "3.27"
|
||||
tempfile = "3.20"
|
||||
thiserror = "2.0"
|
||||
tiktoken-rs = "0.9"
|
||||
tokio = { version = "1.50", features = ["full", "macros", "sync"] }
|
||||
tokio = { version = "1.48", features = ["full", "macros", "sync"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["aws_lc_rs"] }
|
||||
tokio-stream = { version = "0.1", features = ["net", "sync"] }
|
||||
tokio-test = "0.4"
|
||||
@ -204,7 +202,7 @@ tracing-subscriber = { version = "0.3", features = [
|
||||
"json",
|
||||
] }
|
||||
url = "2.5"
|
||||
uuid = { version = "1.23", features = ["v4"] }
|
||||
uuid = { version = "1.11", features = ["v4"] }
|
||||
wiremock = { version = "0.6", features = ["tls"] }
|
||||
x509-parser = { version = "0.18", default-features = false, features = ["verify-aws"] }
|
||||
which = "8.0"
|
||||
@ -215,12 +213,12 @@ crossbeam-channel = "0.5"
|
||||
http-serde = "2.1"
|
||||
itoa = "1.0"
|
||||
serde_urlencoded = "0.7"
|
||||
serde_with = { version = "3.17", features = [
|
||||
serde_with = { version = "3.14", features = [
|
||||
"schemars_1",
|
||||
"macros",
|
||||
"alloc",
|
||||
], default-features = false }
|
||||
value-bag = { version = "1.12", features = ["serde", "value-bag-serde1"] }
|
||||
value-bag = { version = "1.11", features = ["serde", "value-bag-serde1"] }
|
||||
time = "0.3"
|
||||
tikv-jemallocator = { version = "0.6", features = [
|
||||
"profiling",
|
||||
@ -228,17 +226,17 @@ tikv-jemallocator = { version = "0.6", features = [
|
||||
] }
|
||||
jemalloc_pprof = { version = "0.8", features = ["symbolize"] }
|
||||
protox = "0.9"
|
||||
async-compression = { version = "0.4", features = [
|
||||
async-compression = { version = "0.4.27", features = [
|
||||
"brotli",
|
||||
"zlib",
|
||||
"gzip",
|
||||
"zstd",
|
||||
"tokio",
|
||||
] }
|
||||
core_affinity = "0.8"
|
||||
frozen-collections = "0.9"
|
||||
core_affinity = "0.8.3"
|
||||
frozen-collections = "0.8.0"
|
||||
heck = "0.5"
|
||||
macro_rules_attribute = "0.2"
|
||||
macro_rules_attribute = "0.2.2"
|
||||
|
||||
# Release optimized but without as many dependencies, suitable for incremental development
|
||||
[profile.quick-release]
|
||||
|
||||
2
Makefile
2
Makefile
@ -82,7 +82,7 @@ generate-schema:
|
||||
# Code generation for xds apis
|
||||
.PHONY: generate-apis
|
||||
generate-apis:
|
||||
@PATH="./common/tools:$(PATH)" buf generate --path crates/protos/proto/resource.proto
|
||||
@PATH="./common/tools:$(PATH)" buf generate --path crates/agentgateway/proto/resource.proto
|
||||
|
||||
.PHONY: run-validation-deps
|
||||
run-validation-deps:
|
||||
|
||||
56
README.md
56
README.md
@ -29,7 +29,7 @@
|
||||
|
||||
---
|
||||
|
||||
**Agentgateway** is an open source proxy built on AI-native protocols ([MCP](https://modelcontextprotocol.io/introduction) & [A2A](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/)) that provides drop-in security, observability, and governance for agent-to-LLM, agent-to-tool, and agent-to-agent communication across any framework and environment.
|
||||
**Agentgateway** is an open source data plane optimized for agentic AI connectivity within or across any agent framework or environment. Agentgateway provides drop-in security, observability, and governance for agent-to-agent and agent-to-tool communication and supports leading interoperable protocols, including [Agent2Agent (A2A)](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/) and [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction).
|
||||
|
||||
<br>
|
||||
<div align="center">
|
||||
@ -37,42 +37,33 @@
|
||||
</div>
|
||||
<br>
|
||||
|
||||
> [!TIP]
|
||||
> Want to use agentgateway in Kubernetes? Check out the [kgateway.dev/docs/agentgateway](https://kgateway.dev/docs/agentgateway/) docs. Agentgateway is a supported data plane for the kgateway project, which provides a control plane to dynamically provision and manage agentgateway with the Kubernetes Gateway API.
|
||||
|
||||
## Intro to Agentgateway Video
|
||||
|
||||
[](https://youtu.be/SomP92JWPmE)
|
||||
|
||||
## Key Features
|
||||
## Key Features:
|
||||
|
||||
- **LLM Gateway**<br>
|
||||
Route traffic to major LLM providers (OpenAI, Anthropic, Gemini, Bedrock, and more) through a unified OpenAI-compatible API with budget and spend controls, prompt enrichment, load balancing, and failover.
|
||||
|
||||
- **MCP Gateway**<br>
|
||||
Connect LLMs to tools and external data sources via MCP with tool federation, stdio/HTTP/SSE/Streamable HTTP transports, OpenAPI integration, and OAuth authentication.
|
||||
|
||||
- **A2A Gateway**<br>
|
||||
Enable secure agent-to-agent communication using A2A, with capability discovery, modality negotiation, and task collaboration.
|
||||
|
||||
- **Inference Routing**<br>
|
||||
Intelligent routing to self-hosted models using Kubernetes Inference Gateway extensions, with decisions based on GPU utilization, KV cache, LoRA adapters, and queue depth.
|
||||
|
||||
- **Guardrails**<br>
|
||||
Multi-layered content filtering with regex, OpenAI moderation, AWS Bedrock Guardrails, Google Model Armor, and custom webhooks.
|
||||
|
||||
- **Security & Observability**<br>
|
||||
Auth (JWT, API keys, OAuth), fine-grained RBAC with CEL policy engine, rate limiting, TLS, and OpenTelemetry metrics/logs/tracing.
|
||||
- [x] **Highly performant:** agentgateway is written in rust, and is designed from the ground up to handle any scale you can throw at it.
|
||||
- [x] **Security First:** agentgateway includes a robust MCP/A2A focused RBAC system.
|
||||
- [x] **Multi Tenant:** agentgateway supports multiple tenants, each with their own set of resources and users.
|
||||
- [x] **Dynamic:** agentgateway supports dynamic configuration updates via xDS, without any downtime.
|
||||
- [x] **Run Anywhere:** agentgateway can run anywhere with any agent framework, from a single machine to a large scale multi-tenant deployment.
|
||||
- [x] **Legacy API Support:** agentgateway can transform legacy APIs into MCP resources. Currently supports OpenAPI. (gRPC coming soon)
|
||||
<br>
|
||||
|
||||
## Getting Started
|
||||
## Getting Started
|
||||
|
||||
- [Standalone Quickstart](https://agentgateway.dev/docs/quickstart) — Get started with agentgateway in minutes.
|
||||
- [Kubernetes Quickstart](https://agentgateway.dev/docs/kubernetes/latest) — Deploy on Kubernetes using the built-in controller and Gateway API.
|
||||
To get started with agentgateway, please check out the [Getting Started Guide](https://agentgateway.dev/docs/quickstart).
|
||||
|
||||
## Documentation
|
||||
|
||||
Depending on your deployment environment, check out the following docs:
|
||||
|
||||
- [agentgateway.dev/docs](https://agentgateway.dev/docs/): For standalone deployments such as local or on-prem. These docs are for this upstream `agentgateway/agentgateway` GitHub project.
|
||||
- [agentgateway.dev/docs/kubernetes/latest](https://agentgateway.dev/docs/kubernetes/latest): For Kubernetes-based deployments using the built-in Kubernetes controller and Gateway API support.
|
||||
- [kgateway.dev/docs/agentgateway](https://kgateway.dev/docs/agentgateway/): For Kubernetes-based deployments. These docs are for the agentgateway data plane that is supported by the [`kgateway-dev/kgateway` GitHub project](https://github.com/kgateway-dev/kgateway). Kgateway provides a control plane to dynamically provision and manage agentgateway with the Kubernetes Gateway API.
|
||||
|
||||
Agentgateway has a built-in UI for you to explore agentgateway connecting agent-to-agent or agent-to-tool:
|
||||
|
||||
@ -80,23 +71,6 @@ Agentgateway has a built-in UI for you to explore agentgateway connecting agent-
|
||||
<img alt="agentgateway UI" src="img/UI-homepage.png">
|
||||
</div>
|
||||
|
||||
## Sponsors
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" width="33.3%">
|
||||
<a href="https://blacksmith.sh/">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith-light.svg">
|
||||
<img src="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith.svg" alt="Blacksmith" height="48">
|
||||
</picture>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Thank you to our sponsors for helping to fund the development of agentgateway!
|
||||
|
||||
## Contributing
|
||||
|
||||
For instructions on how to contribute to the agentgateway project, see the [CONTRIBUTION.md](CONTRIBUTION.md) file.
|
||||
@ -108,7 +82,7 @@ Recordings of the community meetings will be published on our [google drive](htt
|
||||
|
||||
## Roadmap
|
||||
|
||||
`agentgateway` is currently in active development. If you'd like a feature that's missing, open an issue in our [GitHub repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
`agentgateway` is currently in active development. If you want a feature missing, open an issue in our [Github repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
27
Tiltfile
27
Tiltfile
@ -1,7 +1,6 @@
|
||||
# Tiltfile for AgentGateway development
|
||||
# This deploys both control plane (Go) and data plane (Rust) to Kind with live updates
|
||||
load('ext://restart_process', 'docker_build_with_restart')
|
||||
load('ext://helm_resource', 'helm_resource', 'helm_repo')
|
||||
|
||||
# Configuration
|
||||
version = 'v1.0.1-dev'
|
||||
@ -34,12 +33,14 @@ run_controller_make('gie-crds')
|
||||
|
||||
# Install CRDs
|
||||
print('Installing AgentGateway CRDs...')
|
||||
helm_resource(
|
||||
'agentgateway-crds',
|
||||
'controller/install/helm/agentgateway-crds',
|
||||
namespace=install_namespace,
|
||||
flags=['--set=version=' + version],
|
||||
)
|
||||
k8s_yaml(helm(
|
||||
'controller/install/helm/agentgateway-crds',
|
||||
name='agentgateway-crds',
|
||||
namespace=install_namespace,
|
||||
set=[
|
||||
'version=' + version,
|
||||
]
|
||||
))
|
||||
|
||||
# =============================================================================
|
||||
# Control Plane (Go-based controller)
|
||||
@ -47,7 +48,7 @@ helm_resource(
|
||||
|
||||
local_resource(
|
||||
'go-compile-controller',
|
||||
'make -C ./controller VERSION=' + version + ' GCFLAGS=all="-N -l" agentgateway-controller && mv ./controller/_output/pkg/agentgateway/agentgateway-linux-$(go env GOARCH) ./tools/tilt/agentgateway-controller',
|
||||
'make -C ./controller VERSION=' + version + ' GCFLAGS=all="-N -l" agentgateway-controller && mv ./controller/_output/pkg/agentgateway/agentgateway-linux-$(go env GOARCH) ./hack/tilt/agentgateway-controller',
|
||||
deps=['./controller/'],
|
||||
ignore=['./controller/_output/'],
|
||||
)
|
||||
@ -55,7 +56,7 @@ local_resource(
|
||||
# Build control plane Docker image
|
||||
docker_build_with_restart(
|
||||
image_registry + '/agentgateway-controller',
|
||||
context='./tools/tilt/',
|
||||
context='./hack/tilt/',
|
||||
entrypoint='/usr/local/bin/agentgateway-controller',
|
||||
dockerfile_contents="""
|
||||
FROM ubuntu:24.04
|
||||
@ -65,7 +66,7 @@ ENTRYPOINT /usr/local/bin/agentgateway-controller
|
||||
# Live update: sync Go binaries
|
||||
live_update=[
|
||||
# Sync Go code changes
|
||||
sync('./tools/tilt/agentgateway-controller', '/usr/local/bin/agentgateway-controller'),
|
||||
sync('./hack/tilt/agentgateway-controller', '/usr/local/bin/agentgateway-controller'),
|
||||
],
|
||||
only=[
|
||||
'./agentgateway-controller',
|
||||
@ -105,7 +106,7 @@ k8s_resource('agentgateway',
|
||||
|
||||
local_resource(
|
||||
'rust-compile-dataplane',
|
||||
'cargo build && if [ -f "./tools/tilt/agentgateway" ]; then rm "./tools/tilt/agentgateway"; fi && mv ./target/debug/agentgateway ./tools/tilt/agentgateway',
|
||||
'cargo build && if [ -f "./hack/tilt/agentgateway" ]; then rm "./hack/tilt/agentgateway"; fi && mv ./target/debug/agentgateway ./hack/tilt/agentgateway',
|
||||
deps=['./crates',
|
||||
'./Cargo.toml',
|
||||
'./Cargo.lock',
|
||||
@ -114,7 +115,7 @@ local_resource(
|
||||
# Build data plane Docker image
|
||||
docker_build(
|
||||
'agentgateway',
|
||||
context='./tools/tilt/',
|
||||
context='./hack/tilt/',
|
||||
dockerfile_contents="""
|
||||
FROM ubuntu:24.04
|
||||
COPY start.sh /scripts/start.sh
|
||||
@ -123,7 +124,7 @@ COPY agentgateway /usr/local/bin/
|
||||
ENTRYPOINT ["/scripts/start.sh", "/usr/local/bin/agentgateway"]
|
||||
""",
|
||||
live_update=[
|
||||
sync('./tools/tilt/agentgateway', '/usr/local/bin/agentgateway'),
|
||||
sync('./hack/tilt/agentgateway', '/usr/local/bin/agentgateway'),
|
||||
run('/scripts/restart.sh'),
|
||||
],
|
||||
only=[
|
||||
|
||||
2321
api/resource.pb.go
2321
api/resource.pb.go
File diff suppressed because it is too large
Load Diff
@ -336,17 +336,6 @@ func (this *AzureDeveloperImplicit) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for AzureImplicit
|
||||
func (this *AzureImplicit) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for AzureImplicit
|
||||
func (this *AzureImplicit) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for RouteMatch
|
||||
func (this *RouteMatch) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
@ -611,17 +600,6 @@ func (this *FrontendPolicySpec_TCP) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for FrontendPolicySpec_NetworkAuthorization
|
||||
func (this *FrontendPolicySpec_NetworkAuthorization) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for FrontendPolicySpec_NetworkAuthorization
|
||||
func (this *FrontendPolicySpec_NetworkAuthorization) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for FrontendPolicySpec_Logging
|
||||
func (this *FrontendPolicySpec_Logging) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
@ -655,17 +633,6 @@ func (this *FrontendPolicySpec_Logging_Fields) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for FrontendPolicySpec_Logging_OtlpAccessLog
|
||||
func (this *FrontendPolicySpec_Logging_OtlpAccessLog) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for FrontendPolicySpec_Logging_OtlpAccessLog
|
||||
func (this *FrontendPolicySpec_Logging_OtlpAccessLog) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for FrontendPolicySpec_Tracing
|
||||
func (this *FrontendPolicySpec_Tracing) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
@ -831,17 +798,6 @@ func (this *TrafficPolicySpec_JWT) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for TrafficPolicySpec_JWT_MCP
|
||||
func (this *TrafficPolicySpec_JWT_MCP) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for TrafficPolicySpec_JWT_MCP
|
||||
func (this *TrafficPolicySpec_JWT_MCP) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for TrafficPolicySpec_BasicAuthentication
|
||||
func (this *TrafficPolicySpec_BasicAuthentication) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
@ -1194,17 +1150,6 @@ func (this *BackendPolicySpec_BackendHTTP) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for BackendPolicySpec_BackendTunnel
|
||||
func (this *BackendPolicySpec_BackendTunnel) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for BackendPolicySpec_BackendTunnel
|
||||
func (this *BackendPolicySpec_BackendTunnel) UnmarshalJSON(b []byte) error {
|
||||
return ResourceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for BackendPolicySpec_BackendTCP
|
||||
func (this *BackendPolicySpec_BackendTCP) MarshalJSON() ([]byte, error) {
|
||||
str, err := ResourceMarshaler.MarshalToString(this)
|
||||
|
||||
@ -5,10 +5,6 @@ CEL is an expression language that can evaluate user-defined (at runtime) expres
|
||||
|
||||
A simple example of an expression that could be used for MCP authorization: `jwt.sub == "test-user" && mcp.tool.name == "add"`.
|
||||
|
||||
For post-request logging, tracing, and metrics CEL, MCP tool calls also expose payload fields such as
|
||||
`mcp.methodName`, `mcp.sessionId`, `mcp.tool.arguments`, `mcp.tool.result`, and `mcp.tool.error`.
|
||||
Request-time authorization keeps the `mcp` context identity-only, so those payload fields are absent during RBAC evaluation.
|
||||
|
||||
While CEL is not as powerful as alternatives like Lua or WASM, it is pretty fast and good enough for many use cases.
|
||||
|
||||
Agentgateway currently uses CEL for:
|
||||
|
||||
2
buf.yaml
2
buf.yaml
@ -1,4 +1,4 @@
|
||||
version: v1beta1
|
||||
build:
|
||||
roots:
|
||||
- crates/protos/proto
|
||||
- crates/agentgateway/proto
|
||||
@ -104,6 +104,10 @@ linters:
|
||||
alias: gwv1a2
|
||||
- pkg: sigs.k8s.io/gateway-api/apis/v1beta1
|
||||
alias: gwv1b1
|
||||
- pkg: github.com/envoyproxy/go-control-plane/envoy/config/(\w+)/(v[\w\d]+)
|
||||
alias: envoy$1$2
|
||||
- pkg: github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3
|
||||
alias: envoytlsv3
|
||||
- pkg: github.com/agentgateway/agentgateway/controller/api/annotations
|
||||
alias: apiannotations
|
||||
- pkg: github.com/agentgateway/agentgateway/controller/api/settings
|
||||
|
||||
@ -461,7 +461,6 @@ HELM ?= helm
|
||||
HELM_CHART_VERSION_NO_V ?= $(patsubst v%,%,$(VERSION))
|
||||
HELM_CHART_VERSION_V ?= v$(HELM_CHART_VERSION_NO_V)
|
||||
HELM_PACKAGE_ARGS ?= --version $(HELM_CHART_VERSION_NO_V) --app-version $(HELM_CHART_VERSION_NO_V)
|
||||
EXTRA_HELM_TAG ?=
|
||||
HELM_CHART_DIR_AGW=install/helm/agentgateway
|
||||
HELM_CHART_DIR_AGW_CRD=install/helm/agentgateway-crds
|
||||
HELM_ADDITIONAL_VALUES ?= hack/helm/dev.yaml
|
||||
@ -491,29 +490,18 @@ release-charts: package-agentgateway-charts
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(HELM_CHART_VERSION_V) --app-version $(HELM_CHART_VERSION_V) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR);
|
||||
@if [ -n "$(EXTRA_HELM_TAG)" ]; then \
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR); \
|
||||
mkdir -p $(TEST_ASSET_DIR); \
|
||||
$(HELM) package --version $(EXTRA_HELM_TAG) --app-version $(VERSION) --destination $(TEST_ASSET_DIR) $(HELM_CHART_DIR_AGW_CRD); \
|
||||
$(HELM) repo index $(TEST_ASSET_DIR); \
|
||||
fi
|
||||
@for chart in $(CHART_NAMES); do \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_NO_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(HELM_CHART_VERSION_V).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
if [ -n "$(EXTRA_HELM_TAG)" ]; then \
|
||||
$(HELM) push $(TEST_ASSET_DIR)/$$chart-$(EXTRA_HELM_TAG).tgz oci://$(IMAGE_REGISTRY)/charts; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
.PHONY: deploy-agentgateway-crd-chart
|
||||
deploy-agentgateway-crd-chart: ## Deploy the agentgateway crd chart
|
||||
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(HELM_CHART_VERSION_NO_V).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
|
||||
$(HELM) upgrade --install agentgateway-crds $(TEST_ASSET_DIR)/agentgateway-crds-$(VERSION).tgz --namespace $(INSTALL_NAMESPACE) --create-namespace
|
||||
|
||||
.PHONY: deploy-agentgateway-chart
|
||||
deploy-agentgateway-chart: ## Deploy the agentgateway chart
|
||||
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(HELM_CHART_VERSION_NO_V).tgz \
|
||||
$(HELM) upgrade --install agentgateway $(TEST_ASSET_DIR)/agentgateway-$(VERSION).tgz \
|
||||
--namespace $(INSTALL_NAMESPACE) --create-namespace \
|
||||
--set image.registry=$(IMAGE_REGISTRY) \
|
||||
--set image.tag=$(VERSION) \
|
||||
@ -563,7 +551,10 @@ endif
|
||||
endif
|
||||
|
||||
# The version of the k8s gateway api inference extension CRDs to install.
|
||||
GIE_CRD_VERSION ?= $(shell go list -m -f '{{.Version}}' sigs.k8s.io/gateway-api-inference-extension)
|
||||
# Managed by `make bump-gie`.
|
||||
GIE_CRD_VERSION ?= v1.3.0
|
||||
# When we are back on a release version instead of `main`, we can do this
|
||||
#GIE_CRD_VERSION ?= $(shell go list -m -f '{{.Version}}' sigs.k8s.io/gateway-api-inference-extension)
|
||||
|
||||
.PHONY: gie-crds
|
||||
gie-crds: ## Install the Gateway API Inference Extension CRDs
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# APIs for Agentgateway Controller
|
||||
# APIs for kgateway
|
||||
|
||||
This directory contains Go types for Agentgateway Controller APIs & custom resources.
|
||||
This directory contains Go types for kgateway APIs & custom resources.
|
||||
|
||||
## Adding a new API / CRD
|
||||
|
||||
@ -9,14 +9,14 @@ These are the steps required to add a new CRD to be used in the Kubernetes Gatew
|
||||
1. If creating a new API version (e.g. `v1`, `v2alpha1`), create a new directory for the version and create a `doc.go` file with the `// +kubebuilder:object:generate=true` annotation, so that Go types in that directory will be converted into CRDs when codegen is run.
|
||||
- The `groupName` marker specifies the API group name for the generated CRD.
|
||||
- RBAC rules are defined via the `+kubebuilder:rbac` annotation (note: this annotation should not belong to the type, but rather the file or package).
|
||||
2. Create a `_types.go` file in the API version directory. Following [agentgateway_parameters_types.go](/controller/api/v1alpha1/agentgateway/agentgateway_parameters_types.go) as an example:
|
||||
2. Create a `_types.go` file in the API version directory. Following [gateway_parameters_types.go](/api/v1alpha1/kgateway/gateway_parameters_types.go) as an example:
|
||||
- Define a struct for the resource (containing the metadata fields, `Spec`, and `Status`). Follow the [API guidelines](#api-guidelines) below.
|
||||
- Define a struct for the resource list (containing the metadata fields and `Items`)
|
||||
3. Run codegen via `make generated-code -B`. This will invoke the `controller-gen` command specified in [generate.go](/controller/hack/generate.go), which should result in the following:
|
||||
3. Run codegen via `make generated-code -B`. This will invoke the `controller-gen` command specified in [generate.go](/hack/generate.go), which should result in the following:
|
||||
- A `zz_generated.deepcopy.go` file is created in the same directory as the Go types.
|
||||
- A `zz_generated.register.go` file is created in the same directory as the Go types, to help with registering the Go types with the scheme.
|
||||
- CRDs are generated in the CRD helm chart template dir: [install/helm/agentgateway-crds/templates](/controller/install/helm/agentgateway-crds/templates)
|
||||
- RBAC roles are generated in [controller/install/helm/templates/role.yaml](/agentgateway/install/helm/agentgateway/templates/role.yaml)
|
||||
- CRDs are generated in the CRD helm chart template dir: [install/helm/kgateway-crds/templates](/install/helm/kgateway-crds/templates)
|
||||
- RBAC roles are generated in [install/helm/kgateway/templates/role.yaml](/install/helm/kgateway/templates/role.yaml)
|
||||
- Updates the [api/applyconfiguration](/api/applyconfiguration), [pkg/generated](/pkg/generated) and [pkg/client](/pkg/client) folders with kube clients. These are used in plugin initialization and the fake client is used in tests.
|
||||
|
||||
## API guidelines
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
package annotations
|
||||
|
||||
// LegacyMCPServiceHTTPPath is the legacy annotation used to specify the HTTP path for the MCP service. Users should switch to MCPServiceHTTPPath.
|
||||
const LegacyMCPServiceHTTPPath = "kgateway.dev/mcp-path"
|
||||
|
||||
// MCPServiceHTTPPath is the annotation used to specify the HTTP path for the MCP service
|
||||
const MCPServiceHTTPPath = "agentgateway.dev/mcp-path"
|
||||
const MCPServiceHTTPPath = "kgateway.dev/mcp-path"
|
||||
|
||||
@ -161,6 +161,13 @@ type Settings struct {
|
||||
// is deprecated in v2.1 and will not be supported in v2.2.
|
||||
EnableInferExt bool `split_words:"true"`
|
||||
|
||||
// DefaultImageRegistry is the default image registry to use for the agentgateway image.
|
||||
DefaultImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
|
||||
// DefaultImageTag is the default image tag to use for the agentgateway image.
|
||||
DefaultImageTag string `split_words:"true" default:""`
|
||||
// DefaultImagePullPolicy is the default image pull policy to use for the agentgateway image.
|
||||
DefaultImagePullPolicy string `split_words:"true" default:"IfNotPresent"`
|
||||
|
||||
// ProxyImageRegistry is the default image registry to use for the proxy image.
|
||||
ProxyImageRegistry string `split_words:"true" default:"cr.agentgateway.dev"`
|
||||
// ProxyImageRepository is the default image repository to use for the proxy image.
|
||||
@ -188,7 +195,7 @@ type Settings struct {
|
||||
// Controls if leader election is disabled. Defaults to false.
|
||||
DisableLeaderElection bool `split_words:"true" default:"false"`
|
||||
|
||||
// EnableExperimentalGatewayAPIFeatures enables support for experimental features and APIs
|
||||
// EnableExperimentalGatewayAPIFeatures enables kgateway to support experimental features and APIs
|
||||
EnableExperimentalGatewayAPIFeatures bool `split_words:"true" default:"true"`
|
||||
|
||||
// GatewayClassParametersRefs configures the GatewayParameters references to set on the default GatewayClasses.
|
||||
|
||||
@ -27,6 +27,9 @@ func allEnvVarsSet() map[string]string {
|
||||
"AGW_AGENTGATEWAY_XDS_SERVICE_PORT": "5678",
|
||||
"AGW_NO_LISTENERS_DUMMY_PORT": "8443",
|
||||
"AGW_ENABLE_INFER_EXT": "true",
|
||||
"AGW_DEFAULT_IMAGE_REGISTRY": "custom-registry.io",
|
||||
"AGW_DEFAULT_IMAGE_TAG": "v1.0.0",
|
||||
"AGW_DEFAULT_IMAGE_PULL_POLICY": "Always",
|
||||
"AGW_LOG_LEVEL": "debug",
|
||||
"AGW_DISCOVERY_NAMESPACE_SELECTORS": `[{"matchLabels":{"app":"test"}}]`,
|
||||
"AGW_ENABLE_BUILTIN_DEFAULT_METRICS": "true",
|
||||
@ -71,6 +74,9 @@ func TestSettings(t *testing.T) {
|
||||
AgentgatewayXdsServicePort: 9978,
|
||||
NoListenersDummyPort: 443,
|
||||
EnableInferExt: false,
|
||||
DefaultImageRegistry: "cr.agentgateway.dev",
|
||||
DefaultImageTag: "",
|
||||
DefaultImagePullPolicy: "IfNotPresent",
|
||||
LogLevel: "info",
|
||||
DiscoveryNamespaceSelectors: "[]",
|
||||
EnableBuiltinDefaultMetrics: false,
|
||||
@ -99,6 +105,9 @@ func TestSettings(t *testing.T) {
|
||||
AgentgatewayXdsServicePort: 5678,
|
||||
NoListenersDummyPort: 8443,
|
||||
EnableInferExt: true,
|
||||
DefaultImageRegistry: "custom-registry.io",
|
||||
DefaultImageTag: "v1.0.0",
|
||||
DefaultImagePullPolicy: "Always",
|
||||
LogLevel: "debug",
|
||||
DiscoveryNamespaceSelectors: `[{"matchLabels":{"app":"test"}}]`,
|
||||
EnableBuiltinDefaultMetrics: true,
|
||||
@ -179,6 +188,9 @@ func TestSettings(t *testing.T) {
|
||||
XdsServiceName: "agentgateway",
|
||||
AgentgatewayXdsServicePort: 9978,
|
||||
EnableInferExt: false,
|
||||
DefaultImageRegistry: "cr.agentgateway.dev",
|
||||
DefaultImageTag: "",
|
||||
DefaultImagePullPolicy: "IfNotPresent",
|
||||
NoListenersDummyPort: 443,
|
||||
LogLevel: "info",
|
||||
DiscoveryNamespaceSelectors: "[]",
|
||||
|
||||
@ -86,7 +86,7 @@ spec:
|
||||
{{end}}
|
||||
{{.policy|nindent 2}}
|
||||
`
|
||||
v := NewAgentgatewayValidator(t)
|
||||
v := NewKgatewayValidator(t)
|
||||
for _, tt := range cases {
|
||||
for _, ref := range []bool{true, false} {
|
||||
sn := "ref"
|
||||
|
||||
@ -34,7 +34,7 @@ type TestExpectation struct {
|
||||
}
|
||||
|
||||
func TestCRDs(t *testing.T) {
|
||||
v := NewAgentgatewayValidator(t)
|
||||
v := NewKgatewayValidator(t)
|
||||
base := "testdata"
|
||||
d, err := os.ReadDir(base)
|
||||
if err != nil {
|
||||
|
||||
@ -41,51 +41,6 @@ spec:
|
||||
matchExpressions:
|
||||
- 'true'
|
||||
---
|
||||
_err: unknown fields
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-static-target-authentication
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: target
|
||||
static:
|
||||
host: example.com
|
||||
port: 443
|
||||
policies:
|
||||
mcp:
|
||||
authentication:
|
||||
issuer: https://issuer.example.com/
|
||||
jwks:
|
||||
backendRef:
|
||||
name: jwks
|
||||
port: 443
|
||||
jwksPath: /.well-known/jwks.json
|
||||
---
|
||||
_err: path and pathPrefix are mutually exclusive
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: path-and-pathprefix
|
||||
spec:
|
||||
ai:
|
||||
provider:
|
||||
openai: {}
|
||||
path: /custom/path
|
||||
pathPrefix: /custom
|
||||
---
|
||||
_err: pathPrefix requires host to be set
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: pathprefix-without-host
|
||||
spec:
|
||||
ai:
|
||||
provider:
|
||||
openai: {}
|
||||
pathPrefix: /custom
|
||||
---
|
||||
_err: both host and port must be set together
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
@ -95,47 +50,4 @@ spec:
|
||||
ai:
|
||||
provider:
|
||||
openai: {}
|
||||
host: example.com
|
||||
---
|
||||
_err: exactly one of the fields in [host backendRef] must be set
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-missing-port
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
host: mcp.example.com
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
---
|
||||
_err: exactly one of the fields in [host backendRef] must be set
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-no-target
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
port: 8080
|
||||
---
|
||||
_err: mcp target policies may not be used with backendRef
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref-with-policies
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: bad-ref
|
||||
static:
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
policies:
|
||||
tls: {}
|
||||
host: example.com
|
||||
@ -63,20 +63,6 @@ kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-full
|
||||
spec:
|
||||
policies:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Deny
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
authentication:
|
||||
issuer: https://issuer.example.com/
|
||||
jwks:
|
||||
backendRef:
|
||||
name: jwks
|
||||
port: 443
|
||||
jwksPath: /.well-known/jwks.json
|
||||
mcp:
|
||||
targets:
|
||||
- name: everything
|
||||
@ -85,6 +71,12 @@ spec:
|
||||
port: 443
|
||||
policies:
|
||||
tls: {}
|
||||
mcp:
|
||||
authorization:
|
||||
action: Deny
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
- name: k8s
|
||||
selector:
|
||||
namespaces:
|
||||
@ -132,36 +124,4 @@ spec:
|
||||
model: ollama
|
||||
host: localhost
|
||||
port: 8443
|
||||
path: /custom
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-require
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: everything
|
||||
static:
|
||||
host: example.com
|
||||
port: 443
|
||||
policies:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "hello"'
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: mcp-backend-ref
|
||||
spec:
|
||||
mcp:
|
||||
targets:
|
||||
- name: local-svc
|
||||
static:
|
||||
backendRef:
|
||||
name: mcp-service
|
||||
port: 8080
|
||||
path: /custom
|
||||
@ -247,39 +247,6 @@ spec:
|
||||
expression: 'request.headers["x-user"]'
|
||||
unit: Minutes
|
||||
---
|
||||
_err: 'failureMode: Unsupported value'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: traffic-extauth-invalid-failure-mode
|
||||
spec:
|
||||
traffic:
|
||||
extAuth:
|
||||
backendRef:
|
||||
name: auth-server
|
||||
kind: Service
|
||||
failureMode: IgnoreErrors
|
||||
grpc: {}
|
||||
---
|
||||
_err: 'failureMode: Unsupported value'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: traffic-ratelimit-global-invalid-failure-mode
|
||||
spec:
|
||||
traffic:
|
||||
rateLimit:
|
||||
global:
|
||||
backendRef:
|
||||
name: ratelimit-service
|
||||
kind: Service
|
||||
failureMode: IgnoreErrors
|
||||
domain: example.com
|
||||
descriptors:
|
||||
- entries:
|
||||
- name: user
|
||||
expression: 'request.headers["x-user"]'
|
||||
---
|
||||
_err: 'phase: Unsupported value'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
@ -294,21 +261,6 @@ spec:
|
||||
- name: X-Test
|
||||
value: '"test"'
|
||||
---
|
||||
_err: 'jwtAuthentication.mcp requires mode Strict'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: traffic-jwt-mcp-nonstrict
|
||||
spec:
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
mode: Optional
|
||||
providers:
|
||||
- issuer: https://example.com
|
||||
jwks:
|
||||
inline: '{"keys":[]}'
|
||||
mcp: {}
|
||||
---
|
||||
_err: 'pseudo-headers must be one of'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
@ -350,15 +302,14 @@ spec:
|
||||
protocol: GRPC
|
||||
path: /v1/traces
|
||||
---
|
||||
_err: 'spec.traffic.hostRewrite.mode: Unsupported value'
|
||||
_err: 'hostRewrite: Unsupported value'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: traffic-hostrewrite-invalid
|
||||
spec:
|
||||
traffic:
|
||||
hostRewrite:
|
||||
mode: Custom
|
||||
hostRewrite: Custom
|
||||
---
|
||||
_err: ' exactly one of the fields in [targetRefs targetSelectors] must be set'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
@ -434,28 +385,6 @@ spec:
|
||||
- field: a
|
||||
value: b
|
||||
---
|
||||
_err: 'traffic.jwtAuthentication may not be used with backend.mcp.authentication in the same policy'
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-and-mcp-authentication
|
||||
spec:
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
providers:
|
||||
- issuer: https://example.com
|
||||
jwks:
|
||||
inline: '{"keys":[]}'
|
||||
backend:
|
||||
mcp:
|
||||
authentication:
|
||||
issuer: https://example.com
|
||||
jwks:
|
||||
backendRef:
|
||||
kind: Service
|
||||
name: jwks
|
||||
jwksPath: /.well-known/jwks.json
|
||||
---
|
||||
_err: "targetRefs may only"
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
|
||||
@ -308,7 +308,6 @@ spec:
|
||||
name: auth-server
|
||||
kind: AgentgatewayBackend
|
||||
group: agentgateway.dev
|
||||
failureMode: FailOpen
|
||||
forwardBody:
|
||||
maxSize: 1048576
|
||||
---
|
||||
@ -359,7 +358,6 @@ spec:
|
||||
name: ratelimit-service
|
||||
kind: Service
|
||||
port: 8080
|
||||
failureMode: FailOpen
|
||||
domain: example.com
|
||||
descriptors:
|
||||
- entries:
|
||||
|
||||
@ -7,38 +7,16 @@ import (
|
||||
"testing"
|
||||
|
||||
"istio.io/istio/pkg/config/crd"
|
||||
"istio.io/istio/pkg/lazy"
|
||||
"istio.io/istio/pkg/test/util/assert"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/fsutils"
|
||||
)
|
||||
|
||||
var validator = lazy.New(func() (*crd.Validator, error) {
|
||||
return newAgentgatewayValidator(false)
|
||||
})
|
||||
var validatorSkipMissing = lazy.New(func() (*crd.Validator, error) {
|
||||
return newAgentgatewayValidator(true)
|
||||
})
|
||||
|
||||
func NewAgentgatewayValidator(t *testing.T) *crd.Validator {
|
||||
v, err := validator.Get()
|
||||
assert.NoError(t, err)
|
||||
return v
|
||||
}
|
||||
|
||||
func NewAgentgatewayValidatorSkipMissing(t *testing.T) *crd.Validator {
|
||||
v, err := validatorSkipMissing.Get()
|
||||
assert.NoError(t, err)
|
||||
return v
|
||||
}
|
||||
|
||||
func newAgentgatewayValidator(skipMissing bool) (*crd.Validator, error) {
|
||||
func NewKgatewayValidator(t *testing.T) *crd.Validator {
|
||||
root := fsutils.GetModuleRoot()
|
||||
dirs := []string{}
|
||||
agentgatewayDir, err := os.ReadDir(filepath.Join(root, "controller/install/helm/agentgateway-crds/templates/"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
assert.NoError(t, err)
|
||||
for _, d := range agentgatewayDir {
|
||||
if strings.HasSuffix(d.Name(), ".yaml") {
|
||||
dirs = append(dirs, filepath.Join(root, "controller/install/helm/agentgateway-crds/templates", d.Name()))
|
||||
@ -48,8 +26,7 @@ func newAgentgatewayValidator(skipMissing bool) (*crd.Validator, error) {
|
||||
dirs...,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
t.Fatal(err)
|
||||
}
|
||||
v.SkipMissing = skipMissing
|
||||
return v, nil
|
||||
return v
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package agentgateway
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
)
|
||||
@ -121,35 +120,33 @@ type StaticBackend struct {
|
||||
// AIBackend specifies the AI backend configuration
|
||||
// +kubebuilder:validation:ExactlyOneOf=provider;groups
|
||||
type AIBackend struct {
|
||||
// `provider` specifies configuration for how to reach the configured LLM
|
||||
// provider.
|
||||
// provider specifies configuration for how to reach the configured LLM provider.
|
||||
// +optional
|
||||
LLM *LLMProvider `json:"provider,omitempty"`
|
||||
|
||||
// `groups` specifies a list of groups in priority order where each group
|
||||
// defines a set of LLM providers. The priority determines the priority of
|
||||
// the backend endpoints chosen.
|
||||
// Note: provider names must be unique across all providers in all priority
|
||||
// groups. Backend policies may target a specific provider by name using
|
||||
// `targetRefs[].sectionName`.
|
||||
// groups specifies a list of groups in priority order where each group defines
|
||||
// a set of LLM providers. The priority determines the priority of the backend endpoints chosen.
|
||||
// Note: provider names must be unique across all providers in all priority groups. Backend policies
|
||||
// may target a specific provider by name using targetRefs[].sectionName.
|
||||
//
|
||||
// Example configuration with two priority groups:
|
||||
//
|
||||
// groups:
|
||||
// - providers:
|
||||
// - azureopenai:
|
||||
// deploymentName: gpt-4o-mini
|
||||
// apiVersion: 2024-02-15-preview
|
||||
// endpoint: ai-gateway.openai.azure.com
|
||||
// - providers:
|
||||
// - azureopenai:
|
||||
// deploymentName: gpt-4o-mini-2
|
||||
// apiVersion: 2024-02-15-preview
|
||||
// endpoint: ai-gateway-2.openai.azure.com
|
||||
// policies:
|
||||
// auth:
|
||||
// secretRef:
|
||||
// name: azure-secret
|
||||
// ```yaml
|
||||
// groups:
|
||||
// - providers:
|
||||
// - azureopenai:
|
||||
// deploymentName: gpt-4o-mini
|
||||
// apiVersion: 2024-02-15-preview
|
||||
// endpoint: ai-gateway.openai.azure.com
|
||||
// - providers:
|
||||
// - azureopenai:
|
||||
// deploymentName: gpt-4o-mini-2
|
||||
// apiVersion: 2024-02-15-preview
|
||||
// endpoint: ai-gateway-2.openai.azure.com
|
||||
// policies:
|
||||
// auth:
|
||||
// secretRef:
|
||||
// name: azure-secret
|
||||
// ```
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
// +kubebuilder:validation:MaxItems=8
|
||||
// +optional
|
||||
@ -173,11 +170,9 @@ type NamedLLMProvider struct {
|
||||
// +required
|
||||
Name gwv1.SectionName `json:"name"`
|
||||
|
||||
// `policies` controls policies for communicating with this backend.
|
||||
// Policies may also be set in `AgentgatewayPolicy`, or in the top-level
|
||||
// `AgentgatewayBackend`. Policies are merged on a field-level basis, with
|
||||
// order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend`
|
||||
// LLM provider (this field).
|
||||
// policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
|
||||
// in the top level AgentgatewayBackend. policies are merged on a field-level basis, with order: AgentgatewayPolicy <
|
||||
// AgentgatewayBackend < AgentgatewayBackend LLM provider (this field).
|
||||
// +optional
|
||||
Policies *BackendWithAI `json:"policies,omitempty"`
|
||||
|
||||
@ -187,8 +182,6 @@ type NamedLLMProvider struct {
|
||||
// LLMProvider specifies the target large language model provider that the backend should route requests to.
|
||||
// +kubebuilder:validation:ExactlyOneOf=openai;azureopenai;anthropic;gemini;vertexai;bedrock
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.host) || has(self.port) ? has(self.host) && has(self.port) : true",message="both host and port must be set together"
|
||||
// +kubebuilder:validation:XValidation:rule="!(has(self.path) && has(self.pathPrefix))",message="path and pathPrefix are mutually exclusive"
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.pathPrefix) ? has(self.host) : true",message="pathPrefix requires host to be set"
|
||||
type LLMProvider struct {
|
||||
// OpenAI provider
|
||||
// +optional
|
||||
@ -231,12 +224,6 @@ type LLMProvider struct {
|
||||
// If not specified, the default path for the provider is used.
|
||||
// +optional
|
||||
Path LongString `json:"path,omitempty"`
|
||||
|
||||
// PathPrefix overrides the default base path prefix (e.g. "/v1") for upstream requests.
|
||||
// Path translation for cross-format requests still applies using this prefix.
|
||||
// Only supported for OpenAI and Anthropic providers.
|
||||
// +optional
|
||||
PathPrefix LongString `json:"pathPrefix,omitempty"`
|
||||
}
|
||||
|
||||
// OpenAIConfig settings for the [OpenAI](https://developers.openai.com/api/docs/guides/streaming-responses) LLM provider.
|
||||
@ -257,14 +244,13 @@ type AzureOpenAIConfig struct {
|
||||
|
||||
// The name of the Azure OpenAI model deployment to use.
|
||||
// For more information, see the [Azure OpenAI model docs](https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/concepts/models-sold-directly-by-azure?view=foundry-classic).
|
||||
// This is required if `apiVersion` is not `v1`. For `v1`, the model can be
|
||||
// set in the request.
|
||||
// This is required if ApiVersion is not 'v1'. For v1, the model can be set in the request.
|
||||
// +optional
|
||||
DeploymentName *ShortString `json:"deploymentName,omitempty"`
|
||||
|
||||
// The version of the Azure OpenAI API to use.
|
||||
// For more information, see the [Azure OpenAI API version reference](https://learn.microsoft.com/en-us/azure/ai-foundry/?view=foundry-classicreference#api-specs).
|
||||
// If unset, defaults to `v1`.
|
||||
// If unset, defaults to "v1"
|
||||
// +optional
|
||||
ApiVersion *TinyString `json:"apiVersion,omitempty"`
|
||||
}
|
||||
@ -289,10 +275,8 @@ type VertexAIConfig struct {
|
||||
ProjectId TinyString `json:"projectId"`
|
||||
|
||||
// The location of the Google Cloud Project that you use for the Vertex AI.
|
||||
// Defaults to `global` if not specified.
|
||||
// +optional
|
||||
// +kubebuilder:default=global
|
||||
Region TinyString `json:"region,omitempty"`
|
||||
// +required
|
||||
Region TinyString `json:"region"`
|
||||
}
|
||||
|
||||
// AnthropicConfig settings for the [Anthropic](https://platform.claude.com/docs/en/release-notes/overview) LLM provider.
|
||||
@ -305,7 +289,7 @@ type AnthropicConfig struct {
|
||||
|
||||
type BedrockConfig struct {
|
||||
// Region is the AWS region to use for the backend.
|
||||
// Defaults to `us-east-1` if not specified.
|
||||
// Defaults to us-east-1 if not specified.
|
||||
// +optional
|
||||
// +kubebuilder:default=us-east-1
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
@ -318,8 +302,7 @@ type BedrockConfig struct {
|
||||
// +optional
|
||||
Model *ShortString `json:"model,omitempty"`
|
||||
|
||||
// `guardrail` configures the Guardrail policy to use for the backend. See
|
||||
// <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>.
|
||||
// Guardrail configures the Guardrail policy to use for the backend. See <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>
|
||||
// If not specified, the AWS Guardrail policy will not be used.
|
||||
// +optional
|
||||
Guardrail *AWSGuardrailConfig `json:"guardrail,omitempty"`
|
||||
@ -335,12 +318,11 @@ type AWSGuardrailConfig struct {
|
||||
GuardrailVersion ShortString `json:"version"`
|
||||
}
|
||||
|
||||
// MCPBackend configures `mcp` backends.
|
||||
// MCPBackend configures mcp backends
|
||||
type MCPBackend struct {
|
||||
// `targets` is a list of MCP targets to use for this backend. Policies
|
||||
// targeting MCP targets must use `targetRefs[].sectionName` to select
|
||||
// the target by name.
|
||||
//
|
||||
// Targets is a list of MCPBackend targets to use for this backend.
|
||||
// Policies targeting MCPBackend targets must use targetRefs[].sectionName
|
||||
// to select the target by name.
|
||||
// +listType=map
|
||||
// +listMapKey=name
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
@ -349,52 +331,32 @@ type MCPBackend struct {
|
||||
// +required
|
||||
Targets []McpTargetSelector `json:"targets"`
|
||||
|
||||
// `sessionRouting` configures MCP session behavior for requests.
|
||||
// Defaults to `Stateful` if not set.
|
||||
// SessionRouting configures MCP session behavior for requests.
|
||||
// Defaults to Stateful if not set.
|
||||
// +optional
|
||||
SessionRouting SessionRouting `json:"sessionRouting,omitempty"`
|
||||
|
||||
// `failureMode` controls behavior when MCP targets fail to initialize or
|
||||
// become unavailable at runtime. `FailOpen` skips failed targets and
|
||||
// continues serving from healthy ones. `FailClosed` (default) fails the
|
||||
// entire session if any target fails.
|
||||
// +optional
|
||||
FailureMode FailureMode `json:"failureMode,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// FailClosed fails the entire MCP session if any target fails.
|
||||
FailClosed FailureMode = "FailClosed"
|
||||
// FailOpen skips failed targets and continues serving from healthy ones.
|
||||
FailOpen FailureMode = "FailOpen"
|
||||
)
|
||||
|
||||
// +kubebuilder:validation:Enum=FailOpen;FailClosed
|
||||
type FailureMode string
|
||||
|
||||
// McpTargetSelector defines the MCPBackend target to use for this backend.
|
||||
// +kubebuilder:validation:ExactlyOneOf=selector;static
|
||||
type McpTargetSelector struct {
|
||||
// Name of the MCP target.
|
||||
// Name of the MCPBackend target.
|
||||
// +required
|
||||
Name gwv1.SectionName `json:"name"`
|
||||
|
||||
// `selector` is the label selector used to select `Service` resources.
|
||||
// If policies are needed on a per-service basis, `AgentgatewayPolicy` can
|
||||
// target the desired `Service`.
|
||||
// selector is a label selector is the selector to use to select Services.
|
||||
// If policies are needed on a per-service basis, AgentgatewayPolicy can target the desired Service.
|
||||
// +optional
|
||||
Selector *McpSelector `json:"selector,omitempty"`
|
||||
|
||||
// `static` configures a static MCP destination. When connecting to
|
||||
// in-cluster `Service` resources, it is recommended to use `selector`
|
||||
// instead.
|
||||
// static configures a static MCP destination. When connecting to in-cluster Services, it is recommended to use
|
||||
// 'selector' instead.
|
||||
// +optional
|
||||
Static *McpTarget `json:"static,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// `Stateful` mode creates an MCP session (via `mcp-session-id`) and
|
||||
// internally
|
||||
// Stateful mode creates an MCP session (via mcp-session-id) and internally
|
||||
// ensures requests for that session are routed to a consistent backend replica.
|
||||
Stateful SessionRouting = "Stateful"
|
||||
Stateless SessionRouting = "Stateless"
|
||||
@ -405,69 +367,53 @@ type SessionRouting string
|
||||
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type McpSelector struct {
|
||||
// `namespace` is the label selector for namespaces that `Service`
|
||||
// resources should be selected from. If unset, only the namespace of the
|
||||
// `AgentgatewayBackend` is searched.
|
||||
// namespace is the label selector in which namespaces Services should be selected from.
|
||||
// If unset, only the namespace of the AgentgatewayBackend is searched.
|
||||
// +optional
|
||||
Namespace *metav1.LabelSelector `json:"namespaces,omitempty"`
|
||||
|
||||
// `services` is the label selector for which `Service` resources should be
|
||||
// selected.
|
||||
// services is the label selector for which Services should be selected.
|
||||
// +optional
|
||||
Service *metav1.LabelSelector `json:"services,omitempty"`
|
||||
}
|
||||
|
||||
// McpTarget defines a single MCPBackend target configuration.
|
||||
// +kubebuilder:validation:ExactlyOneOf=host;backendRef
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.backendRef) || !has(self.policies)",message="mcp target policies may not be used with backendRef"
|
||||
type McpTarget struct {
|
||||
// Host is the hostname or IP address of the MCP target.
|
||||
// +optional
|
||||
Host *ShortString `json:"host,omitempty"`
|
||||
// Host is the hostname or IP address of the MCPBackend target.
|
||||
// +required
|
||||
Host ShortString `json:"host"`
|
||||
|
||||
// `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.
|
||||
// Port is the port number of the MCPBackend target.
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
// +required
|
||||
Port int32 `json:"port"`
|
||||
|
||||
// Path is the URL path of the MCP target endpoint.
|
||||
// Defaults to `"/sse"` for the `SSE` protocol or `"/mcp"` for the
|
||||
// `StreamableHTTP` protocol if not specified.
|
||||
// Path is the URL path of the MCPBackend target endpoint.
|
||||
// Defaults to "/sse" for SSE protocol or "/mcp" for StreamableHTTP protocol if not specified.
|
||||
// +optional
|
||||
Path *LongString `json:"path,omitempty"`
|
||||
|
||||
// Protocol is the protocol to use for the connection to the MCP
|
||||
// target.
|
||||
// Protocol is the protocol to use for the connection to the MCPBackend target.
|
||||
// +optional
|
||||
Protocol *MCPProtocol `json:"protocol,omitempty"`
|
||||
|
||||
// `policies` controls policies for communicating with this backend.
|
||||
// Policies may also be set in `AgentgatewayPolicy`, or in the top-level
|
||||
// `AgentgatewayBackend`. Policies are merged on a field-level basis, with
|
||||
// order: `AgentgatewayPolicy` < `AgentgatewayBackend` < `AgentgatewayBackend` MCP (this field).
|
||||
// This field may only be used with host-based static targets, not
|
||||
// `backendRef`.
|
||||
// policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
|
||||
// in the top level AgentgatewayBackend. Policies are merged on a field-level basis, with order: AgentgatewayPolicy <
|
||||
// AgentgatewayBackend < AgentgatewayBackend MCP (this field).
|
||||
// +optional
|
||||
Policies *BackendSimple `json:"policies,omitempty"`
|
||||
Policies *BackendWithMCP `json:"policies,omitempty"`
|
||||
}
|
||||
|
||||
// MCPProtocol defines the protocol to use for the `MCPBackend` target.
|
||||
// MCPProtocol defines the protocol to use for the MCPBackend target
|
||||
// +kubebuilder:validation:Enum=StreamableHTTP;SSE
|
||||
type MCPProtocol string
|
||||
|
||||
const (
|
||||
// MCPProtocolStreamableHTTP specifies that `StreamableHTTP` must be used as
|
||||
// the protocol.
|
||||
|
||||
// MCPProtocolStreamableHTTP specifies Streamable HTTP must be used as the protocol
|
||||
MCPProtocolStreamableHTTP MCPProtocol = "StreamableHTTP"
|
||||
|
||||
// MCPProtocolSSE specifies that Server-Sent Events (`SSE`) must be used as
|
||||
// the protocol.
|
||||
// MCPProtocolSSE specifies Server-Sent Events (SSE) must be used as the protocol
|
||||
MCPProtocolSSE MCPProtocol = "SSE"
|
||||
)
|
||||
|
||||
@ -64,9 +64,9 @@ const (
|
||||
)
|
||||
|
||||
type AgentgatewayParametersLogging struct {
|
||||
// Logging level in standard `RUST_LOG` syntax, for example `info` (the
|
||||
// default), or a comma-separated per-module setting such as
|
||||
// `rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn`.
|
||||
// Logging level in standard RUST_LOG syntax, e.g. 'info', the default, or
|
||||
// by module, comma-separated. E.g.,
|
||||
// "rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn"
|
||||
// +optional
|
||||
Level string `json:"level,omitempty"`
|
||||
// +optional
|
||||
@ -74,16 +74,16 @@ type AgentgatewayParametersLogging struct {
|
||||
}
|
||||
|
||||
type AgentgatewayParametersConfigs struct {
|
||||
// `logging` configuration for Agentgateway. By default, all logs are set to
|
||||
// `info` level.
|
||||
// logging configuration for Agentgateway. By default, all logs are set to "info" level.
|
||||
// +optional
|
||||
Logging *AgentgatewayParametersLogging `json:"logging,omitempty"`
|
||||
|
||||
// `rawConfig` provides an opaque mechanism to configure the `agentgateway`
|
||||
// config file. The `agentgateway` binary has a `-f` option to specify a
|
||||
// config file, and this field supplies that file. This will be merged with
|
||||
// configuration derived from typed fields like `logging.format`, and those
|
||||
// typed fields will take precedence.
|
||||
// rawConfig provides an opaque mechanism to configure the agentgateway
|
||||
// config file (the agentgateway binary has a '-f' option to specify a
|
||||
// config file, and this is that file). This will be merged with
|
||||
// configuration derived from typed fields like
|
||||
// AgentgatewayParametersLogging.Format, and those typed fields will take
|
||||
// precedence.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
@ -95,11 +95,11 @@ type AgentgatewayParametersConfigs struct {
|
||||
// - policies:
|
||||
// cors:
|
||||
// allowOrigins:
|
||||
// - "*"
|
||||
// - "*"
|
||||
// allowHeaders:
|
||||
// - mcp-protocol-version
|
||||
// - content-type
|
||||
// - cache-control
|
||||
// - mcp-protocol-version
|
||||
// - content-type
|
||||
// - cache-control
|
||||
// backends:
|
||||
// - mcp:
|
||||
// targets:
|
||||
@ -129,17 +129,14 @@ type AgentgatewayParametersConfigs struct {
|
||||
|
||||
// The container environment variables. These override any existing
|
||||
// values. If you want to delete an environment variable entirely, use
|
||||
// `$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
|
||||
// `$patch: delete` with AgentgatewayParametersOverlays instead. Note that
|
||||
// [variable
|
||||
// expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
|
||||
// does apply, but is highly discouraged -- to set dependent environment
|
||||
// variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
|
||||
// `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
// variables, you can use $(VAR_NAME), but it's highly
|
||||
// discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
// `$(VAR_NAME)`.
|
||||
//
|
||||
// If `SESSION_KEY` is specified, it takes precedence over the
|
||||
// controller-managed per-`Gateway` session key `Secret`.
|
||||
//
|
||||
// +optional
|
||||
Env []corev1.EnvVar `json:"env,omitempty"`
|
||||
|
||||
@ -150,11 +147,10 @@ type AgentgatewayParametersConfigs struct {
|
||||
// +optional
|
||||
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
|
||||
|
||||
// Shutdown delay configuration. How graceful planned or unplanned data
|
||||
// Shutdown delay configuration. How graceful planned or unplanned data
|
||||
// plane changes happen is in tension with how quickly rollouts of the data
|
||||
// plane complete. How long a data plane pod must wait for shutdown to be
|
||||
// perfectly graceful depends on how you have configured your `Gateway`
|
||||
// resources.
|
||||
// perfectly graceful depends on how you have configured your Gateways.
|
||||
//
|
||||
// +optional
|
||||
Shutdown *ShutdownSpec `json:"shutdown,omitempty"`
|
||||
@ -179,8 +175,8 @@ type IstioSpec struct {
|
||||
// +kubebuilder:validation:XValidation:rule="self.min <= self.max",message="The 'min' value must be less than or equal to the 'max' value."
|
||||
type ShutdownSpec struct {
|
||||
// Minimum time (in seconds) to wait before allowing Agentgateway to
|
||||
// terminate. Refer to the `CONNECTION_MIN_TERMINATION_DEADLINE`
|
||||
// environment variable for details.
|
||||
// terminate. Refer to the CONNECTION_MIN_TERMINATION_DEADLINE environment
|
||||
// variable for details.
|
||||
//
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
@ -188,8 +184,8 @@ type ShutdownSpec struct {
|
||||
Min int64 `json:"min"`
|
||||
|
||||
// Maximum time (in seconds) to wait before allowing Agentgateway to
|
||||
// terminate. Refer to the `TERMINATION_GRACE_PERIOD_SECONDS`
|
||||
// environment variable for details.
|
||||
// terminate. Refer to the TERMINATION_GRACE_PERIOD_SECONDS environment
|
||||
// variable for details.
|
||||
//
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
@ -198,34 +194,29 @@ type ShutdownSpec struct {
|
||||
}
|
||||
|
||||
type AgentgatewayParametersOverlays struct {
|
||||
// `deployment` allows specifying overrides for the generated
|
||||
// `Deployment` resource.
|
||||
// deployment allows specifying overrides for the generated Deployment resource.
|
||||
// +optional
|
||||
Deployment *shared.KubernetesResourceOverlay `json:"deployment,omitempty"`
|
||||
|
||||
// `service` allows specifying overrides for the generated `Service`
|
||||
// resource.
|
||||
// service allows specifying overrides for the generated Service resource.
|
||||
// +optional
|
||||
Service *shared.KubernetesResourceOverlay `json:"service,omitempty"`
|
||||
|
||||
// `serviceAccount` allows specifying overrides for the generated
|
||||
// `ServiceAccount` resource.
|
||||
// serviceAccount allows specifying overrides for the generated ServiceAccount resource.
|
||||
// +optional
|
||||
ServiceAccount *shared.KubernetesResourceOverlay `json:"serviceAccount,omitempty"`
|
||||
|
||||
// `podDisruptionBudget` allows creating a `PodDisruptionBudget` for the
|
||||
// agentgateway proxy. If absent, no PDB is created. If present, a PDB is
|
||||
// created with its selector automatically configured to target the
|
||||
// agentgateway proxy `Deployment`. The `metadata` and `spec` fields from
|
||||
// this overlay are applied to the generated PDB.
|
||||
// podDisruptionBudget allows creating a PodDisruptionBudget for the agentgateway proxy.
|
||||
// If absent, no PDB is created. If present, a PDB is created with its selector
|
||||
// automatically configured to target the agentgateway proxy Deployment.
|
||||
// The metadata and spec fields from this overlay are applied to the generated PDB.
|
||||
// +optional
|
||||
PodDisruptionBudget *shared.KubernetesResourceOverlay `json:"podDisruptionBudget,omitempty"`
|
||||
|
||||
// `horizontalPodAutoscaler` allows creating a `HorizontalPodAutoscaler`
|
||||
// for the agentgateway proxy. If absent, no HPA is created. If present, an
|
||||
// HPA is created with its `scaleTargetRef` automatically configured to
|
||||
// target the agentgateway proxy `Deployment`. The `metadata` and `spec`
|
||||
// fields from this overlay are applied to the generated HPA.
|
||||
// horizontalPodAutoscaler allows creating a HorizontalPodAutoscaler for the agentgateway proxy.
|
||||
// If absent, no HPA is created. If present, an HPA is created with its scaleTargetRef
|
||||
// automatically configured to target the agentgateway proxy Deployment.
|
||||
// The metadata and spec fields from this overlay are applied to the generated HPA.
|
||||
// +optional
|
||||
HorizontalPodAutoscaler *shared.KubernetesResourceOverlay `json:"horizontalPodAutoscaler,omitempty"`
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,15 +12,13 @@ import (
|
||||
// Prompt enrichment allows you to add additional context to the prompt before sending it to the model.
|
||||
// Unlike RAG or other dynamic context methods, prompt enrichment is static and is applied to every request.
|
||||
//
|
||||
// **Note**: Some providers, including Anthropic, do not support `SYSTEM`
|
||||
// role messages, and instead have a dedicated `system` field in the input
|
||||
// JSON. In this case, use the [`defaults` setting](#fielddefault) to set the
|
||||
// `system` field.
|
||||
// **Note**: Some providers, including Anthropic, do not support SYSTEM role messages, and instead have a dedicated
|
||||
// system field in the input JSON. In this case, use the [`defaults` setting](#fielddefault) to set the system field.
|
||||
//
|
||||
// The following example prepends a system prompt of
|
||||
// `Answer all questions in French.` and appends
|
||||
// `Describe the painting as if you were a famous art critic from the 17th century.`
|
||||
// to each request that is sent to the `openai` `HTTPRoute`.
|
||||
// The following example prepends a system prompt of `Answer all questions in French.`
|
||||
// and appends `Describe the painting as if you were a famous art critic from the 17th century.`
|
||||
// to each request that is sent to the `openai` HTTPRoute.
|
||||
// ```yaml
|
||||
//
|
||||
// name: openai-opt
|
||||
// namespace: agentgateway-system
|
||||
@ -39,6 +37,8 @@ import (
|
||||
// append:
|
||||
// - role: USER
|
||||
// content: "Describe the painting as if you were a famous art critic from the 17th century."
|
||||
//
|
||||
// ```
|
||||
type AIPromptEnrichment struct {
|
||||
// A list of messages to be prepended to the prompt sent by the client.
|
||||
// +optional
|
||||
@ -61,7 +61,7 @@ type Message struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// Built-in regex patterns for specific types of strings in prompts.
|
||||
// BuiltIn regex patterns for specific types of strings in prompts.
|
||||
// For example, if you specify `CreditCard`, any credit card numbers
|
||||
// in the request or response are matched.
|
||||
// +kubebuilder:validation:Enum=Ssn;CreditCard;PhoneNumber;Email;CaSin
|
||||
@ -85,8 +85,7 @@ const (
|
||||
)
|
||||
|
||||
// Action to take if a regex pattern is matched in a request or response.
|
||||
// This setting applies only to request matches. `PromptguardResponse`
|
||||
// matches are always masked by default.
|
||||
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
|
||||
// +kubebuilder:validation:Enum=Mask;Reject
|
||||
type Action string
|
||||
|
||||
@ -111,8 +110,7 @@ type Regex struct {
|
||||
Builtins []BuiltIn `json:"builtins,omitempty"`
|
||||
|
||||
// The action to take if a regex pattern is matched in a request or response.
|
||||
// This setting applies only to request matches. `PromptguardResponse`
|
||||
// matches are always masked by default.
|
||||
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
|
||||
// Defaults to `Mask`.
|
||||
// +kubebuilder:default=Mask
|
||||
// +optional
|
||||
@ -141,7 +139,7 @@ type Webhook struct {
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type CustomResponse struct {
|
||||
// A custom response message to return to the client. If not specified, defaults to
|
||||
// `The request was rejected due to inappropriate content`.
|
||||
// "The request was rejected due to inappropriate content".
|
||||
// +kubebuilder:default="The request was rejected due to inappropriate content"
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
@ -155,8 +153,7 @@ type CustomResponse struct {
|
||||
}
|
||||
|
||||
type OpenAIModeration struct {
|
||||
// `model` specifies the moderation model to use. For example,
|
||||
// `omni-moderation`.
|
||||
// model specifies the moderation model to use. For example, `omni-moderation`.
|
||||
// +optional
|
||||
Model *string `json:"model,omitempty"`
|
||||
// policies controls policies for communicating with OpenAI.
|
||||
@ -174,8 +171,7 @@ type BedrockGuardrails struct {
|
||||
// +required
|
||||
GuardrailVersion ShortString `json:"version"`
|
||||
|
||||
// Region is the AWS region where the guardrail is deployed (for example,
|
||||
// `us-west-2`).
|
||||
// Region is the AWS region where the guardrail is deployed (e.g., "us-west-2").
|
||||
// +required
|
||||
Region ShortString `json:"region"`
|
||||
|
||||
@ -194,8 +190,8 @@ type GoogleModelArmor struct {
|
||||
// +required
|
||||
ProjectID ShortString `json:"projectId"`
|
||||
|
||||
// Location is the Google Cloud location (for example, `us-central1`).
|
||||
// Defaults to `us-central1` if not specified.
|
||||
// Location is the Google Cloud location (e.g., "us-central1").
|
||||
// Defaults to "us-central1" if not specified.
|
||||
// +kubebuilder:default="us-central1"
|
||||
// +optional
|
||||
Location *ShortString `json:"location,omitempty"`
|
||||
@ -210,7 +206,7 @@ type GoogleModelArmor struct {
|
||||
// +kubebuilder:validation:ExactlyOneOf=regex;webhook;openAIModeration;bedrockGuardrails;googleModelArmor
|
||||
type PromptguardRequest struct {
|
||||
// A custom response message to return to the client. If not specified, defaults to
|
||||
// `The request was rejected due to inappropriate content`.
|
||||
// "The request was rejected due to inappropriate content".
|
||||
// +optional
|
||||
CustomResponse *CustomResponse `json:"response,omitempty"`
|
||||
|
||||
@ -222,18 +218,16 @@ type PromptguardRequest struct {
|
||||
// +optional
|
||||
Webhook *Webhook `json:"webhook,omitempty"`
|
||||
|
||||
// `openAIModeration` passes prompt data through the OpenAI Moderations
|
||||
// endpoint.
|
||||
// openAIModeration passes prompt data through the OpenAI Moderations endpoint.
|
||||
// See https://developers.openai.com/api/reference/resources/moderations for more information.
|
||||
// +optional
|
||||
OpenAIModeration *OpenAIModeration `json:"openAIModeration,omitempty"`
|
||||
|
||||
// `bedrockGuardrails` configures AWS Bedrock Guardrails for prompt
|
||||
// guarding.
|
||||
// bedrockGuardrails configures AWS Bedrock Guardrails for prompt guarding.
|
||||
// +optional
|
||||
BedrockGuardrails *BedrockGuardrails `json:"bedrockGuardrails,omitempty"`
|
||||
|
||||
// `googleModelArmor` configures Google Model Armor for prompt guarding.
|
||||
// googleModelArmor configures Google Model Armor for prompt guarding.
|
||||
// +optional
|
||||
GoogleModelArmor *GoogleModelArmor `json:"googleModelArmor,omitempty"`
|
||||
}
|
||||
@ -242,7 +236,7 @@ type PromptguardRequest struct {
|
||||
// +kubebuilder:validation:ExactlyOneOf=regex;webhook;bedrockGuardrails;googleModelArmor
|
||||
type PromptguardResponse struct {
|
||||
// A custom response message to return to the client. If not specified, defaults to
|
||||
// `The response was rejected due to inappropriate content`.
|
||||
// "The response was rejected due to inappropriate content".
|
||||
// +optional
|
||||
CustomResponse *CustomResponse `json:"response,omitempty"`
|
||||
|
||||
@ -254,12 +248,11 @@ type PromptguardResponse struct {
|
||||
// +optional
|
||||
Webhook *Webhook `json:"webhook,omitempty"`
|
||||
|
||||
// `bedrockGuardrails` configures AWS Bedrock Guardrails for prompt
|
||||
// guarding.
|
||||
// bedrockGuardrails configures AWS Bedrock Guardrails for prompt guarding.
|
||||
// +optional
|
||||
BedrockGuardrails *BedrockGuardrails `json:"bedrockGuardrails,omitempty"`
|
||||
|
||||
// `googleModelArmor` configures Google Model Armor for prompt guarding.
|
||||
// googleModelArmor configures Google Model Armor for prompt guarding.
|
||||
// +optional
|
||||
GoogleModelArmor *GoogleModelArmor `json:"googleModelArmor,omitempty"`
|
||||
}
|
||||
@ -270,22 +263,24 @@ type PromptguardResponse struct {
|
||||
//
|
||||
// This example rejects any request prompts that contain
|
||||
// the string "credit card", and masks any credit card numbers in the response.
|
||||
// ```yaml
|
||||
// promptGuard:
|
||||
//
|
||||
// promptGuard:
|
||||
// request:
|
||||
// - response:
|
||||
// message: "Rejected due to inappropriate content"
|
||||
// regex:
|
||||
// action: REJECT
|
||||
// matches:
|
||||
// - pattern: "credit card"
|
||||
// name: "CC"
|
||||
// response:
|
||||
// - regex:
|
||||
// builtins:
|
||||
// - CREDIT_CARD
|
||||
// action: MASK
|
||||
// request:
|
||||
// - response:
|
||||
// message: "Rejected due to inappropriate content"
|
||||
// regex:
|
||||
// action: REJECT
|
||||
// matches:
|
||||
// - pattern: "credit card"
|
||||
// name: "CC"
|
||||
// response:
|
||||
// - regex:
|
||||
// builtins:
|
||||
// - CREDIT_CARD
|
||||
// action: MASK
|
||||
//
|
||||
// ```
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type AIPromptGuard struct {
|
||||
// Prompt guards to apply to requests sent by the client.
|
||||
@ -308,29 +303,35 @@ type AIPromptGuard struct {
|
||||
// Defaults set here do _not_ override those user-provided values unless you explicitly set `override` to `true`.
|
||||
//
|
||||
// Example: Setting a default system field for Anthropic, which does not support system role messages:
|
||||
// ```yaml
|
||||
// defaults:
|
||||
// - field: "system"
|
||||
// value: "answer all questions in French"
|
||||
//
|
||||
// defaults:
|
||||
// - field: "system"
|
||||
// value: "answer all questions in French"
|
||||
// ```
|
||||
//
|
||||
// Example: Setting a default temperature and overriding `max_tokens`:
|
||||
// ```yaml
|
||||
// defaults:
|
||||
// - field: "temperature"
|
||||
// value: "0.5"
|
||||
// - field: "max_tokens"
|
||||
// value: "100"
|
||||
// override: true
|
||||
//
|
||||
// defaults:
|
||||
// - field: "temperature"
|
||||
// value: "0.5"
|
||||
// - field: "max_tokens"
|
||||
// value: "100"
|
||||
// override: true
|
||||
// ```
|
||||
//
|
||||
// Example: Setting custom lists fields:
|
||||
// ```yaml
|
||||
// defaults:
|
||||
// - field: "custom_integer_list"
|
||||
// value: [1,2,3]
|
||||
//
|
||||
// defaults:
|
||||
// - field: "custom_integer_list"
|
||||
// value: [1,2,3]
|
||||
// overrides:
|
||||
// - field: "custom_string_list"
|
||||
// value: ["one","two","three"]
|
||||
//
|
||||
// overrides:
|
||||
// - field: "custom_string_list"
|
||||
// value: ["one","two","three"]
|
||||
// ```
|
||||
//
|
||||
// Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD.
|
||||
type FieldDefault struct {
|
||||
@ -368,9 +369,10 @@ type FieldTransformation struct {
|
||||
// Example:
|
||||
//
|
||||
// promptCaching:
|
||||
// cacheSystem: true
|
||||
// cacheMessages: true
|
||||
// cacheTools: false
|
||||
// cacheSystem: true # Cache system prompts
|
||||
// cacheMessages: true # Cache conversation history
|
||||
// cacheTools: false # Don't cache tool definitions
|
||||
// minTokens: 1024 # Only cache if ≥1024 tokens
|
||||
//
|
||||
// Cost savings example:
|
||||
// - Without caching: 10,000 tokens × $3/MTok = $0.03
|
||||
@ -401,13 +403,4 @@ type PromptCachingConfig struct {
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:default=1024
|
||||
MinTokens int `json:"minTokens,omitempty"`
|
||||
|
||||
// CacheMessageOffset shifts the message cache point further back in the
|
||||
// conversation. 0 (default) places it at the second-to-last message.
|
||||
// Higher values move it N additional messages towards the start, clamped
|
||||
// to bounds.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:default=0
|
||||
CacheMessageOffset int `json:"cacheMessageOffset,omitempty"`
|
||||
}
|
||||
|
||||
@ -147,11 +147,6 @@ func (in *AccessLog) DeepCopyInto(out *AccessLog) {
|
||||
*out = new(LogTracingAttributes)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Otlp != nil {
|
||||
in, out := &in.Otlp, &out.Otlp
|
||||
*out = new(OtlpAccessLog)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessLog.
|
||||
@ -954,21 +949,6 @@ func (in *BackendEviction) DeepCopyInto(out *BackendEviction) {
|
||||
*out = new(v1.Duration)
|
||||
**out = **in
|
||||
}
|
||||
if in.RestoreHealth != nil {
|
||||
in, out := &in.RestoreHealth, &out.RestoreHealth
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.ConsecutiveFailures != nil {
|
||||
in, out := &in.ConsecutiveFailures, &out.ConsecutiveFailures
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.HealthThreshold != nil {
|
||||
in, out := &in.HealthThreshold, &out.HealthThreshold
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendEviction.
|
||||
@ -1075,11 +1055,6 @@ func (in *BackendSimple) DeepCopyInto(out *BackendSimple) {
|
||||
*out = new(BackendHTTP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Tunnel != nil {
|
||||
in, out := &in.Tunnel, &out.Tunnel
|
||||
*out = new(BackendTunnel)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Transformation != nil {
|
||||
in, out := &in.Transformation, &out.Transformation
|
||||
*out = new(Transformation)
|
||||
@ -1181,22 +1156,6 @@ func (in *BackendTLS) DeepCopy() *BackendTLS {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackendTunnel) DeepCopyInto(out *BackendTunnel) {
|
||||
*out = *in
|
||||
in.BackendRef.DeepCopyInto(&out.BackendRef)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTunnel.
|
||||
func (in *BackendTunnel) DeepCopy() *BackendTunnel {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BackendTunnel)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackendWithAI) DeepCopyInto(out *BackendWithAI) {
|
||||
*out = *in
|
||||
@ -1218,6 +1177,27 @@ func (in *BackendWithAI) DeepCopy() *BackendWithAI {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackendWithMCP) DeepCopyInto(out *BackendWithMCP) {
|
||||
*out = *in
|
||||
in.BackendSimple.DeepCopyInto(&out.BackendSimple)
|
||||
if in.MCP != nil {
|
||||
in, out := &in.MCP, &out.MCP
|
||||
*out = new(BackendMCP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendWithMCP.
|
||||
func (in *BackendWithMCP) DeepCopy() *BackendWithMCP {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BackendWithMCP)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BasicAuthentication) DeepCopyInto(out *BasicAuthentication) {
|
||||
*out = *in
|
||||
@ -1484,11 +1464,6 @@ func (in *Frontend) DeepCopyInto(out *Frontend) {
|
||||
*out = new(FrontendTCP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.NetworkAuthorization != nil {
|
||||
in, out := &in.NetworkAuthorization, &out.NetworkAuthorization
|
||||
*out = new(shared.Authorization)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.TLS != nil {
|
||||
in, out := &in.TLS, &out.TLS
|
||||
*out = new(FrontendTLS)
|
||||
@ -1751,11 +1726,6 @@ func (in *HeaderTransformation) DeepCopy() *HeaderTransformation {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Health) DeepCopyInto(out *Health) {
|
||||
*out = *in
|
||||
if in.UnhealthyCondition != nil {
|
||||
in, out := &in.UnhealthyCondition, &out.UnhealthyCondition
|
||||
*out = new(shared.CELExpression)
|
||||
**out = **in
|
||||
}
|
||||
if in.Eviction != nil {
|
||||
in, out := &in.Eviction, &out.Eviction
|
||||
*out = new(BackendEviction)
|
||||
@ -1878,11 +1848,6 @@ func (in *JWTAuthentication) DeepCopyInto(out *JWTAuthentication) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.MCP != nil {
|
||||
in, out := &in.MCP, &out.MCP
|
||||
*out = new(JWTMCPConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTAuthentication.
|
||||
@ -1895,33 +1860,6 @@ func (in *JWTAuthentication) DeepCopy() *JWTAuthentication {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JWTMCPConfig) DeepCopyInto(out *JWTMCPConfig) {
|
||||
*out = *in
|
||||
if in.ResourceMetadata != nil {
|
||||
in, out := &in.ResourceMetadata, &out.ResourceMetadata
|
||||
*out = make(map[string]apiextensionsv1.JSON, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = *val.DeepCopy()
|
||||
}
|
||||
}
|
||||
if in.Provider != nil {
|
||||
in, out := &in.Provider, &out.Provider
|
||||
*out = new(McpIDP)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTMCPConfig.
|
||||
func (in *JWTMCPConfig) DeepCopy() *JWTMCPConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(JWTMCPConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JWTProvider) DeepCopyInto(out *JWTProvider) {
|
||||
*out = *in
|
||||
@ -2158,16 +2096,6 @@ func (in *McpSelector) DeepCopy() *McpSelector {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *McpTarget) DeepCopyInto(out *McpTarget) {
|
||||
*out = *in
|
||||
if in.Host != nil {
|
||||
in, out := &in.Host, &out.Host
|
||||
*out = new(ShortString)
|
||||
**out = **in
|
||||
}
|
||||
if in.BackendRef != nil {
|
||||
in, out := &in.BackendRef, &out.BackendRef
|
||||
*out = new(corev1.LocalObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.Path != nil {
|
||||
in, out := &in.Path, &out.Path
|
||||
*out = new(LongString)
|
||||
@ -2180,7 +2108,7 @@ func (in *McpTarget) DeepCopyInto(out *McpTarget) {
|
||||
}
|
||||
if in.Policies != nil {
|
||||
in, out := &in.Policies, &out.Policies
|
||||
*out = new(BackendSimple)
|
||||
*out = new(BackendWithMCP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
@ -2301,27 +2229,6 @@ func (in *OpenAIModeration) DeepCopy() *OpenAIModeration {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OtlpAccessLog) DeepCopyInto(out *OtlpAccessLog) {
|
||||
*out = *in
|
||||
in.BackendRef.DeepCopyInto(&out.BackendRef)
|
||||
if in.Path != nil {
|
||||
in, out := &in.Path, &out.Path
|
||||
*out = new(LongString)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OtlpAccessLog.
|
||||
func (in *OtlpAccessLog) DeepCopy() *OtlpAccessLog {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(OtlpAccessLog)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PriorityGroup) DeepCopyInto(out *PriorityGroup) {
|
||||
*out = *in
|
||||
|
||||
@ -29,36 +29,34 @@ type ObjectMetadata struct {
|
||||
// Overlays are applied **after** all typed configuration fields have been processed.
|
||||
// The full merge order is:
|
||||
//
|
||||
// 1. `GatewayClass` typed configuration fields, for example replicas or image settings from `parametersRef`
|
||||
// 2. `Gateway` typed configuration fields from `infrastructure.parametersRef`
|
||||
// 3. `GatewayClass` overlays are applied
|
||||
// 4. `Gateway` overlays are applied
|
||||
// 1. GatewayClass typed configuration fields (e.g., replicas, image settings from parametersRef)
|
||||
// 2. Gateway typed configuration fields (from infrastructure.parametersRef)
|
||||
// 3. GatewayClass overlays are applied
|
||||
// 4. Gateway overlays are applied
|
||||
//
|
||||
// This ordering means `Gateway`-level configuration overrides
|
||||
// `GatewayClass`-level configuration
|
||||
// This ordering means Gateway-level configuration overrides GatewayClass-level configuration
|
||||
// at each stage. For example, if both levels set the same label, the Gateway value wins.
|
||||
type KubernetesResourceOverlay struct {
|
||||
// `metadata` defines a subset of object metadata to be customized.
|
||||
// `labels` and `annotations` are merged with existing values. If both
|
||||
// `GatewayClass` and `Gateway` parameters define the same label or
|
||||
// annotation key, the `Gateway` value takes precedence (applied second).
|
||||
// metadata defines a subset of object metadata to be customized.
|
||||
// Labels and annotations are merged with existing values. If both GatewayClass
|
||||
// and Gateway parameters define the same label or annotation key, the Gateway
|
||||
// value takes precedence (applied second).
|
||||
// +optional
|
||||
Metadata *ObjectMetadata `json:"metadata,omitempty"`
|
||||
|
||||
// `spec` provides an opaque mechanism to configure the resource spec.
|
||||
// This field accepts a complete or partial Kubernetes resource spec, such
|
||||
// as `PodSpec` or `ServiceSpec`, and will be merged with the generated
|
||||
// configuration using **Strategic Merge Patch** semantics.
|
||||
// Spec provides an opaque mechanism to configure the resource Spec.
|
||||
// This field accepts a complete or partial Kubernetes resource spec (e.g., PodSpec, ServiceSpec)
|
||||
// and will be merged with the generated configuration using **Strategic Merge Patch** semantics.
|
||||
//
|
||||
// # Application Order
|
||||
//
|
||||
// Overlays are applied after all typed configuration fields from both levels.
|
||||
// The full merge order is:
|
||||
//
|
||||
// 1. `GatewayClass` typed configuration fields
|
||||
// 2. `Gateway` typed configuration fields
|
||||
// 3. `GatewayClass` overlays
|
||||
// 4. `Gateway` overlays (can override all previous values)
|
||||
// 1. GatewayClass typed configuration fields
|
||||
// 2. Gateway typed configuration fields
|
||||
// 3. GatewayClass overlays
|
||||
// 4. Gateway overlays (can override all previous values)
|
||||
//
|
||||
// # Strategic Merge Patch & Deletion Guide
|
||||
//
|
||||
@ -69,8 +67,7 @@ type KubernetesResourceOverlay struct {
|
||||
// Simple fields (strings, integers, booleans) in your config will overwrite the generated defaults.
|
||||
//
|
||||
// **2. Merging Lists (Append/Merge):**
|
||||
// Lists with "merge keys", like `containers` which merges on `name`, or
|
||||
// `tolerations` which merges on `key`,
|
||||
// Lists with "merge keys" (like `containers` which merges on `name`, or `tolerations` which merges on `key`)
|
||||
// will append your items to the generated list, or update existing items if keys match.
|
||||
//
|
||||
// **3. Deleting Fields or List Items ($patch: delete):**
|
||||
@ -79,7 +76,6 @@ type KubernetesResourceOverlay struct {
|
||||
// and is the recommended approach because it works with both client-side
|
||||
// and server-side apply.
|
||||
//
|
||||
//
|
||||
// spec:
|
||||
// template:
|
||||
// spec:
|
||||
@ -90,12 +86,11 @@ type KubernetesResourceOverlay struct {
|
||||
// nodeSelector:
|
||||
// $patch: delete
|
||||
// containers:
|
||||
// # Be sure to use the correct proxy name here or you will add a
|
||||
// # container instead of modifying a container.
|
||||
// - name: proxy-name
|
||||
// # Delete container-level securityContext
|
||||
// securityContext:
|
||||
// $patch: delete
|
||||
// # Be sure to use the correct proxy name here or you will add a container instead of modifying a container:
|
||||
// - name: proxy-name
|
||||
// # Delete container-level securityContext
|
||||
// securityContext:
|
||||
// $patch: delete
|
||||
//
|
||||
// **4. Null Values (server-side apply only):**
|
||||
// Setting a field to `null` can also remove it, but this ONLY works with
|
||||
@ -104,7 +99,6 @@ type KubernetesResourceOverlay struct {
|
||||
// the API server, so the deletion won't occur. Prefer `$patch: delete`
|
||||
// for consistent behavior across both apply modes.
|
||||
//
|
||||
//
|
||||
// spec:
|
||||
// template:
|
||||
// spec:
|
||||
@ -114,7 +108,6 @@ type KubernetesResourceOverlay struct {
|
||||
// To replace an entire map with your values (instead of merging), use `$patch: replace`.
|
||||
// This removes all existing keys and replaces them with only your specified keys.
|
||||
//
|
||||
//
|
||||
// spec:
|
||||
// template:
|
||||
// spec:
|
||||
@ -125,19 +118,18 @@ type KubernetesResourceOverlay struct {
|
||||
// **6. Replacing Lists Entirely ($patch: replace):**
|
||||
// If you want to strictly define a list and ignore all generated defaults, use `$patch: replace`.
|
||||
//
|
||||
//
|
||||
// service:
|
||||
// spec:
|
||||
// ports:
|
||||
// - $patch: replace
|
||||
// - name: http
|
||||
// port: 80
|
||||
// targetPort: 8080
|
||||
// protocol: TCP
|
||||
// - name: https
|
||||
// port: 443
|
||||
// targetPort: 8443
|
||||
// protocol: TCP
|
||||
// - $patch: replace
|
||||
// - name: http
|
||||
// port: 80
|
||||
// targetPort: 8080
|
||||
// protocol: TCP
|
||||
// - name: https
|
||||
// port: 443
|
||||
// targetPort: 8443
|
||||
// protocol: TCP
|
||||
//
|
||||
// +optional
|
||||
// +kubebuilder:validation:Type=object
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package shared
|
||||
|
||||
// PolicyConditionType is a type of condition for a policy. This type should be
|
||||
// used with a Policy resource `Status.Conditions` field.
|
||||
// used with a Policy resource Status.Conditions field.
|
||||
type PolicyConditionType string
|
||||
|
||||
// PolicyConditionReason is a reason for a policy condition.
|
||||
@ -10,47 +10,44 @@ type PolicyConditionReason string
|
||||
const (
|
||||
// PolicyConditionAccepted indicates whether the policy has been accepted or rejected, and why.
|
||||
//
|
||||
// Possible reasons for this condition to be `True` are:
|
||||
// * `Valid`
|
||||
// Possible reasons for this condition to be True are:
|
||||
// * Valid
|
||||
//
|
||||
// Possible reasons for this condition to be `False` are:
|
||||
// * `Pending`
|
||||
// * `Invalid`
|
||||
// Possible reasons for this condition to be False are:
|
||||
// * Pending
|
||||
// * Invalid
|
||||
//
|
||||
PolicyConditionAccepted PolicyConditionType = "Accepted"
|
||||
|
||||
// PolicyConditionAttached indicates whether the policy has attached to the targeted resources.
|
||||
//
|
||||
// Possible reasons for this condition to be `True` are:
|
||||
// * `Attached`
|
||||
// * `Merged`
|
||||
// Possible reasons for this condition to be True are:
|
||||
// * Attached
|
||||
// * Merged
|
||||
//
|
||||
// Possible reasons for this condition to be `False` are:
|
||||
// * `Pending`
|
||||
// * `Overridden`
|
||||
// Possible reasons for this condition to be False are:
|
||||
// * Pending
|
||||
// * Overridden
|
||||
//
|
||||
PolicyConditionAttached PolicyConditionType = "Attached"
|
||||
|
||||
// PolicyReasonValid is used with the `Accepted` condition when the policy
|
||||
// PolicyReasonValid is used with the "Accepted" condition when the policy
|
||||
// has been accepted by the system.
|
||||
PolicyReasonValid PolicyConditionReason = "Valid"
|
||||
|
||||
// PolicyReasonInvalid is used with the `Accepted` or `Attached` condition
|
||||
// when the policy is syntactically or semantically invalid.
|
||||
// PolicyReasonInvalid is used with the "Accepted" or "Attached" condition when the policy
|
||||
// is syntactically or semantically invalid.
|
||||
PolicyReasonInvalid PolicyConditionReason = "Invalid"
|
||||
|
||||
// PolicyReasonAttached is used with the `Attached` condition when the
|
||||
// PolicyReasonAttached is used with the "Attached" condition when the
|
||||
// policy has been successfully attached to all the targeted resources.
|
||||
PolicyReasonAttached PolicyConditionReason = "Attached"
|
||||
|
||||
// PolicyReasonPending is used with the `Accepted` or `Attached` condition
|
||||
// when the policy has been referenced but not yet fully processed by the
|
||||
// controller.
|
||||
// PolicyReasonPending is used with the "Accepted" or "Attached" condition when the policy has been referenced but not yet fully processed by the controller.
|
||||
PolicyReasonPending PolicyConditionReason = "Pending"
|
||||
|
||||
// PolicyReasonPartiallyValid is used with the `Accepted` condition when the
|
||||
// policy has been accepted by the system, but some of the referenced
|
||||
// resources are not valid.
|
||||
// PolicyReasonPartiallyValid is used with the "Accepted" condition when the policy has been accepted by the system,
|
||||
// but some of the referenced resources are not valid.
|
||||
PolicyReasonPartiallyValid PolicyConditionReason = "PartiallyValid"
|
||||
)
|
||||
|
||||
|
||||
@ -2,22 +2,14 @@ package shared
|
||||
|
||||
// Authorization defines the configuration for role-based access control.
|
||||
type Authorization struct {
|
||||
// `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.
|
||||
// Policy specifies the Authorization rule to evaluate.
|
||||
// A policy matches when **any** of the conditions evaluates to true.
|
||||
// +required
|
||||
Policy AuthorizationPolicy `json:"policy"`
|
||||
|
||||
// `action` defines whether the rule allows, denies, or requires the request if
|
||||
// matched. If unspecified, the default is `Allow`.
|
||||
// Require policies are conjunctive across merged policies: all require policies must match.
|
||||
// +kubebuilder:validation:Enum=Allow;Deny;Require
|
||||
// Action defines whether the rule allows or denies the request if matched.
|
||||
// If unspecified, the default is "Allow".
|
||||
// +kubebuilder:validation:Enum=Allow;Deny
|
||||
// +kubebuilder:default=Allow
|
||||
// +optional
|
||||
Action AuthorizationPolicyAction `json:"action,omitempty"`
|
||||
@ -29,11 +21,10 @@ type Authorization struct {
|
||||
// +k8s:deepcopy-gen=false
|
||||
type CELExpression string
|
||||
|
||||
// AuthorizationPolicy defines a single authorization rule.
|
||||
// AuthorizationPolicy defines a single Authorization rule.
|
||||
type AuthorizationPolicy struct {
|
||||
// MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
|
||||
// These expressions should be in the form of a Common Expression Language
|
||||
// (`CEL`) expression.
|
||||
// These expression should be in the form of a Common Expression Language (CEL) expression.
|
||||
//
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
// +kubebuilder:validation:MaxItems=256
|
||||
@ -41,17 +32,12 @@ type AuthorizationPolicy struct {
|
||||
MatchExpressions []CELExpression `json:"matchExpressions"`
|
||||
}
|
||||
|
||||
// AuthorizationPolicyAction defines the action to take when the
|
||||
// `RBACPolicies` matches.
|
||||
// AuthorizationPolicyAction defines the action to take when the RBACPolicies matches.
|
||||
type AuthorizationPolicyAction string
|
||||
|
||||
const (
|
||||
// AuthorizationPolicyActionAllow defines the action to take when the
|
||||
// `RBACPolicies` matches.
|
||||
// AuthorizationPolicyActionAllow defines the action to take when the RBACPolicies matches.
|
||||
AuthorizationPolicyActionAllow AuthorizationPolicyAction = "Allow"
|
||||
// AuthorizationPolicyActionDeny denies the action to take when the
|
||||
// `RBACPolicies` matches.
|
||||
// AuthorizationPolicyActionDeny denies the action to take when the RBACPolicies matches.
|
||||
AuthorizationPolicyActionDeny AuthorizationPolicyAction = "Deny"
|
||||
// AuthorizationPolicyActionRequire requires the action to take when the RBACPolicies matches.
|
||||
AuthorizationPolicyActionRequire AuthorizationPolicyAction = "Require"
|
||||
)
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
// Control-plane Authorization rules not specific to policies:
|
||||
// +kubebuilder:rbac:groups=authentication.k8s.io,resources=tokenreviews,verbs=create
|
||||
|
||||
// Select the object by `name` and `namespace`.
|
||||
// Select the object by Name and Namespace.
|
||||
// You can target only one object at a time.
|
||||
type NamespacedObjectReference struct {
|
||||
// The name of the target resource.
|
||||
@ -21,7 +21,7 @@ type NamespacedObjectReference struct {
|
||||
Namespace *gwv1.Namespace `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// Select the object to attach the policy by `Group`, `Kind`, and `Name`.
|
||||
// Select the object to attach the policy by Group, Kind, and Name.
|
||||
// The object must be in the same namespace as the policy.
|
||||
// You can target only one object at a time.
|
||||
type LocalPolicyTargetReference struct {
|
||||
@ -30,7 +30,8 @@ type LocalPolicyTargetReference struct {
|
||||
// +required
|
||||
Group gwv1.Group `json:"group"`
|
||||
|
||||
// The API kind of the target resource, such as `Gateway` or `HTTPRoute`.
|
||||
// The API kind of the target resource,
|
||||
// such as Gateway or HTTPRoute.
|
||||
// +required
|
||||
Kind gwv1.Kind `json:"kind"`
|
||||
|
||||
@ -39,8 +40,7 @@ type LocalPolicyTargetReference struct {
|
||||
Name gwv1.ObjectName `json:"name"`
|
||||
}
|
||||
|
||||
// Select the object to attach the policy by `Group`, `Kind`, `Name`, and
|
||||
// `SectionName`.
|
||||
// Select the object to attach the policy by Group, Kind, Name and SectionName.
|
||||
// The object must be in the same namespace as the policy.
|
||||
// You can target only one object at a time.
|
||||
type LocalPolicyTargetReferenceWithSectionName struct {
|
||||
@ -51,17 +51,20 @@ type LocalPolicyTargetReferenceWithSectionName struct {
|
||||
SectionName *gwv1.SectionName `json:"sectionName,omitempty"`
|
||||
}
|
||||
|
||||
// LocalPolicyTargetSelector selects the object to attach the policy by
|
||||
// `Group`, `Kind`, and `MatchLabels`.
|
||||
// LocalPolicyTargetSelector selects the object to attach the policy by Group, Kind, and MatchLabels.
|
||||
// The object must be in the same namespace as the policy and match the
|
||||
// specified labels.
|
||||
// Do not use targetSelectors when reconciliation times are critical, especially if you
|
||||
// have a large number of policies that target the same resource.
|
||||
// Instead, use targetRefs to attach the policy.
|
||||
type LocalPolicyTargetSelector struct {
|
||||
// The API group of the target resource.
|
||||
// For Kubernetes Gateway API resources, the group is `gateway.networking.k8s.io`.
|
||||
// +required
|
||||
Group gwv1.Group `json:"group"`
|
||||
|
||||
// The API kind of the target resource, such as `Gateway` or `HTTPRoute`.
|
||||
// The API kind of the target resource,
|
||||
// such as Gateway or HTTPRoute.
|
||||
// +required
|
||||
Kind gwv1.Kind `json:"kind"`
|
||||
|
||||
@ -70,14 +73,12 @@ type LocalPolicyTargetSelector struct {
|
||||
MatchLabels map[string]string `json:"matchLabels"`
|
||||
}
|
||||
|
||||
// LocalPolicyTargetSelectorWithSectionName selects the object to attach the
|
||||
// policy by `Group`, `Kind`, `MatchLabels`, and optionally `SectionName`.
|
||||
// LocalPolicyTargetSelectorWithSectionName the object to attach the policy by Group, Kind, MatchLabels, and optionally SectionName.
|
||||
// The object must be in the same namespace as the policy and match the
|
||||
// specified labels.
|
||||
// Do not use `targetSelectors` when reconciliation times are critical,
|
||||
// especially if you
|
||||
// Do not use targetSelectors when reconciliation times are critical, especially if you
|
||||
// have a large number of policies that target the same resource.
|
||||
// Instead, use `targetRefs` to attach the policy.
|
||||
// Instead, use targetRefs to attach the policy.
|
||||
type LocalPolicyTargetSelectorWithSectionName struct {
|
||||
LocalPolicyTargetSelector `json:",inline"`
|
||||
|
||||
@ -107,17 +108,17 @@ type PolicyAncestorStatus struct {
|
||||
|
||||
// ControllerName is a domain/path string that indicates the name of the
|
||||
// controller that wrote this status. This corresponds with the
|
||||
// `controllerName` field on `GatewayClass`.
|
||||
// controllerName field on GatewayClass.
|
||||
//
|
||||
// Example: `example.net/gateway-controller`.
|
||||
// Example: "example.net/gateway-controller".
|
||||
//
|
||||
// The format of this field is `DOMAIN "/" PATH`, where `DOMAIN` and `PATH` are
|
||||
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
|
||||
// valid Kubernetes names
|
||||
// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
|
||||
//
|
||||
// Controllers MUST populate this field when writing status. Controllers
|
||||
// should ensure that entries in status populated with their `ControllerName`
|
||||
// are cleaned up when they are no longer necessary.
|
||||
// Controllers MUST populate this field when writing status. Controllers should ensure that
|
||||
// entries to status populated with their ControllerName are cleaned up when they are no
|
||||
// longer necessary.
|
||||
// +required
|
||||
ControllerName string `json:"controllerName"`
|
||||
|
||||
@ -135,24 +136,24 @@ type PolicyAncestorStatus struct {
|
||||
// +kubebuilder:validation:ExactlyOneOf=exact;prefix;suffix;contains;safeRegex
|
||||
type StringMatcher struct {
|
||||
// The input string must match exactly the string specified here.
|
||||
// Example: `abc` matches the value `abc`.
|
||||
// Example: abc matches the value abc
|
||||
// +optional
|
||||
Exact *string `json:"exact,omitempty"`
|
||||
|
||||
// The input string must have the prefix specified here.
|
||||
// Note: empty prefix is not allowed, please use regex instead.
|
||||
// Example: `abc` matches the value `abc.xyz`.
|
||||
// Example: abc matches the value abc.xyz
|
||||
// +optional
|
||||
Prefix *string `json:"prefix,omitempty"`
|
||||
|
||||
// The input string must have the suffix specified here.
|
||||
// Note: empty prefix is not allowed, please use regex instead.
|
||||
// Example: `abc` matches the value `xyz.abc`.
|
||||
// Example: abc matches the value xyz.abc
|
||||
// +optional
|
||||
Suffix *string `json:"suffix,omitempty"`
|
||||
|
||||
// The input string must contain the substring specified here.
|
||||
// Example: `abc` matches the value `xyz.abc.def`.
|
||||
// Example: abc matches the value xyz.abc.def
|
||||
// +optional
|
||||
Contains *string `json:"contains,omitempty"`
|
||||
|
||||
|
||||
@ -4,19 +4,17 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
type Timeouts struct {
|
||||
// Request specifies a timeout for an individual request from the gateway to a backend.
|
||||
// This spans between the point at which the entire downstream request
|
||||
// (i.e. end-of-stream) has been
|
||||
// This spans between the point at which the entire downstream request (i.e. end-of-stream) has been
|
||||
// processed and when the backend response has been completely processed.
|
||||
// A value of `0` effectively disables the timeout.
|
||||
// It is specified as a sequence of decimal numbers, each with optional
|
||||
// fraction and a unit suffix, such as `1s` or `500ms`.
|
||||
// A value of 0 effectively disables the timeout.
|
||||
// It is specified as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "1s" or "500ms".
|
||||
// +optional
|
||||
//
|
||||
// +kubebuilder:validation:XValidation:rule="matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')",message="invalid duration value"
|
||||
Request *metav1.Duration `json:"request,omitempty"`
|
||||
|
||||
// StreamIdle specifies a timeout for a requests' idle streams.
|
||||
// A value of `0` effectively disables the timeout.
|
||||
// A value of 0 effectively disables the timeout.
|
||||
// +optional
|
||||
//
|
||||
// +kubebuilder:validation:XValidation:rule="matches(self, '^([0-9]{1,5}(h|m|s|ms)){1,4}$')",message="invalid duration value"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/setup"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/setup"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/version"
|
||||
)
|
||||
|
||||
@ -20,7 +20,7 @@ func main() {
|
||||
fmt.Println(version.String())
|
||||
return nil
|
||||
}
|
||||
s, err := setup.New(setup.Options{})
|
||||
s, err := setup.New()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error setting up agentgateway: %w", err)
|
||||
}
|
||||
|
||||
@ -1,9 +1,341 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
[ $# -eq 2 ] || { echo "usage: $0 {gie|gtw} REF" >&2; exit 2; }
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
case "$1" in
|
||||
gtw) kubectl kustomize "https://github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=$2" > pkg/kgateway/crds/gateway-crds.yaml ;;
|
||||
gie) kubectl kustomize "https://github.com/kubernetes-sigs/gateway-api-inference-extension/config/crd?ref=$2" > pkg/kgateway/crds/inference-crds.yaml ;;
|
||||
*) echo "usage: $0 {gie|gtw} REF" >&2; exit 2 ;;
|
||||
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
|
||||
# The GIE EPP used in e2e tests
|
||||
EPP_YAML_PATH="test/e2e/features/inferenceextension/testdata/epp.yaml"
|
||||
|
||||
# The base URLs for fetching CRDs
|
||||
GIE_CRD_BASE="https://raw.githubusercontent.com/kubernetes-sigs/gateway-api-inference-extension"
|
||||
GATEWAY_CRD_BASE="https://raw.githubusercontent.com/kubernetes-sigs/gateway-api"
|
||||
|
||||
# The Gateway API channel (experimental or stable)
|
||||
CONFORMANCE_CHANNEL="${CONFORMANCE_CHANNEL:-experimental}"
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 {gie|gtw} REF"
|
||||
echo " REF can be a tag (e.g. v1.3.0) or a commit SHA."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
kind="$1"; shift
|
||||
ref="$1"; shift
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
echo "Bumping $kind to ref: $ref ..."
|
||||
|
||||
# Check the current module version
|
||||
case "$kind" in
|
||||
gie) module="sigs.k8s.io/gateway-api-inference-extension";;
|
||||
gtw) module="sigs.k8s.io/gateway-api";;
|
||||
*) echo "Unknown kind: $kind" >&2; exit 1;;
|
||||
esac
|
||||
|
||||
current_version="$(go list -m -f '{{.Version}}' "$module" 2>/dev/null || true)"
|
||||
|
||||
# Resolve desired ref to a module version (pseudo-version if ref is non-tag)
|
||||
resolved_version="$(
|
||||
go list -m -json "${module}@${ref}" 2>/dev/null \
|
||||
| sed -n 's/.*"Version": *"\([^"]*\)".*/\1/p'
|
||||
)"
|
||||
|
||||
if [ -z "${resolved_version}" ]; then
|
||||
echo "ERROR: Could not resolve ${module}@${ref} to a module version."
|
||||
echo " Verify the ref exists in the upstream repo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Current version: ${current_version:-<none>}"
|
||||
echo "Desired version (resolved): ${resolved_version}"
|
||||
|
||||
# If already at the desired version, skip go get/mod tidy but still refresh CRDs.
|
||||
skip_get=0
|
||||
if [ -n "$current_version" ] && [ "$current_version" = "$resolved_version" ]; then
|
||||
echo "Already at ${resolved_version} - skipping dependency bump, refreshing CRDs..."
|
||||
skip_get=1
|
||||
fi
|
||||
|
||||
if [ $skip_get -eq 0 ]; then
|
||||
# Bump the module deps
|
||||
echo "Running: go get ${module}@${ref}"
|
||||
go get "${module}@${ref}"
|
||||
|
||||
echo "Running: go mod tidy"
|
||||
go mod tidy
|
||||
fi
|
||||
|
||||
# Update GIE_CRD_VERSION in files (for GIE bumps only) to the exact ref passed in.
|
||||
update_gie_crd_version_line() {
|
||||
# $1 = file path, $2 = mode ("mk" for Makefile-style, "sh" for shell)
|
||||
local file="$1"
|
||||
local mode="$2"
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "WARN: $file not found, skipping"
|
||||
return 0
|
||||
fi
|
||||
echo "Setting GIE_CRD_VERSION to '${ref}' in $file"
|
||||
|
||||
if [ "$mode" = "mk" ]; then
|
||||
# If the var exists, replace its RHS (supports '=', '?=', '=').
|
||||
if grep -Eq '^[[:space:]]*GIE_CRD_VERSION[[:space:]]*([?:]?=)' "$file"; then
|
||||
sed -i.bak -E \
|
||||
-e 's|^([[:space:]]*GIE_CRD_VERSION[[:space:]]*[?:]?=)[[:space:]]*.*$|\1 '"$ref"'|g' \
|
||||
"$file"
|
||||
rm -f "$file.bak"
|
||||
else
|
||||
# Append a sane default form if not present.
|
||||
printf '\nGIE_CRD_VERSION ?= %s\n' "$ref" >> "$file"
|
||||
fi
|
||||
else
|
||||
# Shell-style assignment; replace the whole line if present, else append.
|
||||
if grep -Eq '^[[:space:]]*GIE_CRD_VERSION=' "$file"; then
|
||||
sed -i.bak -E \
|
||||
-e 's|^[[:space:]]*GIE_CRD_VERSION=.*$|GIE_CRD_VERSION="'"$ref"'"|g' \
|
||||
"$file"
|
||||
rm -f "$file.bak"
|
||||
else
|
||||
printf '\nGIE_CRD_VERSION="%s"\n' "$ref" >> "$file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper: derive image tag from module version.
|
||||
# - For pseudo-versions that end with '...-YYYYMMDDHHMMSS-<sha>', produce 'vYYYYMMDD-<sha7>'
|
||||
# - Otherwise (e.g., semver tag), use the version itself as the image tag.
|
||||
derive_image_tag() {
|
||||
local ver="$1"
|
||||
# Match the trailing timestamp + sha anywhere at the end (robust for different pseudo-version bases)
|
||||
if [[ "$ver" =~ ([0-9]{14})-([0-9a-f]{7,40})$ ]]; then
|
||||
local ts="${BASH_REMATCH[1]}"
|
||||
local sha="${BASH_REMATCH[2]}"
|
||||
# Use YYYYMMDD and first 7 chars of sha
|
||||
echo "v${ts:0:8}-${sha:0:7}"
|
||||
else
|
||||
# Fall back to the version string itself (for true tags like v1.0.0 or v1.0.0-rc.2)
|
||||
echo "$ver"
|
||||
fi
|
||||
}
|
||||
|
||||
# Update e2e EPP image tag (GIE only)
|
||||
if [ "$kind" = gie ]; then
|
||||
img_tag="$(derive_image_tag "$resolved_version")"
|
||||
echo "Updating EPP image tag in $EPP_YAML_PATH to ${img_tag} (from module version: ${resolved_version})"
|
||||
# macOS/BSD-safe inline edit
|
||||
sed -i.bak -E \
|
||||
-e "s|(gateway-api-inference-extension/epp:)[^[:space:]\"]+|\1${img_tag}|g" \
|
||||
"$root/$EPP_YAML_PATH"
|
||||
rm -f "$root/$EPP_YAML_PATH.bak"
|
||||
|
||||
# Also update GIE_CRD_VERSION to the ref we were given (tag or SHA).
|
||||
update_gie_crd_version_line "$root/Makefile" "mk"
|
||||
if [ -f "$root/hack/kind/setup-kind.sh" ]; then
|
||||
update_gie_crd_version_line "$root/hack/kind/setup-kind.sh" "sh"
|
||||
elif [ -f "$root/kind/setup-kind.sh" ]; then
|
||||
update_gie_crd_version_line "$root/kind/setup-kind.sh" "sh"
|
||||
else
|
||||
echo "WARN: No setup-kind.sh found under hack/kind or kind/, skipping"
|
||||
fi
|
||||
fi
|
||||
|
||||
update_make_var_line() {
|
||||
local file="$1"
|
||||
local var="$2"
|
||||
local val="$3"
|
||||
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "WARN: $file not found, skipping"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Setting ${var} to '${val}' in ${file}"
|
||||
|
||||
if grep -Eq "^[[:space:]]*${var}[[:space:]]*([?:]?=)" "$file"; then
|
||||
sed -i.bak -E \
|
||||
-e "s|^([[:space:]]*${var}[[:space:]]*[?:]?=)[[:space:]]*.*$|\1 ${val}|g" \
|
||||
"$file"
|
||||
rm -f "$file.bak"
|
||||
else
|
||||
printf '\n%s ?= %s\n' "$var" "$val" >> "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
update_nightly_gateway_api_matrix_versions() {
|
||||
local file="$1"
|
||||
local old="$2"
|
||||
local new="$3"
|
||||
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "WARN: $file not found, skipping"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Escape dots for ERE (good enough for vX.Y.Z / -rc.N)
|
||||
local old_esc="${old//./\\.}"
|
||||
|
||||
echo "Updating nightly-tests gateway-api matrix: ${old} -> ${new} in ${file}"
|
||||
sed -i.bak -E \
|
||||
-e "s|(version:[[:space:]]*')${old_esc}(')|\1${new}\2|g" \
|
||||
"$file"
|
||||
rm -f "$file.bak"
|
||||
}
|
||||
|
||||
# Fetch and store the CRDs
|
||||
crd_dir="$root/pkg/kgateway/crds"
|
||||
mkdir -p "$crd_dir"
|
||||
|
||||
if [ "$kind" = gie ]; then
|
||||
# Build a single all-in-one CRD file.
|
||||
outfile="${crd_dir}/inference-crds.yaml"
|
||||
tmpdir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
# Known CRDs/sources
|
||||
declare -a SOURCES=(
|
||||
"${GIE_CRD_BASE}/${ref}/config/crd/bases/inference.networking.k8s.io_inferencepools.yaml"
|
||||
"${GIE_CRD_BASE}/${ref}/config/crd/bases/inference.networking.x-k8s.io_inferenceobjectives.yaml"
|
||||
)
|
||||
|
||||
tmpout="$(mktemp)"
|
||||
: > "$tmpout"
|
||||
|
||||
for url in "${SOURCES[@]}"; do
|
||||
fname="$tmpdir/$(basename "$url")"
|
||||
echo "Fetching $url"
|
||||
curl -fsS "$url" -o "$fname"
|
||||
{
|
||||
echo "# Source: $url"
|
||||
cat "$fname"
|
||||
echo "---"
|
||||
} >> "$tmpout"
|
||||
done
|
||||
|
||||
# Remove the trailing '---' and any trailing blank lines
|
||||
# shellcheck disable=SC2016
|
||||
awk '{
|
||||
lines[NR]=$0
|
||||
} END {
|
||||
# drop trailing separators/blank lines
|
||||
i=NR
|
||||
while (i>0 && (lines[i] ~ /^---[[:space:]]*$/ || lines[i] ~ /^[[:space:]]*$/)) { i-- }
|
||||
for (j=1; j<=i; j++) print lines[j]
|
||||
}' "$tmpout" > "${tmpout}.trim"
|
||||
|
||||
mv -f "${tmpout}.trim" "$outfile"
|
||||
rm -f "$tmpout"
|
||||
echo "Wrote GIE all-in-one CRDs to $outfile"
|
||||
|
||||
elif [ "$kind" = gtw ]; then
|
||||
# Gateway API CRDs
|
||||
# Use release assets when ref resolves to a non-pseudo version (tags incl. -rc.*),
|
||||
# otherwise iterate files from the repo for pseudo-versions (timestamps/SHAs).
|
||||
|
||||
out_all="${crd_dir}/gateway-crds.yaml"
|
||||
|
||||
is_pseudo=0
|
||||
if [[ "$resolved_version" =~ ([0-9]{14})-([0-9a-f]{7,40})$ ]]; then
|
||||
is_pseudo=1
|
||||
fi
|
||||
|
||||
# Read current pinned conformance version from the Makefile (so we only replace “latest”)
|
||||
current_conf="$(
|
||||
sed -nE 's/^[[:space:]]*CONFORMANCE_VERSION[[:space:]]*[?:]?=[[:space:]]*([^[:space:]#]+).*$/\1/p' \
|
||||
"$root/Makefile" | head -n1
|
||||
)"
|
||||
|
||||
if [ $is_pseudo -eq 0 ]; then
|
||||
# Update Makefile pin
|
||||
update_make_var_line "$root/Makefile" "CONFORMANCE_VERSION" "$resolved_version"
|
||||
|
||||
# Update nightly-tests “latest” entries (the ones matching current_conf)
|
||||
if [ -n "${current_conf:-}" ]; then
|
||||
update_nightly_gateway_api_matrix_versions \
|
||||
"$root/.github/workflows/nightly-tests.yaml" \
|
||||
"$current_conf" \
|
||||
"$resolved_version"
|
||||
else
|
||||
echo "WARN: Could not parse current CONFORMANCE_VERSION from Makefile; skipping workflow update"
|
||||
fi
|
||||
else
|
||||
echo "WARN: Gateway API resolved to pseudo-version (${resolved_version}); leaving CONFORMANCE_VERSION and nightly matrix unchanged"
|
||||
fi
|
||||
|
||||
if [ $is_pseudo -eq 0 ]; then
|
||||
# Try to download prebuilt install manifest from the GitHub release
|
||||
if [ "${CONFORMANCE_CHANNEL}" = "experimental" ]; then
|
||||
asset="experimental-install.yaml"
|
||||
else
|
||||
asset="standard-install.yaml"
|
||||
fi
|
||||
release_url="https://github.com/kubernetes-sigs/gateway-api/releases/download/${resolved_version}/${asset}"
|
||||
echo "Attempting to fetch Gateway API release asset: ${release_url}"
|
||||
tmp_release="$(mktemp)"
|
||||
if curl -fLSs "${release_url}" -o "${tmp_release}"; then
|
||||
# Extra safety: ensure non-empty before replacing
|
||||
if [ -s "${tmp_release}" ]; then
|
||||
mv -f "${tmp_release}" "${out_all}"
|
||||
echo "Wrote Gateway (${CONFORMANCE_CHANNEL}) CRDs to ${out_all} from release asset"
|
||||
else
|
||||
echo "Release asset downloaded but empty; falling back to repo iteration for ${ref}"
|
||||
rm -f "${tmp_release}"
|
||||
is_pseudo=1
|
||||
fi
|
||||
else
|
||||
echo "Release asset not available (or download failed); falling back to repo iteration for ${ref}"
|
||||
rm -f "${tmp_release}"
|
||||
is_pseudo=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $is_pseudo -eq 1 ]; then
|
||||
# Fallback for pseudo-versions (or when release asset unavailable):
|
||||
# fetch all YAMLs under config/crd/${CONFORMANCE_CHANNEL} and concatenate.
|
||||
tmpdir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
archive_url="https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/${ref}"
|
||||
echo "Downloading Gateway API archive: $archive_url"
|
||||
curl -fsSL "$archive_url" -o "$tmpdir/gtw.tar.gz"
|
||||
|
||||
echo "Extracting archive..."
|
||||
tar -xzf "$tmpdir/gtw.tar.gz" -C "$tmpdir"
|
||||
|
||||
srcdir="$(echo "$tmpdir"/gateway-api-*/config/crd/${CONFORMANCE_CHANNEL})"
|
||||
if [ ! -d "$srcdir" ]; then
|
||||
echo "ERROR: Could not find extracted CRD directory: $srcdir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmp_all="$(mktemp)"
|
||||
: > "$tmp_all"
|
||||
echo "Building all-in-one CRD file at ${out_all} from ${srcdir}"
|
||||
# Concatenate in a stable order and include both x-k8s.io and k8s.io groups.
|
||||
for f in $(ls "$srcdir"/*.yaml | sort); do
|
||||
base="$(basename "$f")"
|
||||
echo "# Source: ${GATEWAY_CRD_BASE}/${ref}/config/crd/${CONFORMANCE_CHANNEL}/${base}" >> "$tmp_all"
|
||||
cat "$f" >> "$tmp_all"
|
||||
echo "---" >> "$tmp_all"
|
||||
done
|
||||
|
||||
# Trim trailing separators/blank lines
|
||||
awk '{
|
||||
lines[NR]=$0
|
||||
} END {
|
||||
i=NR
|
||||
while (i>0 && (lines[i] ~ /^---[[:space:]]*$/ || lines[i] ~ /^[[:space:]]*$/)) { i-- }
|
||||
for (j=1; j<=i; j++) print lines[j]
|
||||
}' "$tmp_all" > "${out_all}"
|
||||
rm -f "$tmp_all"
|
||||
echo "Wrote Gateway (${CONFORMANCE_CHANNEL}) all-in-one CRDs to $out_all"
|
||||
fi
|
||||
|
||||
# Final sanity: if ${out_all} exists but is empty, fail loudly
|
||||
if [ -e "${out_all}" ] && [ ! -s "${out_all}" ]; then
|
||||
echo "ERROR: ${out_all} is empty after CRD refresh. Please check the logs above."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$kind bumped to ${resolved_version} (ref: ${ref}) successfully!"
|
||||
|
||||
@ -25,10 +25,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
atLeastOneFieldSetMarker = "kubebuilder:validation:AtLeastOneFieldSet"
|
||||
ifThenOnlyFieldsMarker = "kubebuilder:validation:IfThenOnlyFields"
|
||||
overrideXValidationMarker = "kubebuilder:validation:OverrideXValidation"
|
||||
controllerGenVersion = "v0.20.0"
|
||||
atLeastOneFieldSetMarker = "kubebuilder:validation:AtLeastOneFieldSet"
|
||||
ifThenOnlyFieldsMarker = "kubebuilder:validation:IfThenOnlyFields"
|
||||
controllerGenVersion = "v0.20.0"
|
||||
)
|
||||
|
||||
type pathList []string
|
||||
@ -62,17 +61,6 @@ type IfThenOnlyFields struct {
|
||||
Message string `marker:",optional"`
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
type OverrideXValidation struct {
|
||||
MessageContains string `marker:"messageContains"`
|
||||
Rule string `marker:",optional"`
|
||||
Message string `marker:",optional"`
|
||||
MessageExpression string `marker:"messageExpression,optional"`
|
||||
Reason string `marker:"reason,optional"`
|
||||
FieldPath string `marker:"fieldPath,optional"`
|
||||
OptionalOldSelf *bool `marker:"optionalOldSelf,optional"`
|
||||
}
|
||||
|
||||
func (m AtLeastOneFieldSet) ApplyToSchema(schema *apiextensionsv1.JSONSchemaProps) error {
|
||||
allFields := sortedPropertyNames(schema)
|
||||
if len(m.Fields) > 0 {
|
||||
@ -88,6 +76,18 @@ func (AtLeastOneFieldSet) ApplyPriority() crdmarkers.ApplyPriority {
|
||||
return crdmarkers.AtLeastOneOf{}.ApplyPriority() + 1
|
||||
}
|
||||
|
||||
func (m IfThenOnlyFields) ApplyToSchema(schema *apiextensionsv1.JSONSchemaProps) error {
|
||||
allFields := sortedPropertyNames(schema)
|
||||
if len(m.Fields) > 0 {
|
||||
allFields = dedupeAndSort(append(allFields, m.Fields...))
|
||||
}
|
||||
return applyIfThenOnlyFields(schema, allFields, m)
|
||||
}
|
||||
|
||||
func (IfThenOnlyFields) ApplyPriority() crdmarkers.ApplyPriority {
|
||||
return AtLeastOneFieldSet{}.ApplyPriority() + 1
|
||||
}
|
||||
|
||||
func main() {
|
||||
var paths pathList
|
||||
outputDir := flag.String("output-dir", "", "directory to write CRD YAMLs")
|
||||
@ -146,6 +146,7 @@ func generateCRDs(paths []string, outputDir string, maxDescLen int, crdVersion s
|
||||
if err := populateInferredMarkerFields(parser); err != nil {
|
||||
return fmt.Errorf("populate inferred marker fields: %w", err)
|
||||
}
|
||||
|
||||
metav1Pkg := crd.FindMetav1(roots)
|
||||
if metav1Pkg == nil {
|
||||
return fmt.Errorf("no objects in roots (nothing imported metav1)")
|
||||
@ -153,15 +154,12 @@ func generateCRDs(paths []string, outputDir string, maxDescLen int, crdVersion s
|
||||
|
||||
kubeKinds := crd.FindKubeKinds(parser, metav1Pkg)
|
||||
if len(kubeKinds) == 0 {
|
||||
return fmt.Errorf("found zero Kubernetes kinds for paths: %s", strings.Join(paths, ", "))
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, groupKind := range kubeKinds {
|
||||
parser.NeedCRDFor(groupKind, &maxDescLen)
|
||||
crdRaw := parser.CustomResourceDefinitions[groupKind]
|
||||
if err := applyPostSchemaMarkersToCRD(parser, &crdRaw, groupKind); err != nil {
|
||||
return fmt.Errorf("apply post-schema markers to CRD %s/%s: %w", groupKind.Group, groupKind.Kind, err)
|
||||
}
|
||||
addAttribution(&crdRaw)
|
||||
crd.FixTopLevelMetadata(crdRaw)
|
||||
|
||||
@ -200,7 +198,6 @@ func registerCustomMarkers(registry *markers.Registry) error {
|
||||
defs := []*markers.Definition{
|
||||
markers.Must(markers.MakeDefinition(atLeastOneFieldSetMarker, markers.DescribesType, AtLeastOneFieldSet{})),
|
||||
markers.Must(markers.MakeDefinition(ifThenOnlyFieldsMarker, markers.DescribesType, IfThenOnlyFields{})),
|
||||
markers.Must(markers.MakeDefinition(overrideXValidationMarker, markers.DescribesType, OverrideXValidation{})),
|
||||
}
|
||||
for _, def := range defs {
|
||||
if err := registry.Register(def); err != nil {
|
||||
@ -267,34 +264,6 @@ func asAtLeastOneFieldSet(raw any) (AtLeastOneFieldSet, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func asOverrideXValidation(raw any) (OverrideXValidation, error) {
|
||||
switch marker := raw.(type) {
|
||||
case OverrideXValidation:
|
||||
return marker, nil
|
||||
case *OverrideXValidation:
|
||||
if marker == nil {
|
||||
return OverrideXValidation{}, fmt.Errorf("unexpected nil marker for %s", overrideXValidationMarker)
|
||||
}
|
||||
return *marker, nil
|
||||
default:
|
||||
return OverrideXValidation{}, fmt.Errorf("unexpected marker value %T for %s", raw, overrideXValidationMarker)
|
||||
}
|
||||
}
|
||||
|
||||
func asIfThenOnlyFields(raw any) (IfThenOnlyFields, error) {
|
||||
switch marker := raw.(type) {
|
||||
case IfThenOnlyFields:
|
||||
return marker, nil
|
||||
case *IfThenOnlyFields:
|
||||
if marker == nil {
|
||||
return IfThenOnlyFields{}, fmt.Errorf("unexpected nil marker for %s", ifThenOnlyFieldsMarker)
|
||||
}
|
||||
return *marker, nil
|
||||
default:
|
||||
return IfThenOnlyFields{}, fmt.Errorf("unexpected marker value %T for %s", raw, ifThenOnlyFieldsMarker)
|
||||
}
|
||||
}
|
||||
|
||||
func applyAtLeastOneFieldSet(schema *apiextensionsv1.JSONSchemaProps, allFields []string, marker AtLeastOneFieldSet) error {
|
||||
fields, err := resolveFields(allFields, marker.Fields, marker.Exclude)
|
||||
if err != nil {
|
||||
@ -354,151 +323,6 @@ func applyIfThenOnlyFields(schema *apiextensionsv1.JSONSchemaProps, allFields []
|
||||
}.ApplyToSchema(schema)
|
||||
}
|
||||
|
||||
func applyOverrideXValidation(schema *apiextensionsv1.JSONSchemaProps, override OverrideXValidation) error {
|
||||
if strings.TrimSpace(override.MessageContains) == "" {
|
||||
return errors.New("OverrideXValidation requires messageContains")
|
||||
}
|
||||
|
||||
matches := make([]int, 0, 1)
|
||||
for i, validation := range schema.XValidations {
|
||||
if strings.Contains(validation.Message, override.MessageContains) {
|
||||
matches = append(matches, i)
|
||||
}
|
||||
}
|
||||
|
||||
if len(matches) != 1 {
|
||||
return fmt.Errorf("OverrideXValidation matched %d rules for messageContains %q, expected exactly 1", len(matches), override.MessageContains)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(override.Rule) == "" {
|
||||
schema.XValidations = append(schema.XValidations[:matches[0]], schema.XValidations[matches[0]+1:]...)
|
||||
return nil
|
||||
}
|
||||
|
||||
replaced, err := overrideValidationRule(schema.XValidations[matches[0]], override)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
schema.XValidations[matches[0]] = replaced
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyPostSchemaMarkersToCRD(parser *crd.Parser, crdObj *apiextensionsv1.CustomResourceDefinition, groupKind schema.GroupKind) error {
|
||||
for i := range crdObj.Spec.Versions {
|
||||
versionSpec := &crdObj.Spec.Versions[i]
|
||||
if versionSpec.Schema == nil || versionSpec.Schema.OpenAPIV3Schema == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
rootType, ok := rootTypeForCRDVersion(parser, groupKind, versionSpec.Name)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
inProgress := map[crd.TypeIdent]bool{}
|
||||
if err := applyPostSchemaMarkersForType(parser, rootType, versionSpec.Schema.OpenAPIV3Schema, inProgress); err != nil {
|
||||
return fmt.Errorf("%s: %w", rootType, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func rootTypeForCRDVersion(parser *crd.Parser, groupKind schema.GroupKind, version string) (crd.TypeIdent, bool) {
|
||||
for pkg, gv := range parser.GroupVersions {
|
||||
if gv.Group != groupKind.Group || gv.Version != version {
|
||||
continue
|
||||
}
|
||||
|
||||
typ := crd.TypeIdent{
|
||||
Package: pkg,
|
||||
Name: groupKind.Kind,
|
||||
}
|
||||
if parser.LookupType(pkg, groupKind.Kind) != nil {
|
||||
return typ, true
|
||||
}
|
||||
}
|
||||
|
||||
return crd.TypeIdent{}, false
|
||||
}
|
||||
|
||||
func applyPostSchemaMarkersForType(
|
||||
parser *crd.Parser,
|
||||
typ crd.TypeIdent,
|
||||
schema *apiextensionsv1.JSONSchemaProps,
|
||||
inProgress map[crd.TypeIdent]bool,
|
||||
) error {
|
||||
if schema == nil {
|
||||
return nil
|
||||
}
|
||||
if inProgress[typ] {
|
||||
return nil
|
||||
}
|
||||
|
||||
info := parser.LookupType(typ.Package, typ.Name)
|
||||
if info == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
inProgress[typ] = true
|
||||
defer delete(inProgress, typ)
|
||||
|
||||
for _, field := range info.Fields {
|
||||
fieldName, inline, include := jsonFieldInfo(field.Tag)
|
||||
if !include {
|
||||
continue
|
||||
}
|
||||
|
||||
fieldType, ok := typeIdentForExpr(parser, typ.Package, field.RawField.Type)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
if inline {
|
||||
if err := applyPostSchemaMarkersForType(parser, fieldType, schema, inProgress); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
fieldSchema, ok := schema.Properties[fieldName]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if err := applyPostSchemaMarkersForType(parser, fieldType, &fieldSchema, inProgress); err != nil {
|
||||
return err
|
||||
}
|
||||
schema.Properties[fieldName] = fieldSchema
|
||||
}
|
||||
|
||||
if rawMarkers, ok := info.Markers[overrideXValidationMarker]; ok {
|
||||
for _, raw := range rawMarkers {
|
||||
marker, err := asOverrideXValidation(raw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := applyOverrideXValidation(schema, marker); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if rawMarkers, ok := info.Markers[ifThenOnlyFieldsMarker]; ok {
|
||||
allFields := sortedPropertyNames(schema)
|
||||
for _, raw := range rawMarkers {
|
||||
marker, err := asIfThenOnlyFields(raw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := applyIfThenOnlyFields(schema, allFields, marker); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resolveFields(allFields, includes, excludes []string) ([]string, error) {
|
||||
var err error
|
||||
includes, err = normalizeFieldList(includes, "fields")
|
||||
@ -660,7 +484,6 @@ func allJSONFieldNamesForType(
|
||||
continue
|
||||
}
|
||||
|
||||
parser.NeedPackage(embeddedType.Package)
|
||||
embeddedInfo := parser.LookupType(embeddedType.Package, embeddedType.Name)
|
||||
if embeddedInfo == nil {
|
||||
continue
|
||||
@ -791,33 +614,6 @@ func fieldsToOneOfCelRuleStr(fields []string) string {
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
func overrideValidationRule(existing apiextensionsv1.ValidationRule, override OverrideXValidation) (apiextensionsv1.ValidationRule, error) {
|
||||
result := existing
|
||||
result.Rule = override.Rule
|
||||
if override.Message != "" {
|
||||
result.Message = override.Message
|
||||
}
|
||||
if override.MessageExpression != "" {
|
||||
result.MessageExpression = override.MessageExpression
|
||||
}
|
||||
if override.Reason != "" {
|
||||
switch override.Reason {
|
||||
case string(apiextensionsv1.FieldValueRequired), string(apiextensionsv1.FieldValueInvalid), string(apiextensionsv1.FieldValueForbidden), string(apiextensionsv1.FieldValueDuplicate):
|
||||
reason := apiextensionsv1.FieldValueErrorReason(override.Reason)
|
||||
result.Reason = &reason
|
||||
default:
|
||||
return apiextensionsv1.ValidationRule{}, fmt.Errorf("invalid reason %s, valid values are %s, %s, %s and %s", override.Reason, apiextensionsv1.FieldValueRequired, apiextensionsv1.FieldValueInvalid, apiextensionsv1.FieldValueForbidden, apiextensionsv1.FieldValueDuplicate)
|
||||
}
|
||||
}
|
||||
if override.FieldPath != "" {
|
||||
result.FieldPath = override.FieldPath
|
||||
}
|
||||
if override.OptionalOldSelf != nil {
|
||||
result.OptionalOldSelf = override.OptionalOldSelf
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func addAttribution(crd *apiextensionsv1.CustomResourceDefinition) {
|
||||
if crd.ObjectMeta.Annotations == nil {
|
||||
crd.ObjectMeta.Annotations = map[string]string{}
|
||||
|
||||
@ -1,188 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"sigs.k8s.io/controller-tools/pkg/crd"
|
||||
"sigs.k8s.io/controller-tools/pkg/loader"
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
func newTestParser(t *testing.T, rootPath string) ([]*loader.Package, *crd.Parser) {
|
||||
t.Helper()
|
||||
|
||||
roots, err := loader.LoadRoots(rootPath)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, roots, 1)
|
||||
|
||||
generator := &crd.Generator{}
|
||||
parser := &crd.Parser{
|
||||
Collector: &markers.Collector{Registry: &markers.Registry{}},
|
||||
Checker: &loader.TypeChecker{
|
||||
NodeFilters: []loader.NodeFilter{generator.CheckFilter()},
|
||||
},
|
||||
}
|
||||
require.NoError(t, generator.RegisterMarkers(parser.Collector.Registry))
|
||||
require.NoError(t, registerCustomMarkers(parser.Collector.Registry))
|
||||
crd.AddKnownTypes(parser)
|
||||
parser.NeedPackage(roots[0])
|
||||
|
||||
return roots, parser
|
||||
}
|
||||
|
||||
func TestAllJSONFieldNamesForTypeIncludesImportedInlineFields(t *testing.T) {
|
||||
const rootPath = "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/root"
|
||||
|
||||
roots, parser := newTestParser(t, rootPath)
|
||||
|
||||
typ := crd.TypeIdent{
|
||||
Package: roots[0],
|
||||
Name: "Wrapper",
|
||||
}
|
||||
info := parser.LookupType(typ.Package, typ.Name)
|
||||
require.NotNil(t, info)
|
||||
|
||||
fields, err := allJSONFieldNamesForType(parser, typ, info, map[crd.TypeIdent][]string{}, map[crd.TypeIdent]bool{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []string{"bar", "baz", "foo"}, fields)
|
||||
}
|
||||
|
||||
func TestOverrideXValidationReplacesExactlyOneMatch(t *testing.T) {
|
||||
schema := &apiextensionsv1.JSONSchemaProps{
|
||||
XValidations: []apiextensionsv1.ValidationRule{
|
||||
{
|
||||
Rule: "old-rule",
|
||||
Message: "phase PreRouting only supports extAuth",
|
||||
},
|
||||
{
|
||||
Rule: "keep-rule",
|
||||
Message: "some other validation",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := applyOverrideXValidation(schema, OverrideXValidation{
|
||||
MessageContains: "phase PreRouting only",
|
||||
Rule: "new-rule",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, apiextensionsv1.ValidationRules{
|
||||
{
|
||||
Rule: "new-rule",
|
||||
Message: "phase PreRouting only supports extAuth",
|
||||
},
|
||||
{
|
||||
Rule: "keep-rule",
|
||||
Message: "some other validation",
|
||||
},
|
||||
}, schema.XValidations)
|
||||
}
|
||||
|
||||
func TestOverrideXValidationRemovesMatchWhenRuleEmpty(t *testing.T) {
|
||||
schema := &apiextensionsv1.JSONSchemaProps{
|
||||
XValidations: []apiextensionsv1.ValidationRule{
|
||||
{
|
||||
Rule: "old-rule",
|
||||
Message: "phase PreRouting only supports extAuth",
|
||||
},
|
||||
{
|
||||
Rule: "keep-rule",
|
||||
Message: "some other validation",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := applyOverrideXValidation(schema, OverrideXValidation{
|
||||
MessageContains: "phase PreRouting only",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, apiextensionsv1.ValidationRules{
|
||||
{
|
||||
Rule: "keep-rule",
|
||||
Message: "some other validation",
|
||||
},
|
||||
}, schema.XValidations)
|
||||
}
|
||||
|
||||
func TestOverrideXValidationErrorsWithoutExactSingleMatch(t *testing.T) {
|
||||
t.Run("no matches", func(t *testing.T) {
|
||||
schema := &apiextensionsv1.JSONSchemaProps{
|
||||
XValidations: []apiextensionsv1.ValidationRule{
|
||||
{Rule: "keep-rule", Message: "some other validation"},
|
||||
},
|
||||
}
|
||||
|
||||
err := applyOverrideXValidation(schema, OverrideXValidation{
|
||||
MessageContains: "phase PreRouting only",
|
||||
Rule: "new-rule",
|
||||
})
|
||||
require.EqualError(t, err, "OverrideXValidation matched 0 rules for messageContains \"phase PreRouting only\", expected exactly 1")
|
||||
})
|
||||
|
||||
t.Run("multiple matches", func(t *testing.T) {
|
||||
schema := &apiextensionsv1.JSONSchemaProps{
|
||||
XValidations: []apiextensionsv1.ValidationRule{
|
||||
{Rule: "old-rule-1", Message: "phase PreRouting only supports extAuth"},
|
||||
{Rule: "old-rule-2", Message: "phase PreRouting only supports rateLimit"},
|
||||
},
|
||||
}
|
||||
|
||||
err := applyOverrideXValidation(schema, OverrideXValidation{
|
||||
MessageContains: "phase PreRouting only",
|
||||
Rule: "new-rule",
|
||||
})
|
||||
require.EqualError(t, err, "OverrideXValidation matched 2 rules for messageContains \"phase PreRouting only\", expected exactly 1")
|
||||
})
|
||||
}
|
||||
|
||||
func TestApplyIfThenOnlyFieldsUsesVisibleSchemaFields(t *testing.T) {
|
||||
schema := &apiextensionsv1.JSONSchemaProps{
|
||||
Properties: map[string]apiextensionsv1.JSONSchemaProps{
|
||||
"foo": {},
|
||||
"bar": {},
|
||||
"baz": {},
|
||||
},
|
||||
}
|
||||
|
||||
err := applyIfThenOnlyFields(schema, sortedPropertyNames(schema), IfThenOnlyFields{
|
||||
If: "has(self.baz)",
|
||||
Fields: []string{"foo", "baz"},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, schema.XValidations, 1)
|
||||
require.Equal(t, "has(self.baz) ? [has(self.bar)].filter(x,x==true).size() == 0 : true", schema.XValidations[0].Rule)
|
||||
require.Equal(t, "only fields in [baz foo] may be set when has(self.baz)", schema.XValidations[0].Message)
|
||||
}
|
||||
|
||||
func TestApplyPostSchemaMarkersToCRDIfThenOnlyFieldsIncludesImportedInlineFields(t *testing.T) {
|
||||
const rootPath = "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/api/v1"
|
||||
|
||||
roots, parser := newTestParser(t, rootPath)
|
||||
metav1Pkg := crd.FindMetav1(roots)
|
||||
require.NotNil(t, metav1Pkg)
|
||||
|
||||
kubeKinds := crd.FindKubeKinds(parser, metav1Pkg)
|
||||
require.Len(t, kubeKinds, 1)
|
||||
|
||||
groupKind := kubeKinds[0]
|
||||
maxDescLen := 0
|
||||
parser.NeedCRDFor(groupKind, &maxDescLen)
|
||||
|
||||
crdObj := parser.CustomResourceDefinitions[groupKind]
|
||||
require.NoError(t, applyPostSchemaMarkersToCRD(parser, &crdObj, groupKind))
|
||||
|
||||
require.Len(t, crdObj.Spec.Versions, 1)
|
||||
rootSchema := crdObj.Spec.Versions[0].Schema.OpenAPIV3Schema
|
||||
require.NotNil(t, rootSchema)
|
||||
|
||||
specSchema, ok := rootSchema.Properties["spec"]
|
||||
require.True(t, ok)
|
||||
trafficSchema, ok := specSchema.Properties["traffic"]
|
||||
require.True(t, ok)
|
||||
|
||||
require.Len(t, trafficSchema.XValidations, 1)
|
||||
require.Equal(t, "when baz is set only foo and baz may be set", trafficSchema.XValidations[0].Message)
|
||||
require.Equal(t, "has(self.baz) ? [has(self.bar)].filter(x,x==true).size() == 0 : true", trafficSchema.XValidations[0].Rule)
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
package embedded
|
||||
|
||||
type InlineFields struct {
|
||||
Foo *string `json:"foo,omitempty"`
|
||||
Bar *string `json:"bar,omitempty"`
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
// +groupName=testdata.agentgateway.dev
|
||||
package v1
|
||||
@ -1,26 +0,0 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:path=widgets,scope=Namespaced
|
||||
type Widget struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WidgetSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
type WidgetSpec struct {
|
||||
Traffic Traffic `json:"traffic,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:validation:IfThenOnlyFields:if="has(self.baz)",fields=foo;baz,message="when baz is set only foo and baz may be set"
|
||||
type Traffic struct {
|
||||
embedded.InlineFields `json:",inline"`
|
||||
Baz *string `json:"baz,omitempty"`
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
package embedded
|
||||
|
||||
type InlineFields struct {
|
||||
Foo *string `json:"foo,omitempty"`
|
||||
Bar *string `json:"bar,omitempty"`
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package root
|
||||
|
||||
import "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/embedded"
|
||||
|
||||
// +kubebuilder:validation:AtLeastOneFieldSet
|
||||
type Wrapper struct {
|
||||
embedded.InlineFields `json:",inline"`
|
||||
Baz *string `json:"baz,omitempty"`
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
Name|Version|License
|
||||
---|---|---
|
||||
[semver/v3](https://github.com/Masterminds/semver)|v3.4.0|MIT License
|
||||
[anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go)|v1.27.1|MIT License
|
||||
[anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go)|v1.22.1|MIT License
|
||||
[retry-go/v4](https://github.com/avast/retry-go)|v4.7.0|MIT License
|
||||
[xds/go](https://github.com/cncf/xds)|v0.0.0-20260202195803-dba9d589def2|Apache License 2.0
|
||||
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260402053555-4e9843ddb8d0|Apache License 2.0
|
||||
[go-control-plane/envoy](https://github.com/envoyproxy/go-control-plane)|v1.37.1-0.20260227072845-439e4fd5530c|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
|
||||
@ -13,12 +13,12 @@ Name|Version|License
|
||||
[google/go-cmp](https://github.com/google/go-cmp)|v0.7.0|BSD 3-clause "New" or "Revised" License
|
||||
[google/uuid](https://github.com/google/uuid)|v1.6.0|BSD 3-clause "New" or "Revised" License
|
||||
[grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)|v1.4.0|Apache License 2.0
|
||||
[kagent-dev/mockllm](https://github.com/kagent-dev/mockllm)|v0.0.5|Apache License 2.0
|
||||
[kagent-dev/mockllm](https://github.com/kagent-dev/mockllm)|v0.0.3|Apache License 2.0
|
||||
[kelseyhightower/envconfig](https://github.com/kelseyhightower/envconfig)|v1.4.0|MIT License
|
||||
[modelcontextprotocol/go-sdk](https://github.com/modelcontextprotocol/go-sdk)|v1.4.1|Apache License 2.0
|
||||
[modelcontextprotocol/go-sdk](https://github.com/modelcontextprotocol/go-sdk)|v1.4.0|Apache License 2.0
|
||||
[ginkgo/v2](https://github.com/onsi/ginkgo)|v2.28.1|MIT License
|
||||
[onsi/gomega](https://github.com/onsi/gomega)|v1.39.1|MIT License
|
||||
[openai-go/v3](https://github.com/openai/openai-go)|v3.29.0|Apache License 2.0
|
||||
[openai-go/v3](https://github.com/openai/openai-go)|v3.21.0|Apache License 2.0
|
||||
[prometheus/client_golang](https://github.com/prometheus/client_golang)|v1.23.2|Apache License 2.0
|
||||
[prometheus/client_model](https://github.com/prometheus/client_model)|v0.6.2|Apache License 2.0
|
||||
[prometheus/common](https://github.com/prometheus/common)|v0.67.5|Apache License 2.0
|
||||
@ -27,29 +27,29 @@ Name|Version|License
|
||||
[go.opencensus.io](https://go.opencensus.io)|v0.24.0|Apache License 2.0
|
||||
[go.uber.org/atomic](https://go.uber.org/atomic)|v1.11.0|MIT License
|
||||
[go.uber.org/zap](https://go.uber.org/zap)|v1.27.1|MIT License
|
||||
[x/net](https://golang.org/x/net)|v0.52.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/sync](https://golang.org/x/sync)|v0.20.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/time](https://golang.org/x/time)|v0.15.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/tools](https://golang.org/x/tools)|v0.43.0|BSD 3-clause "New" or "Revised" License
|
||||
[googleapis/rpc](https://google.golang.org/genproto/googleapis/rpc)|v0.0.0-20260319201613-d00831a3d3e7|Apache License 2.0
|
||||
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.79.3|Apache License 2.0
|
||||
[x/net](https://golang.org/x/net)|v0.50.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/sync](https://golang.org/x/sync)|v0.19.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/time](https://golang.org/x/time)|v0.14.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/tools](https://golang.org/x/tools)|v0.41.0|BSD 3-clause "New" or "Revised" License
|
||||
[googleapis/rpc](https://google.golang.org/genproto/googleapis/rpc)|v0.0.0-20260128011058-8636f8732409|Apache License 2.0
|
||||
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.79.1|Apache License 2.0
|
||||
[google.golang.org/protobuf](https://google.golang.org/protobuf)|v1.36.11|BSD 3-clause "New" or "Revised" License
|
||||
[helm/v3](https://helm.sh/helm/v3)|v3.20.1|Apache License 2.0
|
||||
[istio.io/api](https://istio.io/api)|v1.29.0-alpha.0.0.20260315093121-ce7e56c13e1d|Apache License 2.0
|
||||
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260315093321-a99807642da7|Apache License 2.0
|
||||
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260407051556-b9f70d130eb6|Apache License 2.0
|
||||
[k8s.io/api](https://k8s.io/api)|v0.35.3|Apache License 2.0
|
||||
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.3|Apache License 2.0
|
||||
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.3|Apache License 2.0
|
||||
[k8s.io/client-go](https://k8s.io/client-go)|v0.35.3|Apache License 2.0
|
||||
[klog/v2](https://k8s.io/klog/v2)|v2.140.0|Apache License 2.0
|
||||
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20260319190234-28399d86e0b5|Apache License 2.0
|
||||
[sigs.k8s.io/controller-runtime](https://sigs.k8s.io/controller-runtime)|v0.23.3|Apache License 2.0
|
||||
[helm/v3](https://helm.sh/helm/v3)|v3.20.0|Apache License 2.0
|
||||
[istio.io/api](https://istio.io/api)|v1.29.0-alpha.0.0.20260302212057-b10ab91e9ded|Apache License 2.0
|
||||
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260302212359-b21b30ec7057|Apache License 2.0
|
||||
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260304200359-546e4b34e37b|Apache License 2.0
|
||||
[k8s.io/api](https://k8s.io/api)|v0.35.1|Apache License 2.0
|
||||
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.1|Apache License 2.0
|
||||
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.1|Apache License 2.0
|
||||
[k8s.io/client-go](https://k8s.io/client-go)|v0.35.1|Apache License 2.0
|
||||
[klog/v2](https://k8s.io/klog/v2)|v2.130.1|Apache License 2.0
|
||||
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20260210185600-b8788abfbbc2|Apache License 2.0
|
||||
[sigs.k8s.io/controller-runtime](https://sigs.k8s.io/controller-runtime)|v0.23.1|Apache License 2.0
|
||||
[sigs.k8s.io/controller-tools](https://sigs.k8s.io/controller-tools)|v0.20.1|Apache License 2.0
|
||||
[sigs.k8s.io/gateway-api](https://sigs.k8s.io/gateway-api)|v1.5.1|Apache License 2.0
|
||||
[sigs.k8s.io/gateway-api-inference-extension](https://sigs.k8s.io/gateway-api-inference-extension)|v1.4.0|Apache License 2.0
|
||||
[gateway-api-inference-extension/conformance](https://sigs.k8s.io/gateway-api-inference-extension/conformance)|v0.0.0-20260319184001-6e787dd396f0|Apache License 2.0
|
||||
[gateway-api/conformance](https://sigs.k8s.io/gateway-api/conformance)|v1.5.1|Apache License 2.0
|
||||
[sigs.k8s.io/gateway-api](https://sigs.k8s.io/gateway-api)|v1.5.0|Apache License 2.0
|
||||
[sigs.k8s.io/gateway-api-inference-extension](https://sigs.k8s.io/gateway-api-inference-extension)|v0.0.0-20260220060139-0714e2462e76|Apache License 2.0
|
||||
[gateway-api-inference-extension/conformance](https://sigs.k8s.io/gateway-api-inference-extension/conformance)|v0.0.0-20260220060139-0714e2462e76|Apache License 2.0
|
||||
[gateway-api/conformance](https://sigs.k8s.io/gateway-api/conformance)|v1.5.1-0.20260302214453-c33c5449a202|Apache License 2.0
|
||||
[sigs.k8s.io/yaml](https://sigs.k8s.io/yaml)|v1.6.0|MIT License
|
||||
[cmd/goimports](https://golang.org/x/tools/cmd/goimports)|latest|MIT License
|
||||
[gogo/protobuf](https://github.com/gogo/protobuf)|latest|MIT License
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -56,16 +56,15 @@ spec:
|
||||
description: spec defines the desired state of AgentgatewayParameters.
|
||||
properties:
|
||||
deployment:
|
||||
description: |-
|
||||
`deployment` allows specifying overrides for the generated
|
||||
`Deployment` resource.
|
||||
description: deployment allows specifying overrides for the generated
|
||||
Deployment resource.
|
||||
properties:
|
||||
metadata:
|
||||
description: |-
|
||||
`metadata` defines a subset of object metadata to be customized.
|
||||
`labels` and `annotations` are merged with existing values. If both
|
||||
`GatewayClass` and `Gateway` parameters define the same label or
|
||||
annotation key, the `Gateway` value takes precedence (applied second).
|
||||
metadata defines a subset of object metadata to be customized.
|
||||
Labels and annotations are merged with existing values. If both GatewayClass
|
||||
and Gateway parameters define the same label or annotation key, the Gateway
|
||||
value takes precedence (applied second).
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
@ -87,56 +86,55 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
spec:
|
||||
description: "`spec` provides an opaque mechanism to configure
|
||||
the resource spec.\nThis field accepts a complete or partial
|
||||
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
|
||||
and will be merged with the generated\nconfiguration using **Strategic
|
||||
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
|
||||
are applied after all typed configuration fields from both levels.\nThe
|
||||
full merge order is:\n\n 1. `GatewayClass` typed configuration
|
||||
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
|
||||
overlays\n 4. `Gateway` overlays (can override all previous
|
||||
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
|
||||
merge strategy allows you to override individual fields, merge
|
||||
lists, or delete items\nwithout needing to provide the entire
|
||||
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
|
||||
fields (strings, integers, booleans) in your config will overwrite
|
||||
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
|
||||
with \"merge keys\", like `containers` which merges on `name`,
|
||||
or\n`tolerations` which merges on `key`,\nwill append your items
|
||||
to the generated list, or update existing items if keys match.\n\n**3.
|
||||
Deleting Fields or List Items ($patch: delete):**\nTo remove
|
||||
a field or list item from the generated resource, use the\n`$patch:
|
||||
delete` directive. This works for both map fields and list items,\nand
|
||||
description: "Spec provides an opaque mechanism to configure the
|
||||
resource Spec.\nThis field accepts a complete or partial Kubernetes
|
||||
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
|
||||
with the generated configuration using **Strategic Merge Patch**
|
||||
semantics.\n\n# Application Order\n\nOverlays are applied after
|
||||
all typed configuration fields from both levels.\nThe full merge
|
||||
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
|
||||
Gateway typed configuration fields\n 3. GatewayClass overlays\n
|
||||
4. Gateway overlays (can override all previous values)\n\n#
|
||||
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
|
||||
allows you to override individual fields, merge lists, or delete
|
||||
items\nwithout needing to provide the entire resource definition.\n\n**1.
|
||||
Replacing Values (Scalars):**\nSimple fields (strings, integers,
|
||||
booleans) in your config will overwrite the generated defaults.\n\n**2.
|
||||
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
|
||||
`containers` which merges on `name`, or `tolerations` which
|
||||
merges on `key`)\nwill append your items to the generated list,
|
||||
or update existing items if keys match.\n\n**3. Deleting Fields
|
||||
or List Items ($patch: delete):**\nTo remove a field or list
|
||||
item from the generated resource, use the\n`$patch: delete`
|
||||
directive. This works for both map fields and list items,\nand
|
||||
is the recommended approach because it works with both client-side\nand
|
||||
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ # Delete pod-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
|
||||
\ $patch: delete\n\t containers:\n\t # Be sure
|
||||
to use the correct proxy name here or you will add a\n\t #
|
||||
container instead of modifying a container.\n\t - name:
|
||||
proxy-name\n\t # Delete container-level securityContext\n\t
|
||||
\ securityContext:\n\t $patch: delete\n\n**4.
|
||||
Null Values (server-side apply only):**\nSetting a field to
|
||||
`null` can also remove it, but this ONLY works with\n`kubectl
|
||||
apply --server-side` or equivalent. With regular client-side\n`kubectl
|
||||
apply`, null values are stripped by kubectl before reaching\nthe
|
||||
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
|
||||
consistent behavior across both apply modes.\n\n\tspec:\n\t
|
||||
\ template:\n\t spec:\n\t nodeSelector: null # Removes
|
||||
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
|
||||
Entirely ($patch: replace):**\nTo replace an entire map with
|
||||
your values (instead of merging), use `$patch: replace`.\nThis
|
||||
removes all existing keys and replaces them with only your specified
|
||||
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
|
||||
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
|
||||
Replacing Lists Entirely ($patch: replace):**\nIf you want to
|
||||
strictly define a list and ignore all generated defaults, use
|
||||
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
|
||||
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
|
||||
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
|
||||
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
|
||||
TCP"
|
||||
\ $patch: delete\n\t containers:\n\t # Be
|
||||
sure to use the correct proxy name here or you will add a container
|
||||
instead of modifying a container:\n\t - name: proxy-name\n\t
|
||||
\ # Delete container-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\n**4. Null Values (server-side
|
||||
apply only):**\nSetting a field to `null` can also remove it,
|
||||
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
|
||||
With regular client-side\n`kubectl apply`, null values are stripped
|
||||
by kubectl before reaching\nthe API server, so the deletion
|
||||
won't occur. Prefer `$patch: delete`\nfor consistent behavior
|
||||
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ nodeSelector: null # Removes nodeSelector (server-side
|
||||
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
|
||||
replace an entire map with your values (instead of merging),
|
||||
use `$patch: replace`.\nThis removes all existing keys and replaces
|
||||
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
|
||||
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
|
||||
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
|
||||
($patch: replace):**\nIf you want to strictly define a list
|
||||
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
|
||||
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
|
||||
name: http\n\t port: 80\n\t targetPort: 8080\n\t
|
||||
\ protocol: TCP\n\t - name: https\n\t port:
|
||||
443\n\t targetPort: 8443\n\t protocol: TCP"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
@ -144,16 +142,13 @@ spec:
|
||||
description: |-
|
||||
The container environment variables. These override any existing
|
||||
values. If you want to delete an environment variable entirely, use
|
||||
`$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
|
||||
`$patch: delete` with AgentgatewayParametersOverlays instead. Note that
|
||||
[variable
|
||||
expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
|
||||
does apply, but is highly discouraged -- to set dependent environment
|
||||
variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
|
||||
`$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
variables, you can use $(VAR_NAME), but it's highly
|
||||
discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
`$(VAR_NAME)`.
|
||||
|
||||
If `SESSION_KEY` is specified, it takes precedence over the
|
||||
controller-managed per-`Gateway` session key `Secret`.
|
||||
items:
|
||||
description: EnvVar represents an environment variable present in
|
||||
a Container.
|
||||
@ -311,18 +306,17 @@ spec:
|
||||
type: array
|
||||
horizontalPodAutoscaler:
|
||||
description: |-
|
||||
`horizontalPodAutoscaler` allows creating a `HorizontalPodAutoscaler`
|
||||
for the agentgateway proxy. If absent, no HPA is created. If present, an
|
||||
HPA is created with its `scaleTargetRef` automatically configured to
|
||||
target the agentgateway proxy `Deployment`. The `metadata` and `spec`
|
||||
fields from this overlay are applied to the generated HPA.
|
||||
horizontalPodAutoscaler allows creating a HorizontalPodAutoscaler for the agentgateway proxy.
|
||||
If absent, no HPA is created. If present, an HPA is created with its scaleTargetRef
|
||||
automatically configured to target the agentgateway proxy Deployment.
|
||||
The metadata and spec fields from this overlay are applied to the generated HPA.
|
||||
properties:
|
||||
metadata:
|
||||
description: |-
|
||||
`metadata` defines a subset of object metadata to be customized.
|
||||
`labels` and `annotations` are merged with existing values. If both
|
||||
`GatewayClass` and `Gateway` parameters define the same label or
|
||||
annotation key, the `Gateway` value takes precedence (applied second).
|
||||
metadata defines a subset of object metadata to be customized.
|
||||
Labels and annotations are merged with existing values. If both GatewayClass
|
||||
and Gateway parameters define the same label or annotation key, the Gateway
|
||||
value takes precedence (applied second).
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
@ -344,56 +338,55 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
spec:
|
||||
description: "`spec` provides an opaque mechanism to configure
|
||||
the resource spec.\nThis field accepts a complete or partial
|
||||
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
|
||||
and will be merged with the generated\nconfiguration using **Strategic
|
||||
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
|
||||
are applied after all typed configuration fields from both levels.\nThe
|
||||
full merge order is:\n\n 1. `GatewayClass` typed configuration
|
||||
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
|
||||
overlays\n 4. `Gateway` overlays (can override all previous
|
||||
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
|
||||
merge strategy allows you to override individual fields, merge
|
||||
lists, or delete items\nwithout needing to provide the entire
|
||||
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
|
||||
fields (strings, integers, booleans) in your config will overwrite
|
||||
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
|
||||
with \"merge keys\", like `containers` which merges on `name`,
|
||||
or\n`tolerations` which merges on `key`,\nwill append your items
|
||||
to the generated list, or update existing items if keys match.\n\n**3.
|
||||
Deleting Fields or List Items ($patch: delete):**\nTo remove
|
||||
a field or list item from the generated resource, use the\n`$patch:
|
||||
delete` directive. This works for both map fields and list items,\nand
|
||||
description: "Spec provides an opaque mechanism to configure the
|
||||
resource Spec.\nThis field accepts a complete or partial Kubernetes
|
||||
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
|
||||
with the generated configuration using **Strategic Merge Patch**
|
||||
semantics.\n\n# Application Order\n\nOverlays are applied after
|
||||
all typed configuration fields from both levels.\nThe full merge
|
||||
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
|
||||
Gateway typed configuration fields\n 3. GatewayClass overlays\n
|
||||
4. Gateway overlays (can override all previous values)\n\n#
|
||||
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
|
||||
allows you to override individual fields, merge lists, or delete
|
||||
items\nwithout needing to provide the entire resource definition.\n\n**1.
|
||||
Replacing Values (Scalars):**\nSimple fields (strings, integers,
|
||||
booleans) in your config will overwrite the generated defaults.\n\n**2.
|
||||
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
|
||||
`containers` which merges on `name`, or `tolerations` which
|
||||
merges on `key`)\nwill append your items to the generated list,
|
||||
or update existing items if keys match.\n\n**3. Deleting Fields
|
||||
or List Items ($patch: delete):**\nTo remove a field or list
|
||||
item from the generated resource, use the\n`$patch: delete`
|
||||
directive. This works for both map fields and list items,\nand
|
||||
is the recommended approach because it works with both client-side\nand
|
||||
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ # Delete pod-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
|
||||
\ $patch: delete\n\t containers:\n\t # Be sure
|
||||
to use the correct proxy name here or you will add a\n\t #
|
||||
container instead of modifying a container.\n\t - name:
|
||||
proxy-name\n\t # Delete container-level securityContext\n\t
|
||||
\ securityContext:\n\t $patch: delete\n\n**4.
|
||||
Null Values (server-side apply only):**\nSetting a field to
|
||||
`null` can also remove it, but this ONLY works with\n`kubectl
|
||||
apply --server-side` or equivalent. With regular client-side\n`kubectl
|
||||
apply`, null values are stripped by kubectl before reaching\nthe
|
||||
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
|
||||
consistent behavior across both apply modes.\n\n\tspec:\n\t
|
||||
\ template:\n\t spec:\n\t nodeSelector: null # Removes
|
||||
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
|
||||
Entirely ($patch: replace):**\nTo replace an entire map with
|
||||
your values (instead of merging), use `$patch: replace`.\nThis
|
||||
removes all existing keys and replaces them with only your specified
|
||||
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
|
||||
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
|
||||
Replacing Lists Entirely ($patch: replace):**\nIf you want to
|
||||
strictly define a list and ignore all generated defaults, use
|
||||
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
|
||||
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
|
||||
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
|
||||
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
|
||||
TCP"
|
||||
\ $patch: delete\n\t containers:\n\t # Be
|
||||
sure to use the correct proxy name here or you will add a container
|
||||
instead of modifying a container:\n\t - name: proxy-name\n\t
|
||||
\ # Delete container-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\n**4. Null Values (server-side
|
||||
apply only):**\nSetting a field to `null` can also remove it,
|
||||
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
|
||||
With regular client-side\n`kubectl apply`, null values are stripped
|
||||
by kubectl before reaching\nthe API server, so the deletion
|
||||
won't occur. Prefer `$patch: delete`\nfor consistent behavior
|
||||
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ nodeSelector: null # Removes nodeSelector (server-side
|
||||
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
|
||||
replace an entire map with your values (instead of merging),
|
||||
use `$patch: replace`.\nThis removes all existing keys and replaces
|
||||
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
|
||||
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
|
||||
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
|
||||
($patch: replace):**\nIf you want to strictly define a list
|
||||
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
|
||||
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
|
||||
name: http\n\t port: 80\n\t targetPort: 8080\n\t
|
||||
\ protocol: TCP\n\t - name: https\n\t port:
|
||||
443\n\t targetPort: 8443\n\t protocol: TCP"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
@ -436,9 +429,8 @@ spec:
|
||||
type: string
|
||||
type: object
|
||||
logging:
|
||||
description: |-
|
||||
`logging` configuration for Agentgateway. By default, all logs are set to
|
||||
`info` level.
|
||||
description: logging configuration for Agentgateway. By default, all
|
||||
logs are set to "info" level.
|
||||
properties:
|
||||
format:
|
||||
description: The default logging format is text.
|
||||
@ -448,25 +440,24 @@ spec:
|
||||
type: string
|
||||
level:
|
||||
description: |-
|
||||
Logging level in standard `RUST_LOG` syntax, for example `info` (the
|
||||
default), or a comma-separated per-module setting such as
|
||||
`rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn`.
|
||||
Logging level in standard RUST_LOG syntax, e.g. 'info', the default, or
|
||||
by module, comma-separated. E.g.,
|
||||
"rmcp=warn,hickory_server::server::server_future=off,typespec_client_core::http::policies::logging=warn"
|
||||
type: string
|
||||
type: object
|
||||
podDisruptionBudget:
|
||||
description: |-
|
||||
`podDisruptionBudget` allows creating a `PodDisruptionBudget` for the
|
||||
agentgateway proxy. If absent, no PDB is created. If present, a PDB is
|
||||
created with its selector automatically configured to target the
|
||||
agentgateway proxy `Deployment`. The `metadata` and `spec` fields from
|
||||
this overlay are applied to the generated PDB.
|
||||
podDisruptionBudget allows creating a PodDisruptionBudget for the agentgateway proxy.
|
||||
If absent, no PDB is created. If present, a PDB is created with its selector
|
||||
automatically configured to target the agentgateway proxy Deployment.
|
||||
The metadata and spec fields from this overlay are applied to the generated PDB.
|
||||
properties:
|
||||
metadata:
|
||||
description: |-
|
||||
`metadata` defines a subset of object metadata to be customized.
|
||||
`labels` and `annotations` are merged with existing values. If both
|
||||
`GatewayClass` and `Gateway` parameters define the same label or
|
||||
annotation key, the `Gateway` value takes precedence (applied second).
|
||||
metadata defines a subset of object metadata to be customized.
|
||||
Labels and annotations are merged with existing values. If both GatewayClass
|
||||
and Gateway parameters define the same label or annotation key, the Gateway
|
||||
value takes precedence (applied second).
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
@ -488,73 +479,71 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
spec:
|
||||
description: "`spec` provides an opaque mechanism to configure
|
||||
the resource spec.\nThis field accepts a complete or partial
|
||||
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
|
||||
and will be merged with the generated\nconfiguration using **Strategic
|
||||
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
|
||||
are applied after all typed configuration fields from both levels.\nThe
|
||||
full merge order is:\n\n 1. `GatewayClass` typed configuration
|
||||
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
|
||||
overlays\n 4. `Gateway` overlays (can override all previous
|
||||
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
|
||||
merge strategy allows you to override individual fields, merge
|
||||
lists, or delete items\nwithout needing to provide the entire
|
||||
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
|
||||
fields (strings, integers, booleans) in your config will overwrite
|
||||
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
|
||||
with \"merge keys\", like `containers` which merges on `name`,
|
||||
or\n`tolerations` which merges on `key`,\nwill append your items
|
||||
to the generated list, or update existing items if keys match.\n\n**3.
|
||||
Deleting Fields or List Items ($patch: delete):**\nTo remove
|
||||
a field or list item from the generated resource, use the\n`$patch:
|
||||
delete` directive. This works for both map fields and list items,\nand
|
||||
description: "Spec provides an opaque mechanism to configure the
|
||||
resource Spec.\nThis field accepts a complete or partial Kubernetes
|
||||
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
|
||||
with the generated configuration using **Strategic Merge Patch**
|
||||
semantics.\n\n# Application Order\n\nOverlays are applied after
|
||||
all typed configuration fields from both levels.\nThe full merge
|
||||
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
|
||||
Gateway typed configuration fields\n 3. GatewayClass overlays\n
|
||||
4. Gateway overlays (can override all previous values)\n\n#
|
||||
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
|
||||
allows you to override individual fields, merge lists, or delete
|
||||
items\nwithout needing to provide the entire resource definition.\n\n**1.
|
||||
Replacing Values (Scalars):**\nSimple fields (strings, integers,
|
||||
booleans) in your config will overwrite the generated defaults.\n\n**2.
|
||||
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
|
||||
`containers` which merges on `name`, or `tolerations` which
|
||||
merges on `key`)\nwill append your items to the generated list,
|
||||
or update existing items if keys match.\n\n**3. Deleting Fields
|
||||
or List Items ($patch: delete):**\nTo remove a field or list
|
||||
item from the generated resource, use the\n`$patch: delete`
|
||||
directive. This works for both map fields and list items,\nand
|
||||
is the recommended approach because it works with both client-side\nand
|
||||
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ # Delete pod-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
|
||||
\ $patch: delete\n\t containers:\n\t # Be sure
|
||||
to use the correct proxy name here or you will add a\n\t #
|
||||
container instead of modifying a container.\n\t - name:
|
||||
proxy-name\n\t # Delete container-level securityContext\n\t
|
||||
\ securityContext:\n\t $patch: delete\n\n**4.
|
||||
Null Values (server-side apply only):**\nSetting a field to
|
||||
`null` can also remove it, but this ONLY works with\n`kubectl
|
||||
apply --server-side` or equivalent. With regular client-side\n`kubectl
|
||||
apply`, null values are stripped by kubectl before reaching\nthe
|
||||
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
|
||||
consistent behavior across both apply modes.\n\n\tspec:\n\t
|
||||
\ template:\n\t spec:\n\t nodeSelector: null # Removes
|
||||
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
|
||||
Entirely ($patch: replace):**\nTo replace an entire map with
|
||||
your values (instead of merging), use `$patch: replace`.\nThis
|
||||
removes all existing keys and replaces them with only your specified
|
||||
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
|
||||
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
|
||||
Replacing Lists Entirely ($patch: replace):**\nIf you want to
|
||||
strictly define a list and ignore all generated defaults, use
|
||||
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
|
||||
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
|
||||
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
|
||||
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
|
||||
TCP"
|
||||
\ $patch: delete\n\t containers:\n\t # Be
|
||||
sure to use the correct proxy name here or you will add a container
|
||||
instead of modifying a container:\n\t - name: proxy-name\n\t
|
||||
\ # Delete container-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\n**4. Null Values (server-side
|
||||
apply only):**\nSetting a field to `null` can also remove it,
|
||||
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
|
||||
With regular client-side\n`kubectl apply`, null values are stripped
|
||||
by kubectl before reaching\nthe API server, so the deletion
|
||||
won't occur. Prefer `$patch: delete`\nfor consistent behavior
|
||||
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ nodeSelector: null # Removes nodeSelector (server-side
|
||||
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
|
||||
replace an entire map with your values (instead of merging),
|
||||
use `$patch: replace`.\nThis removes all existing keys and replaces
|
||||
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
|
||||
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
|
||||
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
|
||||
($patch: replace):**\nIf you want to strictly define a list
|
||||
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
|
||||
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
|
||||
name: http\n\t port: 80\n\t targetPort: 8080\n\t
|
||||
\ protocol: TCP\n\t - name: https\n\t port:
|
||||
443\n\t targetPort: 8443\n\t protocol: TCP"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
rawConfig:
|
||||
description: "`rawConfig` provides an opaque mechanism to configure
|
||||
the `agentgateway`\nconfig file. The `agentgateway` binary has a
|
||||
`-f` option to specify a\nconfig file, and this field supplies that
|
||||
file. This will be merged with\nconfiguration derived from typed
|
||||
fields like `logging.format`, and those\ntyped fields will take
|
||||
precedence.\n\nExample:\n\n\trawConfig:\n\t binds:\n\t - port:
|
||||
3000\n\t listeners:\n\t - routes:\n\t - policies:\n\t
|
||||
\ cors:\n\t allowOrigins:\n\t - \"*\"\n\t
|
||||
\ allowHeaders:\n\t - mcp-protocol-version\n\t
|
||||
\ - content-type\n\t - cache-control\n\t backends:\n\t
|
||||
\ - mcp:\n\t targets:\n\t - name: everything\n\t
|
||||
\ stdio:\n\t cmd: npx\n\t args:
|
||||
[\"@modelcontextprotocol/server-everything\"]"
|
||||
description: "rawConfig provides an opaque mechanism to configure
|
||||
the agentgateway\nconfig file (the agentgateway binary has a '-f'
|
||||
option to specify a\nconfig file, and this is that file). This
|
||||
will be merged with\nconfiguration derived from typed fields like\nAgentgatewayParametersLogging.Format,
|
||||
and those typed fields will take\nprecedence.\n\nExample:\n\n\trawConfig:\n\t
|
||||
\ binds:\n\t - port: 3000\n\t listeners:\n\t - routes:\n\t
|
||||
\ - policies:\n\t cors:\n\t allowOrigins:\n\t
|
||||
\ - \"*\"\n\t allowHeaders:\n\t -
|
||||
mcp-protocol-version\n\t - content-type\n\t -
|
||||
cache-control\n\t backends:\n\t - mcp:\n\t targets:\n\t
|
||||
\ - name: everything\n\t stdio:\n\t cmd:
|
||||
npx\n\t args: [\"@modelcontextprotocol/server-everything\"]"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
resources:
|
||||
@ -620,16 +609,15 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
service:
|
||||
description: |-
|
||||
`service` allows specifying overrides for the generated `Service`
|
||||
resource.
|
||||
description: service allows specifying overrides for the generated
|
||||
Service resource.
|
||||
properties:
|
||||
metadata:
|
||||
description: |-
|
||||
`metadata` defines a subset of object metadata to be customized.
|
||||
`labels` and `annotations` are merged with existing values. If both
|
||||
`GatewayClass` and `Gateway` parameters define the same label or
|
||||
annotation key, the `Gateway` value takes precedence (applied second).
|
||||
metadata defines a subset of object metadata to be customized.
|
||||
Labels and annotations are merged with existing values. If both GatewayClass
|
||||
and Gateway parameters define the same label or annotation key, the Gateway
|
||||
value takes precedence (applied second).
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
@ -651,70 +639,68 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
spec:
|
||||
description: "`spec` provides an opaque mechanism to configure
|
||||
the resource spec.\nThis field accepts a complete or partial
|
||||
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
|
||||
and will be merged with the generated\nconfiguration using **Strategic
|
||||
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
|
||||
are applied after all typed configuration fields from both levels.\nThe
|
||||
full merge order is:\n\n 1. `GatewayClass` typed configuration
|
||||
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
|
||||
overlays\n 4. `Gateway` overlays (can override all previous
|
||||
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
|
||||
merge strategy allows you to override individual fields, merge
|
||||
lists, or delete items\nwithout needing to provide the entire
|
||||
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
|
||||
fields (strings, integers, booleans) in your config will overwrite
|
||||
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
|
||||
with \"merge keys\", like `containers` which merges on `name`,
|
||||
or\n`tolerations` which merges on `key`,\nwill append your items
|
||||
to the generated list, or update existing items if keys match.\n\n**3.
|
||||
Deleting Fields or List Items ($patch: delete):**\nTo remove
|
||||
a field or list item from the generated resource, use the\n`$patch:
|
||||
delete` directive. This works for both map fields and list items,\nand
|
||||
description: "Spec provides an opaque mechanism to configure the
|
||||
resource Spec.\nThis field accepts a complete or partial Kubernetes
|
||||
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
|
||||
with the generated configuration using **Strategic Merge Patch**
|
||||
semantics.\n\n# Application Order\n\nOverlays are applied after
|
||||
all typed configuration fields from both levels.\nThe full merge
|
||||
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
|
||||
Gateway typed configuration fields\n 3. GatewayClass overlays\n
|
||||
4. Gateway overlays (can override all previous values)\n\n#
|
||||
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
|
||||
allows you to override individual fields, merge lists, or delete
|
||||
items\nwithout needing to provide the entire resource definition.\n\n**1.
|
||||
Replacing Values (Scalars):**\nSimple fields (strings, integers,
|
||||
booleans) in your config will overwrite the generated defaults.\n\n**2.
|
||||
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
|
||||
`containers` which merges on `name`, or `tolerations` which
|
||||
merges on `key`)\nwill append your items to the generated list,
|
||||
or update existing items if keys match.\n\n**3. Deleting Fields
|
||||
or List Items ($patch: delete):**\nTo remove a field or list
|
||||
item from the generated resource, use the\n`$patch: delete`
|
||||
directive. This works for both map fields and list items,\nand
|
||||
is the recommended approach because it works with both client-side\nand
|
||||
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ # Delete pod-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
|
||||
\ $patch: delete\n\t containers:\n\t # Be sure
|
||||
to use the correct proxy name here or you will add a\n\t #
|
||||
container instead of modifying a container.\n\t - name:
|
||||
proxy-name\n\t # Delete container-level securityContext\n\t
|
||||
\ securityContext:\n\t $patch: delete\n\n**4.
|
||||
Null Values (server-side apply only):**\nSetting a field to
|
||||
`null` can also remove it, but this ONLY works with\n`kubectl
|
||||
apply --server-side` or equivalent. With regular client-side\n`kubectl
|
||||
apply`, null values are stripped by kubectl before reaching\nthe
|
||||
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
|
||||
consistent behavior across both apply modes.\n\n\tspec:\n\t
|
||||
\ template:\n\t spec:\n\t nodeSelector: null # Removes
|
||||
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
|
||||
Entirely ($patch: replace):**\nTo replace an entire map with
|
||||
your values (instead of merging), use `$patch: replace`.\nThis
|
||||
removes all existing keys and replaces them with only your specified
|
||||
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
|
||||
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
|
||||
Replacing Lists Entirely ($patch: replace):**\nIf you want to
|
||||
strictly define a list and ignore all generated defaults, use
|
||||
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
|
||||
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
|
||||
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
|
||||
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
|
||||
TCP"
|
||||
\ $patch: delete\n\t containers:\n\t # Be
|
||||
sure to use the correct proxy name here or you will add a container
|
||||
instead of modifying a container:\n\t - name: proxy-name\n\t
|
||||
\ # Delete container-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\n**4. Null Values (server-side
|
||||
apply only):**\nSetting a field to `null` can also remove it,
|
||||
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
|
||||
With regular client-side\n`kubectl apply`, null values are stripped
|
||||
by kubectl before reaching\nthe API server, so the deletion
|
||||
won't occur. Prefer `$patch: delete`\nfor consistent behavior
|
||||
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ nodeSelector: null # Removes nodeSelector (server-side
|
||||
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
|
||||
replace an entire map with your values (instead of merging),
|
||||
use `$patch: replace`.\nThis removes all existing keys and replaces
|
||||
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
|
||||
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
|
||||
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
|
||||
($patch: replace):**\nIf you want to strictly define a list
|
||||
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
|
||||
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
|
||||
name: http\n\t port: 80\n\t targetPort: 8080\n\t
|
||||
\ protocol: TCP\n\t - name: https\n\t port:
|
||||
443\n\t targetPort: 8443\n\t protocol: TCP"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
serviceAccount:
|
||||
description: |-
|
||||
`serviceAccount` allows specifying overrides for the generated
|
||||
`ServiceAccount` resource.
|
||||
description: serviceAccount allows specifying overrides for the generated
|
||||
ServiceAccount resource.
|
||||
properties:
|
||||
metadata:
|
||||
description: |-
|
||||
`metadata` defines a subset of object metadata to be customized.
|
||||
`labels` and `annotations` are merged with existing values. If both
|
||||
`GatewayClass` and `Gateway` parameters define the same label or
|
||||
annotation key, the `Gateway` value takes precedence (applied second).
|
||||
metadata defines a subset of object metadata to be customized.
|
||||
Labels and annotations are merged with existing values. If both GatewayClass
|
||||
and Gateway parameters define the same label or annotation key, the Gateway
|
||||
value takes precedence (applied second).
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
@ -736,72 +722,70 @@ spec:
|
||||
type: object
|
||||
type: object
|
||||
spec:
|
||||
description: "`spec` provides an opaque mechanism to configure
|
||||
the resource spec.\nThis field accepts a complete or partial
|
||||
Kubernetes resource spec, such\nas `PodSpec` or `ServiceSpec`,
|
||||
and will be merged with the generated\nconfiguration using **Strategic
|
||||
Merge Patch** semantics.\n\n# Application Order\n\nOverlays
|
||||
are applied after all typed configuration fields from both levels.\nThe
|
||||
full merge order is:\n\n 1. `GatewayClass` typed configuration
|
||||
fields\n 2. `Gateway` typed configuration fields\n 3. `GatewayClass`
|
||||
overlays\n 4. `Gateway` overlays (can override all previous
|
||||
values)\n\n# Strategic Merge Patch & Deletion Guide\n\nThis
|
||||
merge strategy allows you to override individual fields, merge
|
||||
lists, or delete items\nwithout needing to provide the entire
|
||||
resource definition.\n\n**1. Replacing Values (Scalars):**\nSimple
|
||||
fields (strings, integers, booleans) in your config will overwrite
|
||||
the generated defaults.\n\n**2. Merging Lists (Append/Merge):**\nLists
|
||||
with \"merge keys\", like `containers` which merges on `name`,
|
||||
or\n`tolerations` which merges on `key`,\nwill append your items
|
||||
to the generated list, or update existing items if keys match.\n\n**3.
|
||||
Deleting Fields or List Items ($patch: delete):**\nTo remove
|
||||
a field or list item from the generated resource, use the\n`$patch:
|
||||
delete` directive. This works for both map fields and list items,\nand
|
||||
description: "Spec provides an opaque mechanism to configure the
|
||||
resource Spec.\nThis field accepts a complete or partial Kubernetes
|
||||
resource spec (e.g., PodSpec, ServiceSpec)\nand will be merged
|
||||
with the generated configuration using **Strategic Merge Patch**
|
||||
semantics.\n\n# Application Order\n\nOverlays are applied after
|
||||
all typed configuration fields from both levels.\nThe full merge
|
||||
order is:\n\n 1. GatewayClass typed configuration fields\n 2.
|
||||
Gateway typed configuration fields\n 3. GatewayClass overlays\n
|
||||
4. Gateway overlays (can override all previous values)\n\n#
|
||||
Strategic Merge Patch & Deletion Guide\n\nThis merge strategy
|
||||
allows you to override individual fields, merge lists, or delete
|
||||
items\nwithout needing to provide the entire resource definition.\n\n**1.
|
||||
Replacing Values (Scalars):**\nSimple fields (strings, integers,
|
||||
booleans) in your config will overwrite the generated defaults.\n\n**2.
|
||||
Merging Lists (Append/Merge):**\nLists with \"merge keys\" (like
|
||||
`containers` which merges on `name`, or `tolerations` which
|
||||
merges on `key`)\nwill append your items to the generated list,
|
||||
or update existing items if keys match.\n\n**3. Deleting Fields
|
||||
or List Items ($patch: delete):**\nTo remove a field or list
|
||||
item from the generated resource, use the\n`$patch: delete`
|
||||
directive. This works for both map fields and list items,\nand
|
||||
is the recommended approach because it works with both client-side\nand
|
||||
server-side apply.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ # Delete pod-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\t # Delete nodeSelector\n\t nodeSelector:\n\t
|
||||
\ $patch: delete\n\t containers:\n\t # Be sure
|
||||
to use the correct proxy name here or you will add a\n\t #
|
||||
container instead of modifying a container.\n\t - name:
|
||||
proxy-name\n\t # Delete container-level securityContext\n\t
|
||||
\ securityContext:\n\t $patch: delete\n\n**4.
|
||||
Null Values (server-side apply only):**\nSetting a field to
|
||||
`null` can also remove it, but this ONLY works with\n`kubectl
|
||||
apply --server-side` or equivalent. With regular client-side\n`kubectl
|
||||
apply`, null values are stripped by kubectl before reaching\nthe
|
||||
API server, so the deletion won't occur. Prefer `$patch: delete`\nfor
|
||||
consistent behavior across both apply modes.\n\n\tspec:\n\t
|
||||
\ template:\n\t spec:\n\t nodeSelector: null # Removes
|
||||
nodeSelector (server-side apply only!)\n\n**5. Replacing Maps
|
||||
Entirely ($patch: replace):**\nTo replace an entire map with
|
||||
your values (instead of merging), use `$patch: replace`.\nThis
|
||||
removes all existing keys and replaces them with only your specified
|
||||
keys.\n\n\tspec:\n\t template:\n\t spec:\n\t nodeSelector:\n\t
|
||||
\ $patch: replace\n\t custom-key: custom-value\n\n**6.
|
||||
Replacing Lists Entirely ($patch: replace):**\nIf you want to
|
||||
strictly define a list and ignore all generated defaults, use
|
||||
`$patch: replace`.\n\n\tservice:\n\t spec:\n\t ports:\n\t
|
||||
\ - $patch: replace\n\t - name: http\n\t port: 80\n\t
|
||||
\ targetPort: 8080\n\t protocol: TCP\n\t - name:
|
||||
https\n\t port: 443\n\t targetPort: 8443\n\t protocol:
|
||||
TCP"
|
||||
\ $patch: delete\n\t containers:\n\t # Be
|
||||
sure to use the correct proxy name here or you will add a container
|
||||
instead of modifying a container:\n\t - name: proxy-name\n\t
|
||||
\ # Delete container-level securityContext\n\t securityContext:\n\t
|
||||
\ $patch: delete\n\n**4. Null Values (server-side
|
||||
apply only):**\nSetting a field to `null` can also remove it,
|
||||
but this ONLY works with\n`kubectl apply --server-side` or equivalent.
|
||||
With regular client-side\n`kubectl apply`, null values are stripped
|
||||
by kubectl before reaching\nthe API server, so the deletion
|
||||
won't occur. Prefer `$patch: delete`\nfor consistent behavior
|
||||
across both apply modes.\n\n\tspec:\n\t template:\n\t spec:\n\t
|
||||
\ nodeSelector: null # Removes nodeSelector (server-side
|
||||
apply only!)\n\n**5. Replacing Maps Entirely ($patch: replace):**\nTo
|
||||
replace an entire map with your values (instead of merging),
|
||||
use `$patch: replace`.\nThis removes all existing keys and replaces
|
||||
them with only your specified keys.\n\n\tspec:\n\t template:\n\t
|
||||
\ spec:\n\t nodeSelector:\n\t $patch: replace\n\t
|
||||
\ custom-key: custom-value\n\n**6. Replacing Lists Entirely
|
||||
($patch: replace):**\nIf you want to strictly define a list
|
||||
and ignore all generated defaults, use `$patch: replace`.\n\n\tservice:\n\t
|
||||
\ spec:\n\t ports:\n\t - $patch: replace\n\t -
|
||||
name: http\n\t port: 80\n\t targetPort: 8080\n\t
|
||||
\ protocol: TCP\n\t - name: https\n\t port:
|
||||
443\n\t targetPort: 8443\n\t protocol: TCP"
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
shutdown:
|
||||
description: |-
|
||||
Shutdown delay configuration. How graceful planned or unplanned data
|
||||
Shutdown delay configuration. How graceful planned or unplanned data
|
||||
plane changes happen is in tension with how quickly rollouts of the data
|
||||
plane complete. How long a data plane pod must wait for shutdown to be
|
||||
perfectly graceful depends on how you have configured your `Gateway`
|
||||
resources.
|
||||
perfectly graceful depends on how you have configured your Gateways.
|
||||
properties:
|
||||
max:
|
||||
description: |-
|
||||
Maximum time (in seconds) to wait before allowing Agentgateway to
|
||||
terminate. Refer to the `TERMINATION_GRACE_PERIOD_SECONDS`
|
||||
environment variable for details.
|
||||
terminate. Refer to the TERMINATION_GRACE_PERIOD_SECONDS environment
|
||||
variable for details.
|
||||
format: int64
|
||||
maximum: 31536000
|
||||
minimum: 0
|
||||
@ -809,8 +793,8 @@ spec:
|
||||
min:
|
||||
description: |-
|
||||
Minimum time (in seconds) to wait before allowing Agentgateway to
|
||||
terminate. Refer to the `CONNECTION_MIN_TERMINATION_DEADLINE`
|
||||
environment variable for details.
|
||||
terminate. Refer to the CONNECTION_MIN_TERMINATION_DEADLINE environment
|
||||
variable for details.
|
||||
format: int64
|
||||
maximum: 31536000
|
||||
minimum: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -44,14 +44,6 @@ spec:
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- else }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
{{- end }}
|
||||
image: "{{ .Values.controller.image.registry | default .Values.image.registry }}/{{ .Values.controller.image.repository }}:{{ include "agentgateway.imageTag" (.Values.controller.image.tag | default .Values.image.tag | default .Chart.AppVersion) }}"
|
||||
imagePullPolicy: {{ .Values.controller.image.pullPolicy | default .Values.image.pullPolicy }}
|
||||
@ -112,30 +104,9 @@ spec:
|
||||
- name: AGW_DISCOVERY_NAMESPACE_SELECTORS
|
||||
value: {{ .Values.discoveryNamespaceSelectors | toJson | quote }}
|
||||
{{- if .Values.controller.extraEnv }}
|
||||
{{- $extraEnv := .Values.controller.extraEnv }}
|
||||
{{- range $key := keys $extraEnv | sortAlpha }}
|
||||
{{- $value := index $extraEnv $key }}
|
||||
{{- range $key, $value := .Values.controller.extraEnv }}
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "map" $value }}
|
||||
{{- $hasValue := hasKey $value "value" }}
|
||||
{{- $hasValueFrom := hasKey $value "valueFrom" }}
|
||||
{{- if and $hasValue $hasValueFrom }}
|
||||
{{- fail (printf "controller.extraEnv.%s cannot set both value and valueFrom" $key) }}
|
||||
{{- else if $hasValue }}
|
||||
value: {{ get $value "value" | quote }}
|
||||
{{- else if $hasValueFrom }}
|
||||
{{- $valueFrom := get $value "valueFrom" }}
|
||||
{{- if not $valueFrom }}
|
||||
{{- fail (printf "controller.extraEnv.%s.valueFrom must be non-empty" $key) }}
|
||||
{{- end }}
|
||||
valueFrom:
|
||||
{{- toYaml $valueFrom | nindent 16 }}
|
||||
{{- else }}
|
||||
{{- fail (printf "controller.extraEnv.%s must set either value or valueFrom" $key) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.inferenceExtension.enabled }}
|
||||
|
||||
@ -112,16 +112,6 @@ controller:
|
||||
# -- Traffic distribution.
|
||||
trafficDistribution: ""
|
||||
# -- Add extra environment variables to the controller container.
|
||||
# Supports either a direct scalar value:
|
||||
# extraEnv:
|
||||
# LOG_FORMAT: json
|
||||
# Or Kubernetes valueFrom sources:
|
||||
# extraEnv:
|
||||
# API_TOKEN:
|
||||
# valueFrom:
|
||||
# secretKeyRef:
|
||||
# name: agentgateway-secrets
|
||||
# key: apiToken
|
||||
extraEnv: {}
|
||||
# -- Configure TLS settings for the xDS gRPC servers.
|
||||
xds:
|
||||
|
||||
@ -41,7 +41,6 @@ func NewConfigMapSyncer(client apiclient.Client, storePrefix, deploymentNamespac
|
||||
cmCollection := krt.NewFilteredInformer[*corev1.ConfigMap](client,
|
||||
kclient.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
Namespace: deploymentNamespace,
|
||||
LabelSelector: JwksStoreLabelSelector(storePrefix)},
|
||||
krtOptions.ToOptions("config_map_syncer/ConfigMaps")...)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/common"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/logging"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
)
|
||||
|
||||
// JwksStore is a top-level abstraction that relies on jwksCache and jwksFetcher to
|
||||
@ -34,7 +34,7 @@ type JwksStore struct {
|
||||
l sync.Mutex
|
||||
}
|
||||
|
||||
func BuildJwksStore(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
|
||||
func BuildJwksStore(ctx context.Context, cli apiclient.Client, commonCols *collections.CommonCollections, jwksChanges <-chan JwksSource, storePrefix, deploymentNamespace string) *JwksStore {
|
||||
logger.Info("creating jwks store")
|
||||
|
||||
jwksCache := NewJwksCache()
|
||||
@ -43,7 +43,7 @@ func BuildJwksStore(cli apiclient.Client, krtOpts krtutil.KrtOptions, jwksChange
|
||||
jwksCache: jwksCache,
|
||||
jwksChanges: jwksChanges,
|
||||
jwksFetcher: NewJwksFetcher(jwksCache),
|
||||
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, krtOpts),
|
||||
configMapSyncer: NewConfigMapSyncer(cli, storePrefix, deploymentNamespace, commonCols.KrtOpts),
|
||||
cmNameToJwks: make(map[string]string),
|
||||
}
|
||||
BuildJwksConfigMapNamespacedNameFunc(storePrefix, deploymentNamespace)
|
||||
|
||||
@ -13,9 +13,9 @@ import (
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type JwksUrlBuilder interface {
|
||||
@ -191,7 +191,7 @@ func GetTLSConfig(
|
||||
certPool := x509.NewCertPool()
|
||||
for _, ref := range btls.CACertificateRefs {
|
||||
nn := types.NamespacedName{
|
||||
Name: ref.Name,
|
||||
Name: string(ref.Name),
|
||||
Namespace: namespace,
|
||||
}
|
||||
cfgmap := krt.FetchOne(krtctx, cfgmaps, krt.FilterObjectName(nn))
|
||||
|
||||
@ -164,7 +164,8 @@ func TestRemoteJwksUrlBuilder(t *testing.T) {
|
||||
}
|
||||
|
||||
func setup(t *testing.T, paths []string) plugins.PolicyCtx {
|
||||
val := apitests.NewAgentgatewayValidatorSkipMissing(t)
|
||||
val := apitests.NewKgatewayValidator(t)
|
||||
val.SkipMissing = true
|
||||
mockObjs := []any{}
|
||||
for _, f := range paths {
|
||||
data := file.AsStringOrFail(t, f)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -8,28 +8,25 @@ import (
|
||||
"istio.io/istio/pkg/ptr"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
legacyA2aProtocol = "kgateway.dev/a2a"
|
||||
a2aProtocol = "agentgateway.dev/a2a"
|
||||
a2aProtocol = "kgateway.dev/a2a"
|
||||
)
|
||||
|
||||
// NewA2APlugin creates a new A2A policy plugin
|
||||
func NewA2APlugin(agw *AgwCollections) AgwPlugin {
|
||||
policyCol := krt.NewManyCollection(agw.Services, func(krtctx krt.HandlerContext, svc *corev1.Service) []AgwPolicy {
|
||||
return translatePoliciesForService(svc, kubeutils.GetClusterDomainName())
|
||||
})
|
||||
return AgwPlugin{
|
||||
ContributesPolicies: map[schema.GroupKind]PolicyPlugin{
|
||||
wellknown.ServiceGVK.GroupKind(): {
|
||||
Build: func(input PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy]) {
|
||||
policyCol := krt.NewManyCollection(agw.Services, func(krtctx krt.HandlerContext, svc *corev1.Service) []AgwPolicy {
|
||||
return translatePoliciesForService(krtctx, svc, kubeutils.GetClusterDomainName(), input.References)
|
||||
})
|
||||
return nil, policyCol
|
||||
},
|
||||
},
|
||||
@ -38,19 +35,11 @@ func NewA2APlugin(agw *AgwCollections) AgwPlugin {
|
||||
}
|
||||
|
||||
// translatePoliciesForService generates A2A policies for a single service
|
||||
func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service, clusterDomain string, references ReferenceIndex) []AgwPolicy {
|
||||
func translatePoliciesForService(svc *corev1.Service, clusterDomain string) []AgwPolicy {
|
||||
var a2aPolicies []AgwPolicy
|
||||
gatewayTargets := references.LookupGatewaysForBackend(krtctx, utils.TypedNamespacedName{
|
||||
Kind: wellknown.ServiceKind,
|
||||
NamespacedName: types.NamespacedName{
|
||||
Namespace: svc.Namespace,
|
||||
Name: svc.Name,
|
||||
},
|
||||
}).UnsortedList()
|
||||
|
||||
for _, port := range svc.Spec.Ports {
|
||||
// support legacy kgateway.dev/a2a and agentgateway.dev/a2a
|
||||
if port.AppProtocol != nil && (*port.AppProtocol == a2aProtocol || *port.AppProtocol == legacyA2aProtocol) {
|
||||
if port.AppProtocol != nil && *port.AppProtocol == a2aProtocol {
|
||||
logger.Debug("found A2A service", "service", svc.Name, "namespace", svc.Namespace, "port", port.Port)
|
||||
hostname := fmt.Sprintf("%s.%s.svc.%s", svc.Name, svc.Namespace, clusterDomain)
|
||||
policy := &api.Policy{
|
||||
@ -71,7 +60,7 @@ func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service,
|
||||
},
|
||||
}
|
||||
|
||||
a2aPolicies = appendPolicyForGateways(a2aPolicies, gatewayTargets, policy)
|
||||
a2aPolicies = append(a2aPolicies, AgwPolicy{Policy: 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(*armor.Location)
|
||||
pgArmor.Location = ptr.Of(string(*armor.Location))
|
||||
} else {
|
||||
pgArmor.Location = ptr.Of("us-central1")
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"istio.io/istio/pkg/slices"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@ -20,14 +19,14 @@ 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 (
|
||||
aiPolicySuffix = ":ai"
|
||||
backendTlsPolicySuffix = ":backend-tls"
|
||||
backendTunnelPolicySuffix = ":backend-tunnel"
|
||||
backendauthPolicySuffix = ":backend-auth"
|
||||
backendTransformationSuffix = ":backend-transformation"
|
||||
tlsPolicySuffix = ":tls"
|
||||
@ -49,128 +48,124 @@ func TranslateInlineBackendPolicy(
|
||||
},
|
||||
Spec: agentgateway.AgentgatewayPolicySpec{Backend: policy},
|
||||
}
|
||||
res, err := translateBackendPolicyToAgw(ctx, dummy)
|
||||
return slices.MapFilter(res, func(e *api.Policy) **api.BackendPolicySpec {
|
||||
return ptr.Of(e.GetBackend())
|
||||
res, err := translateBackendPolicyToAgw(ctx, dummy, nil)
|
||||
return slices.MapFilter(res, func(e AgwPolicy) **api.BackendPolicySpec {
|
||||
return ptr.Of(e.Policy.GetBackend())
|
||||
}), err
|
||||
}
|
||||
|
||||
func translateBackendPolicyToAgw(
|
||||
ctx PolicyCtx,
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
) ([]*api.Policy, error) {
|
||||
policyTarget *api.PolicyTarget,
|
||||
) ([]AgwPolicy, error) {
|
||||
backend := policy.Spec.Backend
|
||||
if backend == nil {
|
||||
return nil, nil
|
||||
}
|
||||
agwPolicies := make([]*api.Policy, 0)
|
||||
agwPolicies := make([]AgwPolicy, 0)
|
||||
var errs []error
|
||||
|
||||
policyName := getBackendPolicyName(policy.Namespace, policy.Name)
|
||||
appendPolicy := func(kind string) func(*api.Policy, error) {
|
||||
return func(p *api.Policy, err error) {
|
||||
if err != nil {
|
||||
name := fmt.Sprintf("%s %s", kind, policyName)
|
||||
logger.Error("error processing policy", "policy", name, "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if p != nil {
|
||||
agwPolicies = append(agwPolicies, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if s := backend.HTTP; s != nil {
|
||||
appendPolicy("backendHTTP")(translateBackendHTTP(policy), nil)
|
||||
}
|
||||
|
||||
if s := backend.Tunnel; s != nil {
|
||||
appendPolicy("backendTunnel")(translateBackendTunnel(ctx, policy))
|
||||
pol := translateBackendHTTP(policy, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.TLS; s != nil {
|
||||
appendPolicy("backendTLS")(translateBackendTLS(ctx, policy))
|
||||
pol, err := translateBackendTLS(ctx, policy, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend TLS", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.TCP; s != nil {
|
||||
appendPolicy("backendTCP")(translateBackendTCP(ctx, policy, policyName))
|
||||
pol, err := translateBackendTCP(ctx, policy, policyName, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend TCP", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.Health; s != nil {
|
||||
appendPolicy("backendHealth")(translateBackendHealthPolicy(policy))
|
||||
pol, err := translateBackendHealthPolicy(policy, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend health policy", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.Transformation; s != nil {
|
||||
appendPolicy("backendTransformation")(translateBackendTransformation(policy))
|
||||
pol, err := translateBackendTransformation(policy, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend transformation", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.MCP; s != nil {
|
||||
if backend.MCP.Authorization != nil {
|
||||
appendPolicy("backendMCPAuthorization")(translateBackendMCPAuthorization(policy))
|
||||
pol := translateBackendMCPAuthorization(policy, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if backend.MCP.Authentication != nil {
|
||||
appendPolicy("backendMCPAuthentication")(translateBackendMCPAuthentication(ctx, policy))
|
||||
pol, err := translateBackendMCPAuthentication(ctx, policy, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend mcp auth", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
}
|
||||
|
||||
if s := backend.AI; s != nil {
|
||||
appendPolicy("backendAI")(translateBackendAI(ctx, policy, policyName))
|
||||
pol, err := translateBackendAI(ctx, policy, policyName, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend AI", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := backend.Auth; s != nil {
|
||||
appendPolicy("backendAuth")(translateBackendAuth(ctx, policy, policyName))
|
||||
pol, err := translateBackendAuth(ctx, policy, policyName, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend Auth", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
return agwPolicies, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
var errs []error
|
||||
|
||||
healthPolicy := policy.Spec.Backend.Health
|
||||
|
||||
var evictionProto *api.BackendPolicySpec_Eviction
|
||||
if healthPolicy.Eviction != nil {
|
||||
var duration *durationpb.Duration
|
||||
if healthPolicy.Eviction.Duration != nil {
|
||||
duration = durationpb.New(healthPolicy.Eviction.Duration.Duration)
|
||||
}
|
||||
|
||||
// Convert 0–100 integer scores into 0.0–1.0 doubles for proto
|
||||
var healthThreshold *float64
|
||||
if healthPolicy.Eviction.HealthThreshold != nil {
|
||||
val := float64(*healthPolicy.Eviction.HealthThreshold) / 100.0
|
||||
healthThreshold = &val
|
||||
}
|
||||
var restoreHealth *float64
|
||||
if healthPolicy.Eviction.RestoreHealth != nil {
|
||||
val := float64(*healthPolicy.Eviction.RestoreHealth) / 100.0
|
||||
restoreHealth = &val
|
||||
}
|
||||
|
||||
if healthPolicy.Eviction != nil && healthPolicy.Eviction.Duration != nil {
|
||||
evictionProto = &api.BackendPolicySpec_Eviction{
|
||||
Duration: duration,
|
||||
RestoreHealth: restoreHealth,
|
||||
ConsecutiveFailures: healthPolicy.Eviction.ConsecutiveFailures,
|
||||
HealthThreshold: healthThreshold,
|
||||
Duration: durationpb.New(healthPolicy.Eviction.Duration.Duration),
|
||||
}
|
||||
}
|
||||
|
||||
var unhealthyCondition string
|
||||
if healthPolicy.UnhealthyCondition != nil {
|
||||
unhealthyCondition = *castCELPtr(healthPolicy.UnhealthyCondition, func(expr shared.CELExpression) {
|
||||
errs = append(errs, fmt.Errorf("backend health unhealthyCondition is not a valid CEL expression: %s", expr))
|
||||
})
|
||||
}
|
||||
|
||||
p := &api.BackendPolicySpec_Health{
|
||||
UnhealthyCondition: unhealthyCondition,
|
||||
UnhealthyCondition: string(healthPolicy.UnhealthyCondition),
|
||||
Eviction: evictionProto,
|
||||
}
|
||||
evictPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + healthPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + healthPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_Health_{
|
||||
@ -180,17 +175,18 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api
|
||||
},
|
||||
}
|
||||
|
||||
return evictPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: evictPolicy}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendTCP(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateBackendTCP(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
// TODO
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func translateBackendTransformation(
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
) (*api.Policy, error) {
|
||||
target *api.PolicyTarget,
|
||||
) ([]AgwPolicy, error) {
|
||||
var errs []error
|
||||
transformation := policy.Spec.Backend.Transformation
|
||||
|
||||
@ -204,8 +200,9 @@ func translateBackendTransformation(
|
||||
}
|
||||
|
||||
tp := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + backendTransformationSuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + backendTransformationSuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_Transformation{
|
||||
@ -220,10 +217,10 @@ func translateBackendTransformation(
|
||||
logger.Debug("generated backend transformation policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tp.Name)
|
||||
return tp, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: tp}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
var errs []error
|
||||
tls := policy.Spec.Backend.TLS
|
||||
|
||||
@ -240,7 +237,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
if scrt == nil {
|
||||
errs = append(errs, fmt.Errorf("secret %s not found", nn))
|
||||
} else {
|
||||
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
errs = append(errs, fmt.Errorf("secret %v contains invalid certificate: %v", nn, err))
|
||||
}
|
||||
p.Cert = scrt.Data[corev1.TLSCertKey]
|
||||
@ -262,7 +259,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
errs = append(errs, fmt.Errorf("ConfigMap %s not found", nn))
|
||||
continue
|
||||
}
|
||||
pem, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
pem, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("error extracting CA cert from ConfigMap %s: %w", nn, err))
|
||||
continue
|
||||
@ -272,9 +269,10 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
}
|
||||
sb.WriteString(pem)
|
||||
}
|
||||
// If we have a root set here, set it
|
||||
// This may send an empty root, so that we trust nothing rather than system certs.
|
||||
p.Root = []byte(sb.String())
|
||||
// TODO: if none, submit something to make agentgateway reject requests instead of fail open.
|
||||
if sb.Len() > 0 {
|
||||
p.Root = []byte(sb.String())
|
||||
}
|
||||
}
|
||||
|
||||
if len(tls.VerifySubjectAltNames) > 0 {
|
||||
@ -296,8 +294,9 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
}
|
||||
|
||||
tlsPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + tlsPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + tlsPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_BackendTls{
|
||||
@ -311,10 +310,10 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tlsPolicy.Name)
|
||||
|
||||
return tlsPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: tlsPolicy}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
|
||||
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) []AgwPolicy {
|
||||
http := policy.Spec.Backend.HTTP
|
||||
p := &api.BackendPolicySpec_BackendHTTP{}
|
||||
if v := http.Version; v != nil {
|
||||
@ -329,8 +328,9 @@ func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
|
||||
p.RequestTimeout = durationpb.New(rt.Duration)
|
||||
}
|
||||
tp := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + backendHttpPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + backendHttpPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_BackendHttp{
|
||||
@ -343,64 +343,32 @@ func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tp.Name)
|
||||
|
||||
return tp
|
||||
return []AgwPolicy{{Policy: tp}}
|
||||
}
|
||||
|
||||
func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
tunnel := policy.Spec.Backend.Tunnel
|
||||
|
||||
proxy, err := buildBackendRef(ctx, tunnel.BackendRef, policy.Namespace)
|
||||
|
||||
tunnelPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + backendTunnelPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_BackendTunnel_{
|
||||
BackendTunnel: &api.BackendPolicySpec_BackendTunnel{
|
||||
Proxy: proxy,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
logger.Debug("generated backend tunnel policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tunnelPolicy.Name)
|
||||
|
||||
return tunnelPolicy, err
|
||||
}
|
||||
|
||||
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) []AgwPolicy {
|
||||
backend := policy.Spec.Backend
|
||||
if backend == nil || backend.MCP == nil || backend.MCP.Authorization == nil {
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
auth := backend.MCP.Authorization
|
||||
var errs []error
|
||||
var allowPolicies, denyPolicies, requirePolicies []string
|
||||
policies := castCELSlice(auth.Policy.MatchExpressions, func(expr shared.CELExpression) {
|
||||
errs = append(errs, fmt.Errorf("backend MCP authorization matchExpression is not a valid CEL expression: %s", expr))
|
||||
})
|
||||
var allowPolicies, denyPolicies []string
|
||||
if auth.Action == shared.AuthorizationPolicyActionDeny {
|
||||
denyPolicies = append(denyPolicies, policies...)
|
||||
} else if auth.Action == shared.AuthorizationPolicyActionRequire {
|
||||
requirePolicies = append(requirePolicies, policies...)
|
||||
denyPolicies = append(denyPolicies, cast(auth.Policy.MatchExpressions)...)
|
||||
} else {
|
||||
allowPolicies = append(allowPolicies, policies...)
|
||||
allowPolicies = append(allowPolicies, cast(auth.Policy.MatchExpressions)...)
|
||||
}
|
||||
|
||||
mcpPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthorizationPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthorizationPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_McpAuthorization_{
|
||||
McpAuthorization: &api.BackendPolicySpec_McpAuthorization{
|
||||
Allow: allowPolicies,
|
||||
Deny: denyPolicies,
|
||||
Require: requirePolicies,
|
||||
Allow: allowPolicies,
|
||||
Deny: denyPolicies,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -411,41 +379,27 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", mcpPolicy.Name)
|
||||
|
||||
return mcpPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: mcpPolicy}}
|
||||
}
|
||||
|
||||
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
authnPolicy := policy.Spec.Backend.MCP.Authentication
|
||||
|
||||
mcpAuthn, err := translateMCPAuthenticationSpec(ctx, types.NamespacedName{
|
||||
Namespace: policy.Namespace,
|
||||
Name: policy.Name,
|
||||
}, authnPolicy)
|
||||
mcpAuthnPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_McpAuthentication_{
|
||||
McpAuthentication: mcpAuthn,
|
||||
},
|
||||
},
|
||||
},
|
||||
func translateBackendMCPAuthentication(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
backend := policy.Spec.Backend
|
||||
if backend == nil || backend.MCP == nil || backend.MCP.Authentication == nil {
|
||||
return nil, nil
|
||||
}
|
||||
authnPolicy := backend.MCP.Authentication
|
||||
if authnPolicy == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
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)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// default mode is Strict
|
||||
mode := api.BackendPolicySpec_McpAuthentication_STRICT
|
||||
@ -457,70 +411,20 @@ func translateMCPAuthenticationSpec(
|
||||
mode = api.BackendPolicySpec_McpAuthentication_OPTIONAL
|
||||
}
|
||||
|
||||
var errs []error
|
||||
jwksUrl, _, err := jwks_url.JwksUrlBuilderFactory().BuildJwksUrlAndTlsConfig(ctx.Krt, policy.Name, policy.Namespace, &authnPolicy.JWKS)
|
||||
if err != nil {
|
||||
logger.Error("failed resolving jwks url", "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
var translatedInlineJwks string
|
||||
if err == nil {
|
||||
translatedInlineJwks, err = resolveRemoteJWKSInline(ctx, jwksUrl)
|
||||
return nil, err
|
||||
}
|
||||
translatedInlineJwks, err := resolveRemoteJWKSInline(ctx, jwksUrl)
|
||||
if err != nil {
|
||||
logger.Error("failed resolving jwks", "jwks_uri", jwksUrl, "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
extraResourceMetadata, metadataErr := translateMCPResourceMetadata(authnPolicy.ResourceMetadata)
|
||||
if metadataErr != nil {
|
||||
errs = append(errs, metadataErr)
|
||||
}
|
||||
|
||||
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
|
||||
Issuer: authnPolicy.Issuer,
|
||||
Audiences: authnPolicy.Audiences,
|
||||
Provider: idp,
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
JwksInline: translatedInlineJwks,
|
||||
Mode: mode,
|
||||
}
|
||||
return mcpAuthn, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateJWTMCPConfig(mcp *agentgateway.JWTMCPConfig) (*api.TrafficPolicySpec_JWT_MCP, error) {
|
||||
extraResourceMetadata, err := translateMCPResourceMetadata(mcp.ResourceMetadata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.TrafficPolicySpec_JWT_MCP{
|
||||
Provider: translateMcpIDP(mcp.Provider),
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func translateMcpIDP(provider *agentgateway.McpIDP) api.BackendPolicySpec_McpAuthentication_McpIDP {
|
||||
if provider == nil {
|
||||
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
|
||||
}
|
||||
if *provider == agentgateway.Keycloak {
|
||||
return api.BackendPolicySpec_McpAuthentication_KEYCLOAK
|
||||
}
|
||||
if *provider == agentgateway.Auth0 {
|
||||
return api.BackendPolicySpec_McpAuthentication_AUTH0
|
||||
}
|
||||
return api.BackendPolicySpec_McpAuthentication_UNSPECIFIED
|
||||
}
|
||||
|
||||
func translateMCPResourceMetadata(resourceMetadata map[string]apiextensionsv1.JSON) (map[string]*structpb.Value, error) {
|
||||
var errs []error
|
||||
var extraResourceMetadata map[string]*structpb.Value
|
||||
for k, v := range resourceMetadata {
|
||||
for k, v := range authnPolicy.ResourceMetadata {
|
||||
if extraResourceMetadata == nil {
|
||||
extraResourceMetadata = make(map[string]*structpb.Value)
|
||||
}
|
||||
@ -535,11 +439,39 @@ func translateMCPResourceMetadata(resourceMetadata map[string]apiextensionsv1.JS
|
||||
|
||||
extraResourceMetadata[k] = proto
|
||||
}
|
||||
return extraResourceMetadata, errors.Join(errs...)
|
||||
|
||||
mcpAuthn := &api.BackendPolicySpec_McpAuthentication{
|
||||
Issuer: authnPolicy.Issuer,
|
||||
Audiences: authnPolicy.Audiences,
|
||||
Provider: idp,
|
||||
ResourceMetadata: &api.BackendPolicySpec_McpAuthentication_ResourceMetadata{
|
||||
Extra: extraResourceMetadata,
|
||||
},
|
||||
JwksInline: translatedInlineJwks,
|
||||
Mode: mode,
|
||||
}
|
||||
mcpAuthnPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + mcpAuthenticationPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_McpAuthentication_{
|
||||
McpAuthentication: mcpAuthn,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
logger.Debug("generated MCP authentication policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", mcpAuthnPolicy.Name)
|
||||
|
||||
return []AgwPolicy{{Policy: mcpAuthnPolicy}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
// translateBackendAI processes AI configuration and creates corresponding Agw policies
|
||||
func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolicy, name string, policyTarget *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
var errs []error
|
||||
aiSpec := agwPolicy.Spec.Backend.AI
|
||||
|
||||
@ -622,9 +554,6 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
|
||||
CacheTools: aiSpec.PromptCaching.CacheTools,
|
||||
}
|
||||
translatedAIPolicy.PromptCaching.MinTokens = ptr.Of(uint32(aiSpec.PromptCaching.MinTokens)) //nolint:gosec // G115: MinTokens is validated by kubebuilder to be >= 0
|
||||
if aiSpec.PromptCaching.CacheMessageOffset > 0 {
|
||||
translatedAIPolicy.PromptCaching.CacheMessageOffset = ptr.Of(uint32(aiSpec.PromptCaching.CacheMessageOffset)) //nolint:gosec // G115: CacheMessageOffset is validated by kubebuilder to be >= 0
|
||||
}
|
||||
}
|
||||
|
||||
if aiSpec.Routes != nil {
|
||||
@ -636,8 +565,9 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
|
||||
}
|
||||
|
||||
aiPolicy := &api.Policy{
|
||||
Key: name + aiPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, agwPolicy),
|
||||
Key: name + aiPolicySuffix + attachmentName(policyTarget),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, agwPolicy),
|
||||
Target: policyTarget,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_Ai_{
|
||||
@ -651,15 +581,18 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
|
||||
"policy", agwPolicy.Name,
|
||||
"agentgateway_policy", aiPolicy.Name)
|
||||
|
||||
return aiPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: aiPolicy}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
var errs []error
|
||||
auth := policy.Spec.Backend.Auth
|
||||
|
||||
if auth == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var translatedAuth *api.BackendAuthPolicy
|
||||
var kindErrs []error
|
||||
|
||||
if auth.InlineKey != nil && *auth.InlineKey != "" {
|
||||
translatedAuth = &api.BackendAuthPolicy{
|
||||
@ -672,11 +605,6 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
|
||||
secret, err := kubeutils.GetSecret(ctx.Collections.Secrets, ctx.Krt, auth.SecretRef.Name, policy.Namespace)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
translatedAuth = &api.BackendAuthPolicy{
|
||||
Kind: &api.BackendAuthPolicy_Key{
|
||||
Key: &api.Key{},
|
||||
},
|
||||
}
|
||||
} else {
|
||||
if authKey, ok := kubeutils.GetSecretAuth(secret); ok {
|
||||
translatedAuth = &api.BackendAuthPolicy{
|
||||
@ -686,25 +614,16 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
|
||||
}
|
||||
} else {
|
||||
errs = append(errs, fmt.Errorf("secret %s/%s missing Authorization value", policy.Namespace, auth.SecretRef.Name))
|
||||
translatedAuth = &api.BackendAuthPolicy{
|
||||
Kind: &api.BackendAuthPolicy_Key{
|
||||
Key: &api.Key{},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if auth.AWS != nil {
|
||||
awsAuth, err := buildAwsAuthPolicy(ctx.Krt, auth.AWS, ctx.Collections.Secrets, policy.Namespace)
|
||||
translatedAuth = awsAuth
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
errs = append(errs, err)
|
||||
} else if auth.Azure != nil {
|
||||
azureAuth, err := buildAzureAuthPolicy(ctx.Krt, auth.Azure, ctx.Collections.Secrets, policy.Namespace)
|
||||
translatedAuth = azureAuth
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
errs = append(errs, err)
|
||||
} else if auth.GCP != nil {
|
||||
translatedAuth = buildGcpAuthPolicy(auth.GCP)
|
||||
} else if auth.Passthrough != nil {
|
||||
@ -715,9 +634,14 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
|
||||
}
|
||||
}
|
||||
|
||||
if translatedAuth == nil {
|
||||
return nil, errors.Join(errs...)
|
||||
}
|
||||
|
||||
authPolicy := &api.Policy{
|
||||
Key: name + backendauthPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + backendauthPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_Auth{
|
||||
@ -730,7 +654,7 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", authPolicy.Name)
|
||||
|
||||
return authPolicy, errors.Join(append(errs, kindErrs...)...)
|
||||
return []AgwPolicy{{Policy: authPolicy}}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
// translateRouteType converts kgateway RouteType to agentgateway proto RouteType
|
||||
@ -744,8 +668,6 @@ func translateRouteType(rt agentgateway.RouteType) api.BackendPolicySpec_Ai_Rout
|
||||
return api.BackendPolicySpec_Ai_MODELS
|
||||
case agentgateway.RouteTypePassthrough:
|
||||
return api.BackendPolicySpec_Ai_PASSTHROUGH
|
||||
case agentgateway.RouteTypeDetect:
|
||||
return api.BackendPolicySpec_Ai_DETECT
|
||||
case agentgateway.RouteTypeResponses:
|
||||
return api.BackendPolicySpec_Ai_RESPONSES
|
||||
case agentgateway.RouteTypeAnthropicTokenCount:
|
||||
@ -762,39 +684,52 @@ func translateRouteType(rt agentgateway.RouteType) api.BackendPolicySpec_Ai_Rout
|
||||
|
||||
func buildAwsAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AwsAuth, secrets krt.Collection[*corev1.Secret], namespace string) (*api.BackendAuthPolicy, error) {
|
||||
var errs []error
|
||||
if auth == nil {
|
||||
logger.Warn("using implicit AWS auth for AI backend")
|
||||
return &api.BackendAuthPolicy{
|
||||
Kind: &api.BackendAuthPolicy_Aws{
|
||||
Aws: &api.Aws{
|
||||
Kind: &api.Aws_Implicit{
|
||||
Implicit: &api.AwsImplicit{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
if auth.SecretRef.Name == "" {
|
||||
logger.Warn("not using any auth for AWS - it's most likely not what you want")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var accessKeyId, secretAccessKey string
|
||||
var sessionToken *string
|
||||
|
||||
// Get secret using the SecretIndex
|
||||
secret, err := kubeutils.GetSecret(secrets, krtctx, auth.SecretRef.Name, namespace)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
// Return nil auth policy if secret not found - this will be handled upstream
|
||||
// TODO(npolshak): Add backend status errors https://github.com/kgateway-dev/kgateway/issues/11966
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var accessKeyId, secretAccessKey string
|
||||
var sessionToken *string
|
||||
|
||||
// Extract access key
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.AccessKey); !exists {
|
||||
errs = append(errs, errors.New("accessKey is missing or not a valid string"))
|
||||
} else {
|
||||
// Extract access key
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.AccessKey); !exists {
|
||||
errs = append(errs, errors.New("accessKey is missing or not a valid string"))
|
||||
} else {
|
||||
accessKeyId = value
|
||||
}
|
||||
accessKeyId = value
|
||||
}
|
||||
|
||||
// Extract secret key
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SecretKey); !exists {
|
||||
errs = append(errs, errors.New("secretKey is missing or not a valid string"))
|
||||
} else {
|
||||
secretAccessKey = value
|
||||
}
|
||||
// Extract secret key
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SecretKey); !exists {
|
||||
errs = append(errs, errors.New("secretKey is missing or not a valid string"))
|
||||
} else {
|
||||
secretAccessKey = value
|
||||
}
|
||||
|
||||
// Extract session token (optional)
|
||||
if secret != nil {
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SessionToken); exists {
|
||||
sessionToken = ptr.Of(value)
|
||||
}
|
||||
}
|
||||
// Extract session token (optional)
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.SessionToken); exists {
|
||||
sessionToken = ptr.Of(value)
|
||||
}
|
||||
|
||||
return &api.BackendAuthPolicy{
|
||||
@ -815,6 +750,19 @@ func buildAwsAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AwsAuth, s
|
||||
|
||||
func buildAzureAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AzureAuth, secrets krt.Collection[*corev1.Secret], namespace string) (*api.BackendAuthPolicy, error) {
|
||||
var errs []error
|
||||
if auth == nil {
|
||||
logger.Warn("using implicit Azure auth for AI backend")
|
||||
return &api.BackendAuthPolicy{
|
||||
Kind: &api.BackendAuthPolicy_Azure{
|
||||
Azure: &api.Azure{
|
||||
Kind: &api.Azure_DeveloperImplicit{
|
||||
DeveloperImplicit: &api.AzureDeveloperImplicit{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
if auth.SecretRef.Name != "" {
|
||||
return buildAzureClientSecret(secrets, krtctx, auth, namespace, errs)
|
||||
}
|
||||
@ -859,31 +807,34 @@ func buildAzureAuthPolicy(krtctx krt.HandlerContext, auth *agentgateway.AzureAut
|
||||
}
|
||||
|
||||
func buildAzureClientSecret(secrets krt.Collection[*corev1.Secret], krtctx krt.HandlerContext, auth *agentgateway.AzureAuth, namespace string, errs []error) (*api.BackendAuthPolicy, error) {
|
||||
var clientID, tenantID, clientSecret string
|
||||
secret, err := kubeutils.GetSecret(secrets, krtctx, auth.SecretRef.Name, namespace)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
// Return nil auth policy if secret not found - this will be handled upstream
|
||||
// TODO(npolshak): Add backend status errors https://github.com/kgateway-dev/kgateway/issues/11966
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var clientID, tenantID, clientSecret string
|
||||
|
||||
// Extract client ID
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientID); !exists {
|
||||
errs = append(errs, errors.New("clientID is missing or not a valid string"))
|
||||
} else {
|
||||
// Extract client ID
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientID); !exists {
|
||||
errs = append(errs, errors.New("clientID is missing or not a valid string"))
|
||||
} else {
|
||||
clientID = value
|
||||
}
|
||||
clientID = value
|
||||
}
|
||||
|
||||
// Extract tenant ID
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.TenantID); !exists {
|
||||
errs = append(errs, errors.New("tenantID is missing or not a valid string"))
|
||||
} else {
|
||||
tenantID = value
|
||||
}
|
||||
// Extract tenant ID
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.TenantID); !exists {
|
||||
errs = append(errs, errors.New("tenantID is missing or not a valid string"))
|
||||
} else {
|
||||
tenantID = value
|
||||
}
|
||||
|
||||
// Extract client secret
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientSecret); !exists {
|
||||
errs = append(errs, errors.New("clientSecret is missing or not a valid string"))
|
||||
} else {
|
||||
clientSecret = value
|
||||
}
|
||||
// Extract client secret
|
||||
if value, exists := kubeutils.GetSecretValue(secret, wellknown.ClientSecret); !exists {
|
||||
errs = append(errs, errors.New("clientSecret is missing or not a valid string"))
|
||||
} else {
|
||||
clientSecret = value
|
||||
}
|
||||
|
||||
return &api.BackendAuthPolicy{
|
||||
|
||||
18
controller/pkg/agentgateway/plugins/backend_policies_test.go
Normal file
18
controller/pkg/agentgateway/plugins/backend_policies_test.go
Normal file
@ -0,0 +1,18 @@
|
||||
package plugins_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
|
||||
)
|
||||
|
||||
func TestBackendPolicies(t *testing.T) {
|
||||
testutils.RunForDirectory(t, "testdata/backendpolicy", func(t *testing.T, ctx plugins.PolicyCtx) (*gwv1.PolicyStatus, []plugins.AgwPolicy) {
|
||||
pol := testutils.GetTestResource(t, ctx.Collections.AgentgatewayPolicies)
|
||||
s, o := plugins.TranslateAgentgatewayPolicy(ctx.Krt, pol, ctx.Collections)
|
||||
return s, o
|
||||
})
|
||||
}
|
||||
@ -20,8 +20,8 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
)
|
||||
|
||||
// NewBackendTLSPlugin creates a new BackendTLSPolicy plugin
|
||||
@ -43,9 +43,9 @@ func NewBackendTLSPlugin(agw *AgwCollections) AgwPlugin {
|
||||
wellknown.BackendTLSPolicyGVK.GroupKind(): {
|
||||
Build: func(input PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy]) {
|
||||
st, o := krt.NewStatusManyCollection(agw.BackendTLSPolicies, func(krtctx krt.HandlerContext, btls *gwv1.BackendTLSPolicy) (*gwv1.PolicyStatus, []AgwPolicy) {
|
||||
return translatePoliciesForBackendTLS(krtctx, agw.ControllerName, input.References, agw.ConfigMaps, agw.Secrets, agw.Services, backendTLSTarget, agw.Gateways, btls)
|
||||
return translatePoliciesForBackendTLS(krtctx, agw.ControllerName, input.Ancestors, agw.ConfigMaps, agw.Secrets, agw.Services, backendTLSTarget, agw.Gateways, btls)
|
||||
}, agw.KrtOpts.ToOptions("agentgateway/BackendTLSPolicy")...)
|
||||
return ConvertStatusCollection(st), o
|
||||
return convertStatusCollection(st), o
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -56,7 +56,7 @@ func NewBackendTLSPlugin(agw *AgwCollections) AgwPlugin {
|
||||
func translatePoliciesForBackendTLS(
|
||||
krtctx krt.HandlerContext,
|
||||
controllerName string,
|
||||
references ReferenceIndex,
|
||||
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
|
||||
cfgmaps krt.Collection[*corev1.ConfigMap],
|
||||
secrets krt.Collection[*corev1.Secret],
|
||||
svcs krt.Collection[*corev1.Service],
|
||||
@ -115,8 +115,13 @@ func translatePoliciesForBackendTLS(
|
||||
Kind: string(target.Kind),
|
||||
}
|
||||
|
||||
gatewayTargets := references.LookupGatewaysForBackend(krtctx, tgtRef).UnsortedList()
|
||||
uniqueGateways = uniqueGateways.InsertAll(gatewayTargets...)
|
||||
// TODO: does this need to account for listenersets
|
||||
ancestorBackends := krt.Fetch(krtctx, ancestors, krt.FilterKey(tgtRef.String()))
|
||||
for _, gwl := range ancestorBackends {
|
||||
for _, i := range gwl.Objects {
|
||||
uniqueGateways.Insert(i.Gateway)
|
||||
}
|
||||
}
|
||||
|
||||
var mtlsClientRef *gwv1.SecretObjectReference
|
||||
var mtlsClientRefNamespace string
|
||||
@ -130,14 +135,16 @@ func translatePoliciesForBackendTLS(
|
||||
}
|
||||
}
|
||||
|
||||
backendTLSPoliciesForThisTarget := krtutil.FetchIndexObjects(krtctx, targetIndex, tgtRef)
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
backendTLSPoliciesForThisTarget := krt.FetchOne(krtctx, targetIndex, krt.FilterKey(tgtRef.String()))
|
||||
if backendTLSPoliciesForThisTarget != nil {
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
}
|
||||
|
||||
switch string(target.Kind) {
|
||||
@ -209,7 +216,7 @@ func translatePoliciesForBackendTLS(
|
||||
if scrt == nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
res.Cert = scrt.Data[corev1.TLSCertKey]
|
||||
@ -231,7 +238,7 @@ func translatePoliciesForBackendTLS(
|
||||
},
|
||||
},
|
||||
}
|
||||
policies = appendPolicyForGateways(policies, gatewayTargets, policy)
|
||||
policies = append(policies, AgwPolicy{policy})
|
||||
}
|
||||
ancestorStatus := make([]gwv1.PolicyAncestorStatus, 0, len(btls.Spec.TargetRefs))
|
||||
for g := range uniqueGateways {
|
||||
@ -252,9 +259,9 @@ func translatePoliciesForBackendTLS(
|
||||
func checkConflicted(
|
||||
btls *gwv1.BackendTLSPolicy,
|
||||
target gwv1.LocalPolicyTargetReferenceWithSectionName,
|
||||
allMatches []*gwv1.BackendTLSPolicy,
|
||||
allMatches *krt.IndexObject[utils.TypedNamespacedName, *gwv1.BackendTLSPolicy],
|
||||
) error {
|
||||
for _, m := range allMatches {
|
||||
for _, m := range allMatches.Objects {
|
||||
if m.UID == btls.UID {
|
||||
// This is ourself, skip it
|
||||
continue
|
||||
@ -351,7 +358,7 @@ func getBackendTLSCACert(
|
||||
}
|
||||
return nil, fmt.Errorf("certificate reference not found: %v", ref)
|
||||
}
|
||||
caCert, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
caCert, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
if err != nil {
|
||||
conds[string(gwv1.BackendTLSPolicyReasonResolvedRefs)].error = &ConfigError{
|
||||
Reason: string(gwv1.BackendTLSPolicyReasonInvalidCACertificateRef),
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"istio.io/istio/pkg/kube/kclient"
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
"istio.io/istio/pkg/kube/kubetypes"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
discovery "k8s.io/api/discovery/v1"
|
||||
inf "sigs.k8s.io/gateway-api-inference-extension/api/v1"
|
||||
@ -15,23 +14,18 @@ import (
|
||||
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
|
||||
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
||||
apisettings "github.com/agentgateway/agentgateway/controller/api/settings"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
kgwversioned "github.com/agentgateway/agentgateway/controller/pkg/client/clientset/versioned"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/collections"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
krtpkg "github.com/agentgateway/agentgateway/controller/pkg/utils/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type AgwCollections struct {
|
||||
OurClient kgwversioned.Interface
|
||||
Client apiclient.Client
|
||||
KrtOpts krtutil.KrtOptions
|
||||
Settings apisettings.Settings
|
||||
|
||||
GatewaysForDeployer krt.Collection[collections.GatewayForDeployer]
|
||||
|
||||
// Core Kubernetes resources
|
||||
Namespaces krt.Collection[*corev1.Namespace]
|
||||
@ -82,108 +76,82 @@ type AgwCollections struct {
|
||||
// Collections that rely on plugins aren't initialized here,
|
||||
// and InitPlugins must be called.
|
||||
func NewAgwCollections(
|
||||
krtOptions krtutil.KrtOptions,
|
||||
client apiclient.Client,
|
||||
commoncol *collections.CommonCollections,
|
||||
agwControllerName string,
|
||||
settings apisettings.Settings,
|
||||
systemNamespace string,
|
||||
clusterID string,
|
||||
) (*AgwCollections, error) {
|
||||
filter := kclient.Filter{ObjectFilter: client.ObjectFilter()}
|
||||
gateways := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](
|
||||
client, wellknown.GatewayGVR, filter), krtOptions.ToOptions("informer/Gateways")...)
|
||||
gatewayClasses := krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](
|
||||
client, wellknown.GatewayClassGVR, filter), krtOptions.ToOptions("informer/GatewayClasses")...)
|
||||
listenerSets := krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](
|
||||
client, wellknown.ListenerSetGVR, kubetypes.StandardInformer, filter), krtOptions.ToOptions("informer/ListenerSets")...)
|
||||
|
||||
byParentRefIndex := krtpkg.UnnamedIndex(listenerSets, func(in *gwv1.ListenerSet) []collections.TargetRefIndexKey {
|
||||
pRef := in.Spec.ParentRef
|
||||
ns := ptr.OrDefault(pRef.Namespace, gwv1.Namespace(in.GetNamespace()))
|
||||
// lookup by the root object
|
||||
return []collections.TargetRefIndexKey{{
|
||||
Group: wellknown.GatewayGroup,
|
||||
Kind: wellknown.GatewayKind,
|
||||
Name: string(pRef.Name),
|
||||
Namespace: string(ns),
|
||||
// this index intentionally doesn't include sectionName
|
||||
}}
|
||||
})
|
||||
|
||||
agwCollections := &AgwCollections{
|
||||
Client: client,
|
||||
KrtOpts: krtOptions,
|
||||
Settings: settings,
|
||||
GatewaysForDeployer: krt.NewCollection(gateways, collections.GatewaysForDeployerTransformationFunc(gatewayClasses, listenerSets, byParentRefIndex, agwControllerName)),
|
||||
ControllerName: agwControllerName,
|
||||
SystemNamespace: systemNamespace,
|
||||
IstioNamespace: settings.IstioNamespace,
|
||||
IstioRevision: settings.IstioRevision,
|
||||
ClusterID: clusterID,
|
||||
Client: commoncol.Client,
|
||||
KrtOpts: commoncol.KrtOpts,
|
||||
ControllerName: agwControllerName,
|
||||
SystemNamespace: systemNamespace,
|
||||
IstioNamespace: commoncol.Settings.IstioNamespace,
|
||||
IstioRevision: commoncol.Settings.IstioRevision,
|
||||
ClusterID: clusterID,
|
||||
|
||||
// Core Kubernetes resources
|
||||
Namespaces: krt.NewInformer[*corev1.Namespace](client, krtOptions.ToOptions("informer/Namespaces")...),
|
||||
Nodes: krt.NewFilteredInformer[*corev1.Node](client, kclient.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}, krtOptions.ToOptions("informer/Nodes")...),
|
||||
Pods: krt.NewFilteredInformer[*corev1.Pod](client, kclient.Filter{
|
||||
Namespaces: krt.NewInformer[*corev1.Namespace](commoncol.Client, commoncol.KrtOpts.ToOptions("informer/Namespaces")...),
|
||||
Nodes: krt.NewFilteredInformer[*corev1.Node](commoncol.Client, kclient.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}, commoncol.KrtOpts.ToOptions("informer/Nodes")...),
|
||||
Pods: krt.NewFilteredInformer[*corev1.Pod](commoncol.Client, kclient.Filter{
|
||||
ObjectTransform: istiokube.StripPodUnusedFields,
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
}, krtOptions.ToOptions("informer/Pods")...),
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}, commoncol.KrtOpts.ToOptions("informer/Pods")...),
|
||||
|
||||
Secrets: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.Secret](client, kubetypes.Filter{
|
||||
FieldSelector: apiclient.SecretsFieldSelector,
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
kclient.NewFiltered[*corev1.Secret](commoncol.Client, kubetypes.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}),
|
||||
),
|
||||
ConfigMaps: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.ConfigMap](client, kubetypes.Filter{
|
||||
ObjectFilter: client.ObjectFilter(),
|
||||
kclient.NewFiltered[*corev1.ConfigMap](commoncol.Client, kubetypes.Filter{
|
||||
ObjectFilter: commoncol.Client.ObjectFilter(),
|
||||
}),
|
||||
krtOptions.ToOptions("informer/ConfigMaps")...,
|
||||
commoncol.KrtOpts.ToOptions("informer/ConfigMaps")...,
|
||||
),
|
||||
Services: krt.WrapClient(
|
||||
kclient.NewFiltered[*corev1.Service](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/Services")...),
|
||||
kclient.NewFiltered[*corev1.Service](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/Services")...),
|
||||
EndpointSlices: krt.WrapClient(
|
||||
kclient.NewFiltered[*discovery.EndpointSlice](client, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/EndpointSlices")...),
|
||||
kclient.NewFiltered[*discovery.EndpointSlice](commoncol.Client, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/EndpointSlices")...),
|
||||
|
||||
// Istio resources
|
||||
WorkloadEntries: krt.WrapClient(
|
||||
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/WorkloadEntries")...),
|
||||
kclient.NewDelayedInformer[*networkingclient.WorkloadEntry](commoncol.Client, gvr.WorkloadEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/WorkloadEntries")...),
|
||||
ServiceEntries: krt.WrapClient(
|
||||
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}),
|
||||
krtOptions.ToOptions("informer/ServiceEntries")...),
|
||||
kclient.NewDelayedInformer[*networkingclient.ServiceEntry](commoncol.Client, gvr.ServiceEntry, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}),
|
||||
commoncol.KrtOpts.ToOptions("informer/ServiceEntries")...),
|
||||
|
||||
// Gateway API resources
|
||||
GatewayClasses: gatewayClasses,
|
||||
Gateways: gateways,
|
||||
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/HTTPRoutes")...),
|
||||
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/GRPCRoutes")...),
|
||||
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TLSRoutes")...),
|
||||
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/BackendTLSPolicies")...),
|
||||
ListenerSets: listenerSets,
|
||||
GatewayClasses: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GatewayClass](commoncol.Client, wellknown.GatewayClassGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GatewayClasses")...),
|
||||
Gateways: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.Gateway](commoncol.Client, wellknown.GatewayGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/Gateways")...),
|
||||
HTTPRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.HTTPRoute](commoncol.Client, wellknown.HTTPRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/HTTPRoutes")...),
|
||||
GRPCRoutes: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1.GRPCRoute](commoncol.Client, wellknown.GRPCRouteGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/GRPCRoutes")...),
|
||||
TLSRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.TLSRoute](commoncol.Client, gvr.TLSRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TLSRoutes")...),
|
||||
BackendTLSPolicies: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.BackendTLSPolicy](commoncol.Client, gvr.BackendTLSPolicy, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/BackendTLSPolicies")...),
|
||||
ListenerSets: krt.WrapClient(kclient.NewDelayedInformer[*gwv1.ListenerSet](commoncol.Client, gvr.ListenerSet, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ListenerSets")...),
|
||||
|
||||
// Gateway API alpha
|
||||
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/TCPRoutes")...),
|
||||
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/ReferenceGrants")...),
|
||||
TCPRoutes: krt.WrapClient(kclient.NewDelayedInformer[*gwv1a2.TCPRoute](commoncol.Client, gvr.TCPRoute, kubetypes.StandardInformer, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/TCPRoutes")...),
|
||||
ReferenceGrants: krt.WrapClient(kclient.NewFilteredDelayed[*gwv1b1.ReferenceGrant](commoncol.Client, wellknown.ReferenceGrantGVR, kubetypes.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/ReferenceGrants")...),
|
||||
// BackendTrafficPolicy?
|
||||
|
||||
// inference extensions need to be enabled so control plane has permissions to watch resource. Disable by default
|
||||
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, krtOptions.ToOptions("disable/inferencepools")...),
|
||||
InferencePools: krt.NewStaticCollection[*inf.InferencePool](nil, nil, commoncol.KrtOpts.ToOptions("disable/inferencepools")...),
|
||||
|
||||
// agentgateway-specific CRDs
|
||||
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](client),
|
||||
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](client),
|
||||
AgentgatewayPolicies: krt.NewInformer[*agentgateway.AgentgatewayPolicy](commoncol.Client),
|
||||
Backends: krt.NewInformer[*agentgateway.AgentgatewayBackend](commoncol.Client),
|
||||
}
|
||||
|
||||
if settings.EnableInferExt {
|
||||
if commoncol.Settings.EnableInferExt {
|
||||
// inference extensions cluster watch permissions are controlled by enabling EnableInferExt
|
||||
inferencePoolGVR := wellknown.InferencePoolGVK.GroupVersion().WithResource("inferencepools")
|
||||
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: client.ObjectFilter()}), krtOptions.ToOptions("informer/InferencePools")...)
|
||||
agwCollections.InferencePools = krt.WrapClient(kclient.NewDelayedInformer[*inf.InferencePool](commoncol.Client, inferencePoolGVR, kubetypes.StandardInformer, kclient.Filter{ObjectFilter: commoncol.Client.ObjectFilter()}), commoncol.KrtOpts.ToOptions("informer/InferencePools")...)
|
||||
}
|
||||
agwCollections.SetupIndexes()
|
||||
|
||||
@ -194,7 +162,3 @@ func (c *AgwCollections) SetupIndexes() {
|
||||
c.SecretsByNamespace = krt.NewNamespaceIndex(c.Secrets)
|
||||
c.ServicesByNamespace = krt.NewNamespaceIndex(c.Services)
|
||||
}
|
||||
|
||||
func (c *AgwCollections) HasSynced() bool {
|
||||
return c.GatewaysForDeployer.HasSynced()
|
||||
}
|
||||
|
||||
@ -6,16 +6,15 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"istio.io/istio/pkg/slices"
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
frontendTcpPolicySuffix = ":frontend-tcp"
|
||||
frontendNetworkAuthzSuffix = ":frontend-network-authz"
|
||||
frontendTlsPolicySuffix = ":frontend-tls"
|
||||
frontendHttpPolicySuffix = ":frontend-http"
|
||||
frontendLoggingPolicySuffix = ":frontend-logging"
|
||||
@ -25,70 +24,64 @@ const (
|
||||
func translateFrontendPolicyToAgw(
|
||||
policyCtx PolicyCtx,
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
) ([]*api.Policy, error) {
|
||||
policyTarget *api.PolicyTarget,
|
||||
) ([]AgwPolicy, error) {
|
||||
frontend := policy.Spec.Frontend
|
||||
if frontend == nil {
|
||||
return nil, nil
|
||||
}
|
||||
agwPolicies := make([]*api.Policy, 0)
|
||||
agwPolicies := make([]AgwPolicy, 0)
|
||||
var errs []error
|
||||
|
||||
policyName := getFrontendPolicyName(policy.Namespace, policy.Name)
|
||||
appendPolicy := func(kind string) func(*api.Policy, error) {
|
||||
return func(p *api.Policy, err error) {
|
||||
if err != nil {
|
||||
name := fmt.Sprintf("%s %s", kind, policyName)
|
||||
logger.Error("error processing policy", "policy", name, "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if p != nil {
|
||||
agwPolicies = append(agwPolicies, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if s := frontend.HTTP; s != nil {
|
||||
appendPolicy("http")(translateFrontendHTTP(policy, policyName), nil)
|
||||
pol := translateFrontendHTTP(policy, policyName, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := frontend.TLS; s != nil {
|
||||
appendPolicy("tls")(translateFrontendTLS(policy, policyName), nil)
|
||||
pol := translateFrontendTLS(policy, policyName, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := frontend.TCP; s != nil {
|
||||
appendPolicy("tcp")(translateFrontendTCP(policy, policyName), nil)
|
||||
}
|
||||
|
||||
if s := frontend.NetworkAuthorization; s != nil {
|
||||
appendPolicy("networkAuthorization")(translateFrontendNetworkAuthorization(policy, policyName), nil)
|
||||
pol := translateFrontendTCP(policy, policyName, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := frontend.AccessLog; s != nil {
|
||||
appendPolicy("accessLog")(translateFrontendAccessLog(policyCtx, policy, policyName))
|
||||
pol := translateFrontendAccessLog(policy, policyName, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
if s := frontend.Tracing; s != nil {
|
||||
appendPolicy("tracing")(translateFrontendTracing(policyCtx, policy, policyName))
|
||||
pol, err := translateFrontendTracing(policyCtx, policy, policyName, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing tracing", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol...)
|
||||
}
|
||||
|
||||
return agwPolicies, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) ([]AgwPolicy, error) {
|
||||
tracing := policy.Spec.Frontend.Tracing
|
||||
var errs []error
|
||||
if tracing == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
provider, err := buildBackendRef(ctx, tracing.BackendRef, policy.Namespace)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("failed to translate tracing backend ref: %v", err))
|
||||
return nil, fmt.Errorf("failed to translate tracing backend ref: %v", err)
|
||||
}
|
||||
|
||||
var addAttributes []*api.FrontendPolicySpec_TracingAttribute
|
||||
var rmAttributes []string
|
||||
if tracing.Attributes != nil {
|
||||
for _, add := range tracing.Attributes.Add {
|
||||
if !isCEL(add.Expression) {
|
||||
errs = append(errs, fmt.Errorf("frontend tracing attribute %q is not a valid CEL expression: %s", add.Name, add.Expression))
|
||||
}
|
||||
addAttributes = append(addAttributes, &api.FrontendPolicySpec_TracingAttribute{
|
||||
Name: add.Name,
|
||||
Value: string(add.Expression),
|
||||
@ -102,9 +95,6 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
|
||||
var addResources []*api.FrontendPolicySpec_TracingAttribute
|
||||
if tracing.Resources != nil {
|
||||
for _, add := range tracing.Resources {
|
||||
if !isCEL(add.Expression) {
|
||||
errs = append(errs, fmt.Errorf("frontend tracing resource %q is not a valid CEL expression: %s", add.Name, add.Expression))
|
||||
}
|
||||
addResources = append(addResources, &api.FrontendPolicySpec_TracingAttribute{
|
||||
Name: add.Name,
|
||||
Value: string(add.Expression),
|
||||
@ -114,37 +104,34 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
|
||||
|
||||
var randomSampling *string
|
||||
if tracing.RandomSampling != nil {
|
||||
randomSampling = castCELPtr(tracing.RandomSampling, func(expr shared.CELExpression) {
|
||||
errs = append(errs, fmt.Errorf("frontend tracing randomSampling is not a valid CEL expression: %s", expr))
|
||||
})
|
||||
randomSampling = ptr.Of(string(*tracing.RandomSampling))
|
||||
}
|
||||
|
||||
var clientSampling *string
|
||||
if tracing.ClientSampling != nil {
|
||||
clientSampling = castCELPtr(tracing.ClientSampling, func(expr shared.CELExpression) {
|
||||
errs = append(errs, fmt.Errorf("frontend tracing clientSampling is not a valid CEL expression: %s", expr))
|
||||
})
|
||||
clientSampling = ptr.Of(string(*tracing.ClientSampling))
|
||||
}
|
||||
|
||||
var path *string
|
||||
if tracing.Path != nil {
|
||||
path = ptr.Of(*tracing.Path)
|
||||
path = ptr.Of(string(*tracing.Path))
|
||||
}
|
||||
|
||||
var protocol api.FrontendPolicySpec_Tracing_Protocol
|
||||
switch tracing.Protocol {
|
||||
case agentgateway.OTLPProtocolGrpc:
|
||||
case agentgateway.TracingProtocolGrpc:
|
||||
protocol = api.FrontendPolicySpec_Tracing_GRPC
|
||||
case agentgateway.OTLPProtocolHttp:
|
||||
case agentgateway.TracingProtocolHttp:
|
||||
protocol = api.FrontendPolicySpec_Tracing_HTTP
|
||||
default:
|
||||
// default to HTTP
|
||||
protocol = api.FrontendPolicySpec_Tracing_GRPC
|
||||
protocol = api.FrontendPolicySpec_Tracing_HTTP
|
||||
}
|
||||
|
||||
tracingPolicy := &api.Policy{
|
||||
Key: name + frontendTracingPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + frontendTracingPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_Tracing_{Tracing: &api.FrontendPolicySpec_Tracing{
|
||||
@ -163,68 +150,35 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
|
||||
|
||||
logger.Debug("generated tracing policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tracingPolicy.Name)
|
||||
"agentgateway_policy", tracingPolicy.Name,
|
||||
"target", target)
|
||||
|
||||
return tracingPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: tracingPolicy}}, nil
|
||||
}
|
||||
|
||||
func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateFrontendAccessLog(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) []AgwPolicy {
|
||||
logging := policy.Spec.Frontend.AccessLog
|
||||
spec := &api.FrontendPolicySpec_Logging{}
|
||||
var errs []error
|
||||
if f := logging.Filter; f != nil {
|
||||
spec.Filter = castCELPtr(f, func(expr shared.CELExpression) {
|
||||
errs = append(errs, fmt.Errorf("frontend accessLog filter is not a valid CEL expression: %s", expr))
|
||||
})
|
||||
spec.Filter = (*string)(f)
|
||||
}
|
||||
if a := logging.Attributes; a != nil {
|
||||
fields := make([]*api.FrontendPolicySpec_Logging_Field, 0, len(a.Add))
|
||||
for _, add := range a.Add {
|
||||
if !isCEL(add.Expression) {
|
||||
errs = append(errs, fmt.Errorf("frontend accessLog field %q is not a valid CEL expression: %s", add.Name, add.Expression))
|
||||
}
|
||||
fields = append(fields, &api.FrontendPolicySpec_Logging_Field{
|
||||
Name: add.Name,
|
||||
Expression: string(add.Expression),
|
||||
})
|
||||
}
|
||||
f := &api.FrontendPolicySpec_Logging_Fields{
|
||||
Remove: a.Remove,
|
||||
Add: fields,
|
||||
Add: slices.Map(a.Add, func(e agentgateway.AttributeAdd) *api.FrontendPolicySpec_Logging_Field {
|
||||
return &api.FrontendPolicySpec_Logging_Field{
|
||||
Name: e.Name,
|
||||
Expression: string(e.Expression),
|
||||
}
|
||||
}),
|
||||
}
|
||||
spec.Fields = f
|
||||
}
|
||||
if otlp := logging.Otlp; otlp != nil {
|
||||
provider, err := buildBackendRef(ctx, otlp.BackendRef, policy.Namespace)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("failed to translate access log OTLP backend ref: %v", err))
|
||||
}
|
||||
|
||||
var protocol api.FrontendPolicySpec_Logging_OtlpAccessLog_Protocol
|
||||
switch otlp.Protocol {
|
||||
case agentgateway.OTLPProtocolGrpc:
|
||||
protocol = api.FrontendPolicySpec_Logging_OtlpAccessLog_GRPC
|
||||
case agentgateway.OTLPProtocolHttp:
|
||||
protocol = api.FrontendPolicySpec_Logging_OtlpAccessLog_HTTP
|
||||
default:
|
||||
protocol = api.FrontendPolicySpec_Logging_OtlpAccessLog_GRPC
|
||||
}
|
||||
|
||||
var path *string
|
||||
if otlp.Path != nil {
|
||||
path = ptr.Of(*otlp.Path)
|
||||
}
|
||||
|
||||
spec.OtlpAccessLog = &api.FrontendPolicySpec_Logging_OtlpAccessLog{
|
||||
ProviderBackend: provider,
|
||||
Protocol: protocol,
|
||||
Path: path,
|
||||
}
|
||||
}
|
||||
|
||||
loggingPolicy := &api.Policy{
|
||||
Key: name + frontendLoggingPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + frontendLoggingPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_Logging_{
|
||||
@ -236,12 +190,13 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
|
||||
|
||||
logger.Debug("generated logging policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", loggingPolicy.Name)
|
||||
"agentgateway_policy", loggingPolicy.Name,
|
||||
"target", target)
|
||||
|
||||
return loggingPolicy, errors.Join(errs...)
|
||||
return []AgwPolicy{{Policy: loggingPolicy}}
|
||||
}
|
||||
|
||||
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) []AgwPolicy {
|
||||
tcp := policy.Spec.Frontend.TCP
|
||||
spec := &api.FrontendPolicySpec_TCP{}
|
||||
if ka := tcp.KeepAlive; ka != nil {
|
||||
@ -258,8 +213,9 @@ func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
}
|
||||
|
||||
tcpPolicy := &api.Policy{
|
||||
Key: name + frontendTcpPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + frontendTcpPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_Tcp{
|
||||
@ -271,50 +227,17 @@ func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
|
||||
logger.Debug("generated tcp policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tcpPolicy.Name)
|
||||
"agentgateway_policy", tcpPolicy.Name,
|
||||
"target", target)
|
||||
|
||||
return tcpPolicy
|
||||
}
|
||||
|
||||
func translateFrontendNetworkAuthorization(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
auth := policy.Spec.Frontend.NetworkAuthorization
|
||||
var allowPolicies, denyPolicies, requirePolicies []string
|
||||
if auth.Action == shared.AuthorizationPolicyActionDeny {
|
||||
denyPolicies = append(denyPolicies, cast(auth.Policy.MatchExpressions)...)
|
||||
} else if auth.Action == shared.AuthorizationPolicyActionRequire {
|
||||
requirePolicies = append(requirePolicies, cast(auth.Policy.MatchExpressions)...)
|
||||
} else {
|
||||
allowPolicies = append(allowPolicies, cast(auth.Policy.MatchExpressions)...)
|
||||
}
|
||||
|
||||
pol := &api.Policy{
|
||||
Key: name + frontendNetworkAuthzSuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_NetworkAuthorization_{
|
||||
NetworkAuthorization: &api.FrontendPolicySpec_NetworkAuthorization{
|
||||
Allow: allowPolicies,
|
||||
Deny: denyPolicies,
|
||||
Require: requirePolicies,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
logger.Debug("generated frontend network authorization policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", pol.Name)
|
||||
|
||||
return pol
|
||||
return []AgwPolicy{{Policy: tcpPolicy}}
|
||||
}
|
||||
|
||||
func castUint32[T ~int32](ka *T) *uint32 {
|
||||
return ptr.Of((uint32)(*ka))
|
||||
}
|
||||
|
||||
func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) []AgwPolicy {
|
||||
tls := policy.Spec.Frontend.TLS
|
||||
spec := &api.FrontendPolicySpec_TLS{}
|
||||
if ka := tls.HandshakeTimeout; ka != nil {
|
||||
@ -380,8 +303,9 @@ func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
}
|
||||
|
||||
tlsPolicy := &api.Policy{
|
||||
Key: name + frontendTlsPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + frontendTlsPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_Tls{
|
||||
@ -393,12 +317,13 @@ func translateFrontendTLS(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
|
||||
logger.Debug("generated tls policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tlsPolicy.Name)
|
||||
"agentgateway_policy", tlsPolicy.Name,
|
||||
"target", target)
|
||||
|
||||
return tlsPolicy
|
||||
return []AgwPolicy{{Policy: tlsPolicy}}
|
||||
}
|
||||
|
||||
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) []AgwPolicy {
|
||||
http := policy.Spec.Frontend.HTTP
|
||||
spec := &api.FrontendPolicySpec_HTTP{}
|
||||
if v := http.MaxBufferSize; v != nil {
|
||||
@ -427,8 +352,9 @@ func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
}
|
||||
|
||||
httpPolicy := &api.Policy{
|
||||
Key: name + frontendHttpPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: name + frontendHttpPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Frontend{
|
||||
Frontend: &api.FrontendPolicySpec{
|
||||
Kind: &api.FrontendPolicySpec_Http{
|
||||
@ -440,7 +366,8 @@ func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string)
|
||||
|
||||
logger.Debug("generated http policy",
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", httpPolicy.Name)
|
||||
"agentgateway_policy", httpPolicy.Name,
|
||||
"target", target)
|
||||
|
||||
return httpPolicy
|
||||
return []AgwPolicy{{Policy: httpPolicy}}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package plugins_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
|
||||
)
|
||||
|
||||
func TestFrontendPolicies(t *testing.T) {
|
||||
testutils.RunForDirectory(t, "testdata/frontendpolicy", func(t *testing.T, ctx plugins.PolicyCtx) (*gwv1.PolicyStatus, []plugins.AgwPolicy) {
|
||||
pol := testutils.GetTestResource(t, ctx.Collections.AgentgatewayPolicies)
|
||||
s, o := plugins.TranslateAgentgatewayPolicy(ctx.Krt, pol, ctx.Collections)
|
||||
return s, o
|
||||
})
|
||||
}
|
||||
@ -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 (
|
||||
@ -33,9 +33,9 @@ func NewInferencePlugin(agw *AgwCollections) AgwPlugin {
|
||||
wellknown.InferencePoolGVK.GroupKind(): {
|
||||
Build: func(input PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy]) {
|
||||
status, policyCol := krt.NewStatusManyCollection(agw.InferencePools, func(krtctx krt.HandlerContext, infPool *inf.InferencePool) (*inf.InferencePoolStatus, []AgwPolicy) {
|
||||
return translatePoliciesForInferencePool(krtctx, agw.ControllerName, input.References, agw.Services, infPool)
|
||||
return translatePoliciesForInferencePool(krtctx, agw.ControllerName, input.Ancestors, agw.Services, infPool)
|
||||
}, agw.KrtOpts.ToOptions("agentgateway/InferencePools")...)
|
||||
return ConvertStatusCollection(status), policyCol
|
||||
return convertStatusCollection(status), policyCol
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -46,7 +46,7 @@ func NewInferencePlugin(agw *AgwCollections) AgwPlugin {
|
||||
func translatePoliciesForInferencePool(
|
||||
krtctx krt.HandlerContext,
|
||||
controllerName string,
|
||||
references ReferenceIndex,
|
||||
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
|
||||
services krt.Collection[*corev1.Service],
|
||||
pool *inf.InferencePool,
|
||||
) (*inf.InferencePoolStatus, []AgwPolicy) {
|
||||
@ -54,7 +54,7 @@ func translatePoliciesForInferencePool(
|
||||
|
||||
epr := pool.Spec.EndpointPickerRef
|
||||
validationErr := validateInferencePoolEndpointPickerRef(krtctx, pool, services)
|
||||
attachedGateways := inferencePoolAttachedGateways(krtctx, references, pool)
|
||||
attachedGateways := inferencePoolAttachedGateways(krtctx, ancestors, pool)
|
||||
status := buildInferencePoolStatus(pool, controllerName, attachedGateways, validationErr)
|
||||
|
||||
// 'service/{namespace}/{hostname}:{port}'
|
||||
@ -91,11 +91,7 @@ func translatePoliciesForInferencePool(
|
||||
},
|
||||
},
|
||||
}
|
||||
gatewayTargets := make([]types.NamespacedName, 0, len(attachedGateways))
|
||||
for gatewayTarget := range attachedGateways {
|
||||
gatewayTargets = append(gatewayTargets, gatewayTarget)
|
||||
}
|
||||
infPolicies = appendPolicyForGateways(infPolicies, gatewayTargets, inferencePolicy)
|
||||
infPolicies = append(infPolicies, AgwPolicy{Policy: inferencePolicy})
|
||||
|
||||
// Create the TLS policy for the endpoint picker
|
||||
// TODO: we would want some way if they explicitly set a BackendTLSPolicy for the EPP to respect that
|
||||
@ -114,7 +110,7 @@ func translatePoliciesForInferencePool(
|
||||
},
|
||||
},
|
||||
}
|
||||
infPolicies = appendPolicyForGateways(infPolicies, gatewayTargets, inferencePolicyTLS)
|
||||
infPolicies = append(infPolicies, AgwPolicy{Policy: inferencePolicyTLS})
|
||||
|
||||
logger.Debug("generated inference pool policies",
|
||||
"pool", pool.Name,
|
||||
@ -136,9 +132,9 @@ func validateInferencePoolEndpointPickerRef(krtctx krt.HandlerContext, pool *inf
|
||||
kind := epr.Kind
|
||||
if kind == "" {
|
||||
// InferencePool defaults this field to Service.
|
||||
kind = wellknown.ServiceKind
|
||||
kind = inf.Kind(wellknown.ServiceKind)
|
||||
}
|
||||
if kind != wellknown.ServiceKind {
|
||||
if kind != inf.Kind(wellknown.ServiceKind) {
|
||||
errs = append(errs, fmt.Sprintf("endpointPickerRef.kind must be %q, got %q", wellknown.ServiceKind, kind))
|
||||
}
|
||||
|
||||
@ -191,10 +187,13 @@ func inferencePoolValidationError(errs []string) error {
|
||||
|
||||
func inferencePoolAttachedGateways(
|
||||
krtctx krt.HandlerContext,
|
||||
references ReferenceIndex,
|
||||
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
|
||||
pool *inf.InferencePool,
|
||||
) map[types.NamespacedName]struct{} {
|
||||
gateways := make(map[types.NamespacedName]struct{})
|
||||
if ancestors == nil {
|
||||
return gateways
|
||||
}
|
||||
|
||||
targetRef := utils.TypedNamespacedName{
|
||||
NamespacedName: types.NamespacedName{
|
||||
@ -204,8 +203,11 @@ func inferencePoolAttachedGateways(
|
||||
Kind: wellknown.InferencePoolKind,
|
||||
}
|
||||
|
||||
for gateway := range references.LookupGatewaysForBackend(krtctx, targetRef) {
|
||||
gateways[gateway] = struct{}{}
|
||||
ancestorBackends := krt.Fetch(krtctx, ancestors, krt.FilterKey(targetRef.String()))
|
||||
for _, gwl := range ancestorBackends {
|
||||
for _, i := range gwl.Objects {
|
||||
gateways[i.Gateway] = struct{}{}
|
||||
}
|
||||
}
|
||||
return gateways
|
||||
}
|
||||
@ -254,8 +256,8 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
return []inf.ParentReference{}
|
||||
}
|
||||
return []inf.ParentReference{{
|
||||
Kind: defaultInferencePoolStatusKind,
|
||||
Name: defaultInferencePoolStatusName,
|
||||
Kind: inf.Kind(defaultInferencePoolStatusKind),
|
||||
Name: inf.ObjectName(defaultInferencePoolStatusName),
|
||||
}}
|
||||
}
|
||||
|
||||
@ -274,7 +276,7 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
for _, g := range gateways {
|
||||
refs = append(refs, inf.ParentReference{
|
||||
Group: ptr.Of(inf.Group(wellknown.GatewayGroup)),
|
||||
Kind: wellknown.GatewayKind,
|
||||
Kind: inf.Kind(wellknown.GatewayKind),
|
||||
Namespace: inf.Namespace(g.Namespace),
|
||||
Name: inf.ObjectName(g.Name),
|
||||
})
|
||||
|
||||
@ -1,64 +1,70 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"context"
|
||||
|
||||
"istio.io/istio/pilot/pkg/util/protoconv"
|
||||
"istio.io/istio/pkg/config"
|
||||
"istio.io/istio/pkg/kube/controllers"
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient"
|
||||
)
|
||||
|
||||
type PolicyPluginInput struct {
|
||||
References ReferenceIndex
|
||||
}
|
||||
// AgwResourceStatusSyncHandler defines a function that handles status syncing for a specific resource type in AgentGateway
|
||||
type AgwResourceStatusSyncHandler func(ctx context.Context, client apiclient.Client, namespacedName types.NamespacedName, status any) error
|
||||
|
||||
type BackendPlugin struct {
|
||||
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[ir.AgwResource])
|
||||
BuildReferences func() krt.Collection[*PolicyAttachment]
|
||||
type PolicyPluginInput struct {
|
||||
Ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend]
|
||||
}
|
||||
|
||||
type PolicyPlugin struct {
|
||||
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy])
|
||||
BuildReferences func(input PolicyPluginInput) krt.Collection[*PolicyAttachment]
|
||||
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy])
|
||||
}
|
||||
|
||||
// ApplyPolicies extracts all policies from the collection
|
||||
func (p *PolicyPlugin) ApplyPolicies(inputs PolicyPluginInput) (krt.Collection[AgwPolicy], krt.StatusCollection[controllers.Object, any], krt.Collection[*PolicyAttachment]) {
|
||||
func (p *PolicyPlugin) ApplyPolicies(inputs PolicyPluginInput) (krt.Collection[AgwPolicy], krt.StatusCollection[controllers.Object, any]) {
|
||||
status, col := p.Build(inputs)
|
||||
var refs krt.Collection[*PolicyAttachment]
|
||||
if p.BuildReferences != nil {
|
||||
refs = p.BuildReferences(inputs)
|
||||
}
|
||||
return col, status, refs
|
||||
return col, status
|
||||
}
|
||||
|
||||
// AgwPolicy wraps an Agw policy for collection handling
|
||||
type AgwPolicy struct {
|
||||
Gateway *types.NamespacedName
|
||||
Policy *api.Policy
|
||||
Policy *api.Policy
|
||||
// TODO: track errors per policy
|
||||
}
|
||||
|
||||
func (p AgwPolicy) Equals(in AgwPolicy) bool {
|
||||
return ptr.Equal(p.Gateway, in.Gateway) && protoconv.Equals(p.Policy, in.Policy)
|
||||
return protoconv.Equals(p.Policy, in.Policy)
|
||||
}
|
||||
|
||||
func (p AgwPolicy) ResourceName() string {
|
||||
return p.Gateway.String() + "/" + p.Policy.Key
|
||||
return p.Policy.Key
|
||||
}
|
||||
|
||||
type AddResourcesPlugin struct {
|
||||
Binds krt.Collection[ir.AgwResource]
|
||||
Listeners krt.Collection[ir.AgwResource]
|
||||
Routes krt.Collection[ir.AgwResource]
|
||||
AncestorBackends krt.Collection[*utils.AncestorBackend]
|
||||
Binds krt.Collection[ir.AgwResource]
|
||||
Listeners krt.Collection[ir.AgwResource]
|
||||
Routes krt.Collection[ir.AgwResource]
|
||||
}
|
||||
|
||||
// AddBinds extracts all bind resources from the collection
|
||||
func (p *AddResourcesPlugin) AddBinds() krt.Collection[ir.AgwResource] {
|
||||
return p.Binds
|
||||
}
|
||||
|
||||
// AddListeners extracts all routes resources from the collection
|
||||
func (p *AddResourcesPlugin) AddListeners() krt.Collection[ir.AgwResource] {
|
||||
return p.Listeners
|
||||
}
|
||||
|
||||
// AddRoutes extracts all routes resources from the collection
|
||||
func (p *AddResourcesPlugin) AddRoutes() krt.Collection[ir.AgwResource] {
|
||||
return p.Routes
|
||||
}
|
||||
|
||||
func ResourceName[T config.Namer](o T) *api.ResourceName {
|
||||
@ -83,16 +89,3 @@ func TypedResourceFromName(typ string, o types.NamespacedName) *api.TypedResourc
|
||||
Name: o.Name,
|
||||
}
|
||||
}
|
||||
|
||||
func appendPolicyForGateways(policies []AgwPolicy, gatewayTargets []types.NamespacedName, policy *api.Policy) []AgwPolicy {
|
||||
sort.Slice(gatewayTargets, func(i, j int) bool {
|
||||
return gatewayTargets[i].String() < gatewayTargets[j].String()
|
||||
})
|
||||
for _, gatewayTarget := range gatewayTargets {
|
||||
policies = append(policies, AgwPolicy{
|
||||
Gateway: ptr.Of(gatewayTarget),
|
||||
Policy: policy,
|
||||
})
|
||||
}
|
||||
return policies
|
||||
}
|
||||
|
||||
@ -1,326 +0,0 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"istio.io/istio/pkg/kube/krt"
|
||||
"istio.io/istio/pkg/ptr"
|
||||
"istio.io/istio/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
type ReferenceTypes struct {
|
||||
PolicyTargets func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool)
|
||||
PolicyBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
|
||||
RouteBackend func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
|
||||
}
|
||||
|
||||
type BackendReferenceErrorReason string
|
||||
|
||||
const (
|
||||
BackendReferenceErrorReasonBackendNotFound BackendReferenceErrorReason = "BackendNotFound"
|
||||
BackendReferenceErrorReasonInvalidKind BackendReferenceErrorReason = "InvalidKind"
|
||||
BackendReferenceErrorReasonUnsupportedValue BackendReferenceErrorReason = "UnsupportedValue"
|
||||
)
|
||||
|
||||
type BackendReferenceError struct {
|
||||
Reason BackendReferenceErrorReason
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *BackendReferenceError) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
func DefaultReferenceTypes(agw *AgwCollections) ReferenceTypes {
|
||||
return ReferenceTypes{
|
||||
// AgentgatewayPolicy targets
|
||||
PolicyTargets: func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
|
||||
key := namespace + "/" + string(name)
|
||||
switch gk {
|
||||
case wellknown.GatewayGVK.GroupKind():
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.GatewayTarget(namespace, string(name), sectionName),
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Gateways, krt.FilterKey(key))) != nil
|
||||
case wellknown.HTTPRouteGVK.GroupKind():
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.RouteTarget(namespace, string(name), wellknown.HTTPRouteGVK.Kind, sectionName),
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.HTTPRoutes, krt.FilterKey(key))) != nil
|
||||
case wellknown.GRPCRouteGVK.GroupKind():
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.RouteTarget(namespace, string(name), wellknown.GRPCRouteGVK.Kind, sectionName),
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.GRPCRoutes, krt.FilterKey(key))) != nil
|
||||
case wellknown.AgentgatewayBackendGVK.GroupKind():
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.BackendTarget(namespace, string(name), sectionName),
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key))) != nil
|
||||
case wellknown.ServiceGVK.GroupKind():
|
||||
return []*api.PolicyTarget{{
|
||||
Kind: utils.ServiceTarget(namespace, string(name), sectionName),
|
||||
}}, ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key))) != nil
|
||||
}
|
||||
return nil, false
|
||||
},
|
||||
// AgentgatewayPolicy targets to backends (for things like ext_authz, etc)
|
||||
PolicyBackend: func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
ns := string(ptr.OrDefault(namespace, gwv1.Namespace(defaultNamespace)))
|
||||
switch gk {
|
||||
case wellknown.ServiceGVK.GroupKind():
|
||||
if strings.Contains(string(name), ".") {
|
||||
return nil, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonUnsupportedValue,
|
||||
Message: "service name invalid; the name of the Service, not the hostname",
|
||||
}
|
||||
}
|
||||
key := ns + "/" + string(name)
|
||||
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key)))
|
||||
if svc == nil {
|
||||
return nil, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("unable to find the Service %v", key),
|
||||
}
|
||||
}
|
||||
if port == nil {
|
||||
return nil, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonUnsupportedValue,
|
||||
Message: "port is required for Service targets",
|
||||
}
|
||||
}
|
||||
return &api.BackendReference{
|
||||
Kind: &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: kubeutils.GetServiceHostname(string(name), ns),
|
||||
Namespace: ns,
|
||||
},
|
||||
},
|
||||
Port: uint32(*port), //nolint:gosec // G115: validated 1-65535
|
||||
}, nil
|
||||
case wellknown.AgentgatewayBackendGVK.GroupKind():
|
||||
key := ns + "/" + string(name)
|
||||
be := ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key)))
|
||||
if be == nil {
|
||||
return nil, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("unable to find the Backend %v", key),
|
||||
}
|
||||
}
|
||||
return &api.BackendReference{
|
||||
Kind: &api.BackendReference_Backend{
|
||||
Backend: key,
|
||||
},
|
||||
}, nil
|
||||
default:
|
||||
return nil, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonInvalidKind,
|
||||
Message: fmt.Sprintf("unsupported backend %v", gk),
|
||||
}
|
||||
}
|
||||
},
|
||||
RouteBackend: func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
return DefaultRouteBackend(krtctx, agw, defaultNamespace, gk, name, namespace, port)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultRouteBackend(krtctx krt.HandlerContext, agw *AgwCollections, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
ns := string(ptr.OrDefault(namespace, gwv1.Namespace(defaultNamespace)))
|
||||
// All MUST return a BackendReference. We may not be able to fully populate it, though; this will get replaced with 'invalid'
|
||||
ref := &api.BackendReference{}
|
||||
switch gk {
|
||||
case wellknown.InferencePoolGVK.GroupKind():
|
||||
if strings.Contains(string(name), ".") {
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonUnsupportedValue,
|
||||
Message: "InferencePool name invalid; the name of the InferencePool must be used, not the hostname.",
|
||||
}
|
||||
}
|
||||
key := ns + "/" + string(name)
|
||||
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.InferencePools, krt.FilterKey(key)))
|
||||
if svc == nil {
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("backendRef %s not found", key),
|
||||
}
|
||||
}
|
||||
ref.Kind = &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: kubeutils.GetInferenceServiceHostname(string(name), ns),
|
||||
Namespace: ns,
|
||||
},
|
||||
}
|
||||
ref.Port = uint32(svc.Spec.TargetPorts[0].Number) //nolint:gosec // G115: validated 1-65535
|
||||
case wellknown.ServiceGVK.GroupKind():
|
||||
if strings.Contains(string(name), ".") {
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonUnsupportedValue,
|
||||
Message: "service name invalid; the name of the Service must be used, not the hostname.",
|
||||
}
|
||||
}
|
||||
if port == nil { // Validated by CEL so shouldn't happen
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonUnsupportedValue,
|
||||
Message: "port is required in Service backendRef",
|
||||
}
|
||||
}
|
||||
// Populate resp now, so even if the service doesn't exist we can return a better error (Service not found vs invalid)
|
||||
ref.Kind = &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: kubeutils.GetServiceHostname(string(name), ns),
|
||||
Namespace: ns,
|
||||
}}
|
||||
ref.Port = uint32(*port) //nolint:gosec // G115: validated 1-65535
|
||||
key := ns + "/" + string(name)
|
||||
svc := ptr.Flatten(krt.FetchOne(krtctx, agw.Services, krt.FilterKey(key)))
|
||||
if svc == nil {
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("backend(%s) not found", kubeutils.GetServiceHostname(string(name), ns)),
|
||||
}
|
||||
}
|
||||
case wellknown.AgentgatewayBackendGVK.GroupKind():
|
||||
key := ns + "/" + string(name)
|
||||
ref.Kind = &api.BackendReference_Backend{Backend: key}
|
||||
// Populate resp now, so even if the service doesn't exist we can return a better error (Service not found vs invalid)
|
||||
be := ptr.Flatten(krt.FetchOne(krtctx, agw.Backends, krt.FilterKey(key)))
|
||||
if be == nil {
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("Backend not found: %s", key),
|
||||
}
|
||||
}
|
||||
default:
|
||||
return ref, &BackendReferenceError{
|
||||
Reason: BackendReferenceErrorReasonInvalidKind,
|
||||
Message: fmt.Sprintf("referencing unsupported backendRef: group %q kind %q", gk.Group, gk.Kind),
|
||||
}
|
||||
}
|
||||
return ref, nil
|
||||
}
|
||||
|
||||
type RouteAttachment struct {
|
||||
// Route
|
||||
From utils.TypedNamespacedName
|
||||
// Immediate parent (Gateway or ListenerSet)
|
||||
To utils.TypedNamespacedName
|
||||
ListenerName string
|
||||
// Eventual parent (always Gateway)
|
||||
Gateway types.NamespacedName
|
||||
}
|
||||
|
||||
func (r RouteAttachment) ResourceName() string {
|
||||
to := r.To.String()
|
||||
if r.To.Kind != wellknown.GatewayGVK.Kind {
|
||||
to += "/" + r.Gateway.String()
|
||||
}
|
||||
return r.From.Kind + "/" + r.From.NamespacedName.String() + "->" + to + "/" + r.ListenerName
|
||||
}
|
||||
|
||||
func (r RouteAttachment) Equals(other RouteAttachment) bool {
|
||||
return r.From == other.From && r.To == other.To && r.ListenerName == other.ListenerName && r.Gateway == other.Gateway
|
||||
}
|
||||
|
||||
// BuildReferenceIndex builds a set of indexes that can lookup objects through various means.
|
||||
// For example, lookup associated Gateways for a Backend.
|
||||
func BuildReferenceIndex(
|
||||
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
|
||||
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment],
|
||||
referenceTypes ReferenceTypes,
|
||||
) ReferenceIndex {
|
||||
return ReferenceIndex{
|
||||
Ancestors: ancestors,
|
||||
attachments: attachments,
|
||||
explicitReferences: referenceTypes,
|
||||
}
|
||||
}
|
||||
|
||||
type PolicyAttachment struct {
|
||||
Target utils.TypedNamespacedName
|
||||
Backend utils.TypedNamespacedName
|
||||
Source utils.TypedNamespacedName
|
||||
}
|
||||
|
||||
func (a PolicyAttachment) Equals(other PolicyAttachment) bool {
|
||||
return a.Target == other.Target && a.Backend == other.Backend && a.Source == other.Source
|
||||
}
|
||||
|
||||
func (a PolicyAttachment) ResourceName() string {
|
||||
return a.Source.String() + "/" + a.Target.String() + "/" + a.Backend.String()
|
||||
}
|
||||
|
||||
type ReferenceIndex struct {
|
||||
// Backend --> Gateway via Route
|
||||
Ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend]
|
||||
// Backend --> Target via Policy
|
||||
PolicyAttachments krt.IndexCollection[utils.TypedNamespacedName, *PolicyAttachment]
|
||||
// Route --> Gateway
|
||||
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment]
|
||||
// Gateway --> Gateway: trivial, no collection needed
|
||||
// ListenerSet --> Gateway: NOT present; ListenerSet attachment not implemented (but really should be!) in AgentgatewayPolicy anyways
|
||||
|
||||
explicitReferences ReferenceTypes
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
|
||||
switch object.Kind {
|
||||
case wellknown.GatewayGVK.Kind:
|
||||
// Trivial case
|
||||
return sets.New(object.NamespacedName)
|
||||
case wellknown.HTTPRouteGVK.Kind, wellknown.GRPCRouteGVK.Kind, wellknown.TCPRouteGVK.Kind, wellknown.TLSRouteGVK.Kind:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.attachments, object) {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
default:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.Ancestors, object) {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
}
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) LookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
|
||||
return p.lookupGatewaysForBackend(ctx, object, sets.New[utils.TypedNamespacedName]())
|
||||
}
|
||||
|
||||
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]()
|
||||
}
|
||||
|
||||
base := p.LookupGatewaysForTarget(ctx, object)
|
||||
if p.PolicyAttachments == nil {
|
||||
return base
|
||||
}
|
||||
for _, pref := range krtutil.FetchIndexObjects(ctx, p.PolicyAttachments, object) {
|
||||
base = base.Union(p.lookupGatewaysForBackend(ctx, pref.Target, seen))
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) WithPolicyAttachments(references krt.IndexCollection[utils.TypedNamespacedName, *PolicyAttachment]) ReferenceIndex {
|
||||
p.PolicyAttachments = references
|
||||
return p
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
|
||||
return p.explicitReferences.PolicyTargets(krtctx, namespace, name, gk, sectionName)
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) PolicyBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
return p.explicitReferences.PolicyBackend(krtctx, defaultNamespace, gk, name, namespace, port)
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) RouteBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
return p.explicitReferences.RouteBackend(krtctx, defaultNamespace, gk, name, namespace, port)
|
||||
}
|
||||
@ -9,18 +9,15 @@ import (
|
||||
type AgwPlugin struct {
|
||||
AddResourceExtension *AddResourcesPlugin
|
||||
ContributesPolicies map[schema.GroupKind]PolicyPlugin
|
||||
ContributesBackends map[schema.GroupKind]BackendPlugin
|
||||
}
|
||||
|
||||
func MergePlugins(plug ...AgwPlugin) AgwPlugin {
|
||||
ret := AgwPlugin{
|
||||
ContributesPolicies: make(map[schema.GroupKind]PolicyPlugin),
|
||||
ContributesBackends: make(map[schema.GroupKind]BackendPlugin),
|
||||
}
|
||||
for _, p := range plug {
|
||||
// Merge contributed policies
|
||||
maps.Copy(ret.ContributesPolicies, p.ContributesPolicies)
|
||||
maps.Copy(ret.ContributesBackends, p.ContributesBackends)
|
||||
if p.AddResourceExtension != nil {
|
||||
if ret.AddResourceExtension == nil {
|
||||
ret.AddResourceExtension = &AddResourcesPlugin{}
|
||||
@ -34,10 +31,17 @@ func MergePlugins(plug ...AgwPlugin) AgwPlugin {
|
||||
if p.AddResourceExtension.Routes != nil {
|
||||
ret.AddResourceExtension.Routes = p.AddResourceExtension.Routes
|
||||
}
|
||||
if p.AddResourceExtension.AncestorBackends != nil {
|
||||
ret.AddResourceExtension.AncestorBackends = p.AddResourceExtension.AncestorBackends
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Plugins registers all built-in policy plugins
|
||||
func Plugins(agw *AgwCollections) []AgwPlugin {
|
||||
return []AgwPlugin{
|
||||
NewAgentPlugin(agw),
|
||||
NewInferencePlugin(agw),
|
||||
NewA2APlugin(agw),
|
||||
NewBackendTLSPlugin(agw),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func TestMergePluginsMergesBackendContributions(t *testing.T) {
|
||||
backendGK := schema.GroupKind{Group: "enterpriseagentgateway.solo.io", Kind: "EnterpriseAgentgatewayBackend"}
|
||||
|
||||
merged := MergePlugins(AgwPlugin{
|
||||
ContributesBackends: map[schema.GroupKind]BackendPlugin{
|
||||
backendGK: {},
|
||||
},
|
||||
})
|
||||
|
||||
if _, ok := merged.ContributesBackends[backendGK]; !ok {
|
||||
t.Fatalf("expected backend contribution %v to be preserved", backendGK)
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,4 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: GatewayClass
|
||||
metadata:
|
||||
name: agentgateway
|
||||
spec:
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: test
|
||||
@ -31,9 +24,6 @@ spec:
|
||||
- backendRefs:
|
||||
- name: reviews
|
||||
port: 8080
|
||||
- name: be
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
|
||||
@ -114,109 +114,94 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
ai:
|
||||
defaults:
|
||||
logit_bias: '{"50256":-100}'
|
||||
modelAliases:
|
||||
fast: amazon.nova-micro-v1:0
|
||||
smart: anthropic.claude-3-5-sonnet-20241022-v2:0
|
||||
overrides:
|
||||
model: '"gpt-4"'
|
||||
promptCaching:
|
||||
cacheMessages: true
|
||||
cacheSystem: true
|
||||
minTokens: 1024
|
||||
promptGuard:
|
||||
request:
|
||||
- regex:
|
||||
rules:
|
||||
- regex: bad.*
|
||||
- builtin: CREDIT_CARD
|
||||
rejection:
|
||||
body: cmVnZXggcmVqZWN0ZWQgb24gcmVxdWVzdA==
|
||||
- openaiModeration:
|
||||
inlinePolicies:
|
||||
- backendTls:
|
||||
verification: INSECURE_ALL
|
||||
- bedrockGuardrails:
|
||||
identifier: bedrock-guardrail-identifier
|
||||
region: us-west-2
|
||||
version: DRAFT
|
||||
- googleModelArmor:
|
||||
location: us-central1
|
||||
projectId: model-armor-project-id
|
||||
templateId: model-armor-template-id
|
||||
- webhook:
|
||||
backend:
|
||||
port: 80
|
||||
service:
|
||||
hostname: webhook.default.svc.cluster.local
|
||||
namespace: default
|
||||
prompts:
|
||||
append:
|
||||
- content: hello!
|
||||
role: user
|
||||
prepend:
|
||||
- content: be nice
|
||||
role: system
|
||||
routes:
|
||||
'*': PASSTHROUGH
|
||||
/v1/chat/completions: COMPLETIONS
|
||||
/v1/embeddings: PASSTHROUGH
|
||||
/v1/models: PASSTHROUGH
|
||||
key: backend/default/agw:ai:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'failed to build webhook: unable to find the Service default/ai-guardrails-webhook'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
- Policy:
|
||||
backend:
|
||||
ai:
|
||||
defaults:
|
||||
logit_bias: '{"50256":-100}'
|
||||
modelAliases:
|
||||
fast: amazon.nova-micro-v1:0
|
||||
smart: anthropic.claude-3-5-sonnet-20241022-v2:0
|
||||
overrides:
|
||||
model: '"gpt-4"'
|
||||
promptCaching:
|
||||
cacheMessages: true
|
||||
cacheSystem: true
|
||||
minTokens: 1024
|
||||
promptGuard:
|
||||
request:
|
||||
- regex:
|
||||
rules:
|
||||
- regex: bad.*
|
||||
- builtin: CREDIT_CARD
|
||||
rejection:
|
||||
body: cmVnZXggcmVqZWN0ZWQgb24gcmVxdWVzdA==
|
||||
- openaiModeration:
|
||||
inlinePolicies:
|
||||
- backendTls:
|
||||
verification: INSECURE_ALL
|
||||
- bedrockGuardrails:
|
||||
identifier: bedrock-guardrail-identifier
|
||||
region: us-west-2
|
||||
version: DRAFT
|
||||
- googleModelArmor:
|
||||
location: us-central1
|
||||
projectId: model-armor-project-id
|
||||
templateId: model-armor-template-id
|
||||
- webhook:
|
||||
backend:
|
||||
port: 80
|
||||
service:
|
||||
hostname: webhook.default.svc.cluster.local
|
||||
namespace: default
|
||||
prompts:
|
||||
append:
|
||||
- content: hello!
|
||||
role: user
|
||||
prepend:
|
||||
- content: be nice
|
||||
role: system
|
||||
routes:
|
||||
'*': PASSTHROUGH
|
||||
/v1/chat/completions: COMPLETIONS
|
||||
/v1/embeddings: PASSTHROUGH
|
||||
/v1/models: PASSTHROUGH
|
||||
key: backend/default/agw:ai:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'failed to build webhook: unable to find the Service default/ai-guardrails-webhook'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -27,51 +27,40 @@ data:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
auth:
|
||||
aws:
|
||||
explicitConfig:
|
||||
accessKeyId: secret-accessKey
|
||||
secretAccessKey: secret-secretKey
|
||||
sessionToken: secret-sessionToken
|
||||
key: backend/default/agw:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
backend:
|
||||
auth:
|
||||
aws:
|
||||
explicitConfig:
|
||||
accessKeyId: secret-accessKey
|
||||
secretAccessKey: secret-secretKey
|
||||
sessionToken: secret-sessionToken
|
||||
key: backend/default/agw:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
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
|
||||
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
|
||||
|
||||
@ -18,51 +18,40 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
auth:
|
||||
azure:
|
||||
explicitConfig:
|
||||
managedIdentityCredential:
|
||||
userAssignedIdentity:
|
||||
clientId: my-client-id
|
||||
key: backend/default/agw:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
backend:
|
||||
auth:
|
||||
azure:
|
||||
explicitConfig:
|
||||
managedIdentityCredential:
|
||||
userAssignedIdentity:
|
||||
clientId: my-client-id
|
||||
key: backend/default/agw:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
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
|
||||
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
|
||||
|
||||
@ -25,40 +25,29 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
backendTls: {}
|
||||
key: default/agw:tls:default/be
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
backendTls: {}
|
||||
key: default/agw:tls:default/be
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
name: be
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: be
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/mtls not found
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: be
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/mtls not found
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# Intentionally no output. There is no backend, so nothing to attach to.
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
@ -15,29 +14,33 @@ spec:
|
||||
- name: mtls
|
||||
---
|
||||
# Output
|
||||
output: []
|
||||
output:
|
||||
- Policy:
|
||||
backend:
|
||||
backendTls: {}
|
||||
key: default/agw:tls:default/missing
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: missing
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/mtls not found
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: AgentgatewayBackend default/missing not
|
||||
found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: AgentgatewayBackend default/missing not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: be
|
||||
namespace: default
|
||||
spec:
|
||||
static:
|
||||
host: example.com
|
||||
port: 80
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: eviction-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: AgentgatewayBackend
|
||||
name: be
|
||||
group: agentgateway.dev
|
||||
backend:
|
||||
health:
|
||||
unhealthyCondition: foolen_{{response.code}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
health:
|
||||
unhealthyCondition: foolen_{{response.code}}
|
||||
key: default/eviction-invalid-cel:health:default/be
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: eviction-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: be
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: eviction-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'backend health unhealthyCondition is not a valid CEL expression:
|
||||
foolen_{{response.code}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -13,9 +13,6 @@ spec:
|
||||
unhealthyCondition: "response.code >= 500"
|
||||
eviction:
|
||||
duration: 60s
|
||||
restoreHealth: 100
|
||||
consecutiveFailures: 3
|
||||
healthThreshold: 50
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -28,49 +25,35 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
health:
|
||||
eviction:
|
||||
duration: 60s
|
||||
unhealthyCondition: response.code >= 500
|
||||
key: default/agw:health:default/be
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
health:
|
||||
eviction:
|
||||
consecutiveFailures: 3
|
||||
duration: 60s
|
||||
healthThreshold: 0.5
|
||||
restoreHealth: 1
|
||||
unhealthyCondition: response.code >= 500
|
||||
key: default/agw:health:default/be
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
name: be
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: be
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: AgentgatewayBackend default/be not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: AgentgatewayBackend default/be not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -16,49 +16,38 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
auth:
|
||||
gcp:
|
||||
idToken:
|
||||
audience: hello.world.example.com
|
||||
key: backend/default/id:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: id
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: id
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
backend:
|
||||
auth:
|
||||
gcp:
|
||||
idToken:
|
||||
audience: hello.world.example.com
|
||||
key: backend/default/id:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: id
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
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
|
||||
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
|
||||
|
||||
@ -15,28 +15,21 @@ spec:
|
||||
name: aws-auth-secret
|
||||
---
|
||||
# Output
|
||||
output: []
|
||||
output: null
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/aws-auth-secret not found
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: HTTPRoute default/fake not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: HTTPRoute default/fake not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -24,66 +24,51 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
allow:
|
||||
- mcp.tool.name == "echo"
|
||||
- jwt.sub == "test-user" && mcp.tool.name == "add"
|
||||
key: default/agw:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
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
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
allow:
|
||||
- mcp.tool.name == "echo"
|
||||
- jwt.sub == "test-user" && mcp.tool.name == "add"
|
||||
key: default/agw:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
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,61 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: mcp-authz-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: HTTPRoute
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
backend:
|
||||
mcp:
|
||||
authorization:
|
||||
policy:
|
||||
matchExpressions:
|
||||
- foolen_{{mcp.tool.name}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
allow:
|
||||
- foolen_{{mcp.tool.name}}
|
||||
key: default/mcp-authz-invalid-cel:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-authz-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: mcp-authz-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'backend MCP authorization matchExpression is not a valid CEL expression:
|
||||
foolen_{{mcp.tool.name}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,62 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: mcp-authz-require-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: HTTPRoute
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
backend:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- foolen_{{mcp.tool.name}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
require:
|
||||
- foolen_{{mcp.tool.name}}
|
||||
key: default/mcp-authz-require-invalid-cel:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-authz-require-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: mcp-authz-require-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'backend MCP authorization matchExpression is not a valid CEL expression:
|
||||
foolen_{{mcp.tool.name}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,92 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: HTTPRoute
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'request.path == "/mcp"'
|
||||
backend:
|
||||
mcp:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'mcp.tool.name == "echo"'
|
||||
- 'jwt.sub == "test-user" && mcp.tool.name == "add"'
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
require:
|
||||
- mcp.tool.name == "echo"
|
||||
- jwt.sub == "test-user" && mcp.tool.name == "add"
|
||||
key: default/agw:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
require:
|
||||
- request.path == "/mcp"
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -24,68 +24,53 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
allow:
|
||||
- mcp.tool.name == "echo"
|
||||
- jwt.sub == "test-user" && mcp.tool.name == "add"
|
||||
key: default/agw:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
key: traffic/default/agw:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
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
|
||||
traffic:
|
||||
authorization:
|
||||
deny:
|
||||
- "true"
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthorization:
|
||||
allow:
|
||||
- mcp.tool.name == "echo"
|
||||
- jwt.sub == "test-user" && mcp.tool.name == "add"
|
||||
key: default/agw:mcp-authorization:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
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
|
||||
|
||||
@ -5,22 +5,13 @@ metadata:
|
||||
namespace: default
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: test
|
||||
- name: mcp
|
||||
namespace: default
|
||||
rules:
|
||||
- backendRefs:
|
||||
- group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test1
|
||||
- group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test2
|
||||
- group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test3
|
||||
- group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: dummy-oauth
|
||||
- name: agentgateway
|
||||
namespace: agentgateway-system
|
||||
port: 7777
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
@ -145,141 +136,169 @@ metadata:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test1
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/dummy-oauth
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
name: test1
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: dummy-oauth
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test2
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test1
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
name: test2
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: test1
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test3
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test2
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
name: test3
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: test2
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
- Policy:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/dummy-oauth
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
mcpAuthentication:
|
||||
audiences:
|
||||
- api://test
|
||||
issuer: https://sts.windows.net/test-path/
|
||||
jwksInline: '{"keys":[{"use":"enc","kty":"RSA","kid":"-VsQtem_T9-RdhVcv9hK3qVGqtrpLil5z1-ivX2StZY","alg":"RSA-OAEP","n":"klR5MxpPeHVd8cCtYvEL-9lcsv8gTaR_4MM053_XIhzJtq8kV3TY8Co35LD926QzCNam0qhZzckGn0W3S9hPkomNtXsbEoe5-kqY5BpfolUMj9ZfACz04QRqQIdecUGoHh4hAV07-UqHVUEwCVQNjVGZMzHnS05xxeVdCJPc-1KJrw_AVV6tKKSq0Q6TUWs6BFsXCd5zXQEyYPOmSflAmB7-xogWgdBoSplOkiiiGXeJu2_lW4Ob4C5n-cYDjo5-LB6YU3JLBqv78Srs-_wFrtIgG6-LoiljY_hMUWjzBIoHeFILrq02JDboQTJLcyAofRtC04zpFa4ysoSBZqo_6Q","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxVrjANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSVHkzGk94dV3xwK1i8Qv72Vyy/yBNpH/gwzTnf9ciHMm2ryRXdNjwKjfksP3bpDMI1qbSqFnNyQafRbdL2E+SiY21exsSh7n6SpjkGl+iVQyP1l8ALPThBGpAh15xQageHiEBXTv5SodVQTAJVA2NUZkzMedLTnHF5V0Ik9z7UomvD8BVXq0opKrRDpNRazoEWxcJ3nNdATJg86ZJ+UCYHv7GiBaB0GhKmU6SKKIZd4m7b+Vbg5vgLmf5xgOOjn4sHphTcksGq/vxKuz7/AWu0iAbr4uiKWNj+ExRaPMEigd4UguurTYkNuhBMktzICh9G0LTjOkVrjKyhIFmqj/pAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAA6+I0exuvYlEp+wMgBVAliQiETEWijdLokyM/q0CxKPzM81noK/IOdP0+V5vju2hscfgnWO+RN4sIadFs1aplKnQHWeh5AUK3GH1xurTHKE55yOaC3kk855HNrDTGeKtbDwd/map7LRa4X3ZXc4plBkL3cRIRtZg5nautiWt94IsnsXQ2lBEYO68bmjPXXpjTCaVVju5jFAdc+Vv6KaCNGomLfKZnIMk96vRxcy+hR2apyYuzb9b6dUIGqGW7vguyM/3dBKNwYlfCPOINEUsoHeaXM18AQ9gNkxGrC7yxlu4Tt7i+b40VGIgNb1hMYw4U4L2lHbQYgGnqEXGEuk+iE="],"x5t":"1bM36pjoqy7SvlCrwSBe5WKCnIg","x5t#S256":"8lZWfHlpSiOGQeBhWD15fcX2Z1Ti3GwFDtC0yhO62iA"},{"use":"sig","kty":"RSA","kid":"iGhgcK6D5_FtqvMxquHUBk1R8vo_fBMPQWO7SGKvu4s","alg":"RS256","n":"wFxBVOqXcBkMCMex9W5bLB-vQA_47yGaOgaFtomNUFAvUl5YvCeuYbKsPfAsgTY0r_IGqsJm6T5MPdDPNpXrg2iC0v8TqbXxAUJHJdxOeK_md4HkVKa7yA5z6mEC2kEP3YyPeeCcV4F8l_tH9KEP3uZ957N0i9hTWgvOKbDI5TBGWsndu29p9ukqfY4vR1_TLp2W-uOWs6xeEylYQymfvRw14DFOyQ1EqrLxh9j4h6I58xKd0QuQypAbsRVosEaDy6rIyMOtcWdib4Urc9IEok_ZNIEuWvdROzWpSBALxudKNw0dAWkb0EP-T260zF0PjwVe9jAnvc5E7TtSTtUSNQ","e":"AQAB","x5c":["MIIClTCCAX0CBgGaooxUwzANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANtY3AwHhcNMjUxMTIwMTgzMzE3WhcNMzUxMTIwMTgzNDU3WjAOMQwwCgYDVQQDDANtY3AwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAXEFU6pdwGQwIx7H1blssH69AD/jvIZo6BoW2iY1QUC9SXli8J65hsqw98CyBNjSv8gaqwmbpPkw90M82leuDaILS/xOptfEBQkcl3E54r+Z3geRUprvIDnPqYQLaQQ/djI954JxXgXyX+0f0oQ/e5n3ns3SL2FNaC84psMjlMEZayd27b2n26Sp9ji9HX9MunZb645azrF4TKVhDKZ+9HDXgMU7JDUSqsvGH2PiHojnzEp3RC5DKkBuxFWiwRoPLqsjIw61xZ2JvhStz0gSiT9k0gS5a91E7NalIEAvG50o3DR0BaRvQQ/5PbrTMXQ+PBV72MCe9zkTtO1JO1RI1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFz7bs/LvuExjgijQ1awszjURHwVOPiplfFzvD3IETNDQsTh0krlFFze2FmPAyjIFwfuahoJ3Y0TskhCJTscwPgI2CHHMsL/N2qnHImlIVDWS8kqjJ5Y4tFcnvALE/Q9mNQ55sNkj4/4UZGeOAmnIz6JrWg6MWUGmawc1iGZpk/80dSUoI882gXCDNrNIfL1Fq5SbqRC/DCnGJXD6FsgQAUnnEVlJiLdcOGlpNC9VeuAI72Xwm3wXbIlp8261vgzZdXTNf1x6P+55wZtbLFozkfShqKHPHb3d01sYE8k54tdbC5U3S7kaA17LIhMTJF8rtgBLPBvpsPXqdxrIhv+40s="],"x5t":"zleSIM51HMsnq9hHk3cYB4W8Hbs","x5t#S256":"aiG5FvGkx3gyaRONjzYNS_MCpXWqxRFQsBeWW_54UMs"}]}'
|
||||
mode: STRICT
|
||||
resourceMetadata:
|
||||
extra:
|
||||
authorizationServers:
|
||||
- https://mcp.k8s.test.info
|
||||
scopesSupported:
|
||||
- api://test/agentgateway
|
||||
x-issuer: http://agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer
|
||||
key: default/mcp-auth:mcp-authentication:default/test3
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: mcp-auth
|
||||
name: dummy-oauth
|
||||
namespace: default
|
||||
target:
|
||||
backend:
|
||||
name: test3
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: mcp-auth
|
||||
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
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: dummy-oauth
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test1
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test2
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: test3
|
||||
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
|
||||
|
||||
@ -46,91 +46,58 @@ data:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
auth:
|
||||
key: {}
|
||||
key: backend/default/agw:backend-auth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
backendHttp:
|
||||
requestTimeout: 10s
|
||||
version: HTTP2
|
||||
key: default/agw:backend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
backendTls:
|
||||
alpn:
|
||||
protocols:
|
||||
- http/1.1
|
||||
- h2
|
||||
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
hostname: example.com
|
||||
key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzJ4UGkreEwrNU05ZTYKdUpiNEI5ZjlEczJ6MU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1Mgp1Z3ZPL3psTlZkMjN1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDCmZjalZna0g3R2Z4Zk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEYKRUljcWpSSDFXTU9GS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVQo3RHE3Y2YyUWZWd2Z6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qCm8zcHltTlRuQWdNQkFBRUNnZ0VBQnZ3cGZZWkxjQ3FPWTNFaE9VTE9KYnBtY05SVndoRk94NlFEbkI3NUhyV3oKUU9Kc2VvOE9KVXN1NWt1UFN1MlA4WWJCeXlqdVRoSTRNa0xvcDBxVEhXVGJYN3JTNU0yb2xYVWZBa0treXpZcQpaY09EL3JpaUZTSGVZTGQwNGpySmQ3N3RQc3hTbDVyZWRRNUFSSzRCRTRyL1hZR2lBaUhPeEJFdmgyYm9BMTE4Cm1pejZzMjhhSXVxekZoUUdpOEh5ejREOVJCUzJkRWFsazFWK2V1QVhocHFxZ29HRms4TFhrWGxtUlpzZVdYN0MKZEpyVjhQL0grTGZXb3JCM09KRGs3SWIrek9Cc0pLeklwM3NiRlVsajdraGcyd2xjYi9SZUQrUU5BR1VQR3h1YQpHVndqRFVBSmpwb1RmamhIdjdhYUwwaWtyVVB6a1J2TEFQdjBwc0syb1FLQmdRRE05V2tyZkFhZjh2ZVNxR2lzCk1aSkNtOWFVVkUwdGY4eWkxL3owaGxRYlJFb25Mc2xZM0NCWlFZMHZ1T1owWFc1U29PQ1BUamRKRW1lUjFHTFIKVS9BSUJwRmhnNW5VMVIxaEprUkkyOWtPaGFHVXFBREpSR1ErZWdhK0IrQldLNVhUa3hGVFdFRjBSRDhVWENkQQpXa2lzaFBrU1V0VjV2VjdqNy9ibitSR09hUUtCZ1FEa1NQSmlBMTFNODhBSENTdjRWaHJDb3NRdjZURnZyK0p2CnFJVmlmMHowcFBvT0ZDVE1OdUcxN1Zxa29WV0d6U0R6ejBMYUJHWllGRlk5M2E0cGtxZWNnS3kxZVN1eHJKdlEKUko4WTRKSXpKYXlDbzRhc0lURGJPV21LaGk1am92bHkxRDVmSlFKMjNyUVNsWlRSbHVOdWJpVWxTQkErTS9EcQptcFg4c3ZkK3p3S0JnSCszTlEvWnV5OFVjZDA3Zis0OC9ZendHdWhYRjdpUWVHM0k5V0ZTQ3pycWRPS3hydG5tCllXbjlCUU9Gem1VWWkxU0YxeWkxYnBIa0hCR3RMTjZQMVhUSzB2RFcxcGJmTGUySnNPZE54NVhiQTNMa3RZaTEKUzFuN0pCUnFTQXFxSWpTeTRncnpaZVlUV05OUkVVeHlkZks2OFpIUGVDTGlOQzBKTE93a01pSnhBb0dCQUkvMgpGS3lNdEp6ZnBueUpZeW96bXFLZHBKMFdNTy9lK2l3eUdSTzVkZDFkNExkYUtxNkIrYXNSNkxTamJWMGFKU3E3CnpNdlNOSHhkTHRuSzM1Y2wvZjlyQWY5YlQ1dTNYM2RpbnZaQVFOSnljcXpiMVFUZDFZS2FYUjFYYXcrNGFoanAKRWdCTVJaYVM4UG83VEdNMEJXN1JsU2xDbmNPc1c4U0hBZ2tmRDRidkFvR0FUdmxGT0JiNDJmb3hIMTZsQzVtbQpsZThYdWd0eE5zUGY1OTVUVWw4OFRVZVhnZXlFUlQwMDY4NGo4M0pxcjViTENoc016RlYraTUwUjVQWnZsYW1tCnVkdm04NEFmblN1MktHaVBoTFovZkU2K3NVT284NWIza3R6UkZreFBIQklkbEt6V3FWRDhhV0NjcmxGbjdXTVUKM3RlUllXL2NFRFExUFRnTGZBa2I3Rms9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
|
||||
root: ""
|
||||
verifySubjectAltNames:
|
||||
- '*.example.com'
|
||||
- api.example.com
|
||||
key: default/agw:tls:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
backend:
|
||||
backendHttp:
|
||||
requestTimeout: 10s
|
||||
version: HTTP2
|
||||
key: default/agw:backend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: |-
|
||||
ConfigMap default/ca-bundle not found
|
||||
secret default/hello missing Authorization value
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- Policy:
|
||||
backend:
|
||||
backendTls:
|
||||
alpn:
|
||||
protocols:
|
||||
- http/1.1
|
||||
- h2
|
||||
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
hostname: example.com
|
||||
key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzJ4UGkreEwrNU05ZTYKdUpiNEI5ZjlEczJ6MU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1Mgp1Z3ZPL3psTlZkMjN1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDCmZjalZna0g3R2Z4Zk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEYKRUljcWpSSDFXTU9GS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVQo3RHE3Y2YyUWZWd2Z6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qCm8zcHltTlRuQWdNQkFBRUNnZ0VBQnZ3cGZZWkxjQ3FPWTNFaE9VTE9KYnBtY05SVndoRk94NlFEbkI3NUhyV3oKUU9Kc2VvOE9KVXN1NWt1UFN1MlA4WWJCeXlqdVRoSTRNa0xvcDBxVEhXVGJYN3JTNU0yb2xYVWZBa0treXpZcQpaY09EL3JpaUZTSGVZTGQwNGpySmQ3N3RQc3hTbDVyZWRRNUFSSzRCRTRyL1hZR2lBaUhPeEJFdmgyYm9BMTE4Cm1pejZzMjhhSXVxekZoUUdpOEh5ejREOVJCUzJkRWFsazFWK2V1QVhocHFxZ29HRms4TFhrWGxtUlpzZVdYN0MKZEpyVjhQL0grTGZXb3JCM09KRGs3SWIrek9Cc0pLeklwM3NiRlVsajdraGcyd2xjYi9SZUQrUU5BR1VQR3h1YQpHVndqRFVBSmpwb1RmamhIdjdhYUwwaWtyVVB6a1J2TEFQdjBwc0syb1FLQmdRRE05V2tyZkFhZjh2ZVNxR2lzCk1aSkNtOWFVVkUwdGY4eWkxL3owaGxRYlJFb25Mc2xZM0NCWlFZMHZ1T1owWFc1U29PQ1BUamRKRW1lUjFHTFIKVS9BSUJwRmhnNW5VMVIxaEprUkkyOWtPaGFHVXFBREpSR1ErZWdhK0IrQldLNVhUa3hGVFdFRjBSRDhVWENkQQpXa2lzaFBrU1V0VjV2VjdqNy9ibitSR09hUUtCZ1FEa1NQSmlBMTFNODhBSENTdjRWaHJDb3NRdjZURnZyK0p2CnFJVmlmMHowcFBvT0ZDVE1OdUcxN1Zxa29WV0d6U0R6ejBMYUJHWllGRlk5M2E0cGtxZWNnS3kxZVN1eHJKdlEKUko4WTRKSXpKYXlDbzRhc0lURGJPV21LaGk1am92bHkxRDVmSlFKMjNyUVNsWlRSbHVOdWJpVWxTQkErTS9EcQptcFg4c3ZkK3p3S0JnSCszTlEvWnV5OFVjZDA3Zis0OC9ZendHdWhYRjdpUWVHM0k5V0ZTQ3pycWRPS3hydG5tCllXbjlCUU9Gem1VWWkxU0YxeWkxYnBIa0hCR3RMTjZQMVhUSzB2RFcxcGJmTGUySnNPZE54NVhiQTNMa3RZaTEKUzFuN0pCUnFTQXFxSWpTeTRncnpaZVlUV05OUkVVeHlkZks2OFpIUGVDTGlOQzBKTE93a01pSnhBb0dCQUkvMgpGS3lNdEp6ZnBueUpZeW96bXFLZHBKMFdNTy9lK2l3eUdSTzVkZDFkNExkYUtxNkIrYXNSNkxTamJWMGFKU3E3CnpNdlNOSHhkTHRuSzM1Y2wvZjlyQWY5YlQ1dTNYM2RpbnZaQVFOSnljcXpiMVFUZDFZS2FYUjFYYXcrNGFoanAKRWdCTVJaYVM4UG83VEdNMEJXN1JsU2xDbmNPc1c4U0hBZ2tmRDRidkFvR0FUdmxGT0JiNDJmb3hIMTZsQzVtbQpsZThYdWd0eE5zUGY1OTVUVWw4OFRVZVhnZXlFUlQwMDY4NGo4M0pxcjViTENoc016RlYraTUwUjVQWnZsYW1tCnVkdm04NEFmblN1MktHaVBoTFovZkU2K3NVT284NWIza3R6UkZreFBIQklkbEt6V3FWRDhhV0NjcmxGbjdXTVUKM3RlUllXL2NFRFExUFRnTGZBa2I3Rms9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
|
||||
root: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
verifySubjectAltNames:
|
||||
- '*.example.com'
|
||||
- api.example.com
|
||||
key: default/agw:tls:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: |-
|
||||
ConfigMap default/ca-bundle not found
|
||||
secret default/hello missing Authorization value
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -21,54 +21,43 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
transformation:
|
||||
request:
|
||||
set:
|
||||
- expression: request.headers['x-request-id']
|
||||
name: x-backend-req
|
||||
response:
|
||||
add:
|
||||
- expression: string(response.code)
|
||||
name: x-backend-resp
|
||||
key: default/agw:backend-transformation:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
backend:
|
||||
transformation:
|
||||
request:
|
||||
set:
|
||||
- expression: request.headers['x-request-id']
|
||||
name: x-backend-req
|
||||
response:
|
||||
add:
|
||||
- expression: string(response.code)
|
||||
name: x-backend-resp
|
||||
key: default/agw:backend-transformation:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
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
|
||||
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,75 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: HTTPRoute
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
backend:
|
||||
tunnel:
|
||||
backendRef:
|
||||
name: proxy
|
||||
port: 3128
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: proxy
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 3128
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
backend:
|
||||
backendTunnel:
|
||||
proxy:
|
||||
port: 3128
|
||||
service:
|
||||
hostname: proxy.default.svc.cluster.local
|
||||
namespace: default
|
||||
key: default/agw:backend-tunnel:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,11 +1,4 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: GatewayClass
|
||||
metadata:
|
||||
name: agentgateway
|
||||
spec:
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: test
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: accesslog-invalid-filter
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
frontend:
|
||||
accessLog:
|
||||
filter: foolen_{{response.code}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
logging:
|
||||
filter: foolen_{{response.code}}
|
||||
key: frontend/default/accesslog-invalid-filter:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: accesslog-invalid-filter
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: accesslog-invalid-filter
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'frontend accessLog filter is not a valid CEL expression: foolen_{{response.code}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,93 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: accesslog-otlp-policy
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
frontend:
|
||||
accessLog:
|
||||
filter: 'response.code >= 400'
|
||||
attributes:
|
||||
remove:
|
||||
- request.headers["authorization"]
|
||||
add:
|
||||
- expression: 'request.headers["x-request-id"]'
|
||||
name: trace.id
|
||||
otlp:
|
||||
backendRef:
|
||||
name: otel-collector
|
||||
port: 4318
|
||||
protocol: HTTP
|
||||
path: /custom/v1/logs
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: otel-collector
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 4318
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
logging:
|
||||
fields:
|
||||
add:
|
||||
- expression: request.headers["x-request-id"]
|
||||
name: trace.id
|
||||
remove:
|
||||
- request.headers["authorization"]
|
||||
filter: response.code >= 400
|
||||
otlpAccessLog:
|
||||
path: /custom/v1/logs
|
||||
providerBackend:
|
||||
port: 4318
|
||||
service:
|
||||
hostname: otel-collector.default.svc.cluster.local
|
||||
namespace: default
|
||||
key: frontend/default/accesslog-otlp-policy:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: accesslog-otlp-policy
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: accesslog-otlp-policy
|
||||
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
|
||||
@ -20,52 +20,41 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
logging:
|
||||
fields:
|
||||
add:
|
||||
- expression: request.headers["x-request-id"]
|
||||
name: trace.id
|
||||
remove:
|
||||
- request.headers["authorization"]
|
||||
filter: response.code >= 400
|
||||
key: frontend/default/accesslog-policy:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: accesslog-policy
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: accesslog-policy
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
frontend:
|
||||
logging:
|
||||
fields:
|
||||
add:
|
||||
- expression: request.headers["x-request-id"]
|
||||
name: trace.id
|
||||
remove:
|
||||
- request.headers["authorization"]
|
||||
filter: response.code >= 400
|
||||
key: frontend/default/accesslog-policy:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: accesslog-policy
|
||||
namespace: default
|
||||
target:
|
||||
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
|
||||
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
|
||||
|
||||
@ -62,133 +62,83 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
http:
|
||||
http2FrameSize: 17000
|
||||
maxBufferSize: 1000
|
||||
key: frontend/default/agw:frontend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
logging:
|
||||
fields:
|
||||
add:
|
||||
- expression: request.headers["user-agent"]
|
||||
name: http.useragent
|
||||
remove:
|
||||
- response.code
|
||||
filter: response.code != 200
|
||||
key: frontend/default/agw:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tcp:
|
||||
keepalives:
|
||||
interval: 30s
|
||||
retries: 5
|
||||
time: 60s
|
||||
key: frontend/default/agw:frontend-tcp:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tls:
|
||||
alpn:
|
||||
protocols:
|
||||
- custom
|
||||
handshakeTimeout: 10s
|
||||
key: frontend/default/agw:frontend-tls:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tracing:
|
||||
attributes:
|
||||
- name: http.useragent
|
||||
value: request.headers["user-agent"]
|
||||
clientSampling: "true"
|
||||
protocol: GRPC
|
||||
randomSampling: "true"
|
||||
remove:
|
||||
- response.code
|
||||
resources:
|
||||
- name: service.name
|
||||
value: agent-gateway
|
||||
key: frontend/default/agw:frontend-tracing:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
frontend:
|
||||
http:
|
||||
http2FrameSize: 17000
|
||||
maxBufferSize: 1000
|
||||
key: frontend/default/agw:frontend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'failed to translate tracing backend ref: unable to find the Service
|
||||
some-other-ns/my-otel'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- Policy:
|
||||
frontend:
|
||||
tls:
|
||||
alpn:
|
||||
protocols:
|
||||
- custom
|
||||
handshakeTimeout: 10s
|
||||
key: frontend/default/agw:frontend-tls:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- Policy:
|
||||
frontend:
|
||||
tcp:
|
||||
keepalives:
|
||||
interval: 30s
|
||||
retries: 5
|
||||
time: 60s
|
||||
key: frontend/default/agw:frontend-tcp:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- Policy:
|
||||
frontend:
|
||||
logging:
|
||||
fields:
|
||||
add:
|
||||
- expression: request.headers["user-agent"]
|
||||
name: http.useragent
|
||||
remove:
|
||||
- response.code
|
||||
filter: response.code != 200
|
||||
key: frontend/default/agw:frontend-logging:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'failed to translate tracing backend ref: unable to find the Service
|
||||
some-other-ns/my-otel'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -27,47 +27,36 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
http:
|
||||
http2FrameSize: 16384
|
||||
maxBufferSize: 2048
|
||||
key: frontend/default/http-policy:frontend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: http-policy
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: http-policy
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
frontend:
|
||||
http:
|
||||
http2FrameSize: 16384
|
||||
maxBufferSize: 2048
|
||||
key: frontend/default/http-policy:frontend-http:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: http-policy
|
||||
namespace: default
|
||||
target:
|
||||
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
|
||||
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,63 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
frontend:
|
||||
networkAuthorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- 'cidr("10.0.0.0/8").containsIP(source.address)'
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
networkAuthorization:
|
||||
require:
|
||||
- cidr("10.0.0.0/8").containsIP(source.address)
|
||||
key: frontend/default/agw:frontend-network-authz:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -29,49 +29,38 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tcp:
|
||||
keepalives:
|
||||
interval: 30s
|
||||
retries: 3
|
||||
time: 120s
|
||||
key: frontend/default/tcp-keepalive-policy:frontend-tcp:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: tcp-keepalive-policy
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: tcp-keepalive-policy
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
- Policy:
|
||||
frontend:
|
||||
tcp:
|
||||
keepalives:
|
||||
interval: 30s
|
||||
retries: 3
|
||||
time: 120s
|
||||
key: frontend/default/tcp-keepalive-policy:frontend-tcp:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: tcp-keepalive-policy
|
||||
namespace: default
|
||||
target:
|
||||
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
|
||||
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
|
||||
|
||||
@ -14,44 +14,33 @@ spec:
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: fake-gw
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tls:
|
||||
handshakeTimeout: 15s
|
||||
key: frontend/default/tls-policy:frontend-tls:default/fake-gw
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: tls-policy
|
||||
- Policy:
|
||||
frontend:
|
||||
tls:
|
||||
handshakeTimeout: 15s
|
||||
key: frontend/default/tls-policy:frontend-tls:default/fake-gw
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: tls-policy
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: fake-gw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: fake-gw
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: tls-policy
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: Gateway default/fake-gw not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: 'Policy is not attached: Gateway default/fake-gw not found'
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
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