Compare commits
1 Commits
main
...
howardjohn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a946a5c98 |
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
|
||||
205
.github/workflows/pull_request.yml
vendored
205
.github/workflows/pull_request.yml
vendored
@ -4,9 +4,11 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- "howardjohn/pre-regression"
|
||||
pull_request:
|
||||
branches:
|
||||
- "main"
|
||||
- "howardjohn/pre-regression"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
||||
@ -16,137 +18,25 @@ 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 ####
|
||||
proxy-test:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: blacksmith-4vcpu-ubuntu-2404
|
||||
name: "Proxy Test"
|
||||
- os: windows-2025
|
||||
name: "Proxy Test (Windows)"
|
||||
- os: macos-15
|
||||
name: "Proxy Test (Mac)"
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
# Github cache is too tiny to handle the full matrix :-(
|
||||
if: ${{ startsWith(matrix.os, 'blacksmith-') }}
|
||||
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
|
||||
|
||||
proxy-lint:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
with:
|
||||
# Github cache will restore from 'main' OR the current branch.
|
||||
# If we cache PR branches, we may evict the 'main' cache and end up with no cache hits at all.
|
||||
# Ideally, we would have main be 'high priority' and not be evicted but I don't think thats possible.
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Generation
|
||||
run: make generate-schema check-clean-repo
|
||||
- name: Lint
|
||||
run: make lint
|
||||
|
||||
#### UI jobs ####
|
||||
ui-lint:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ui
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
with:
|
||||
node-version: 24
|
||||
- name: Lint
|
||||
run: |
|
||||
npm ci
|
||||
npm run lint
|
||||
|
||||
#### Controller jobs ####
|
||||
controller-test:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
**/*.sum
|
||||
.github/workflows/cache-lint
|
||||
- name: Test
|
||||
run: go test -race ./...
|
||||
|
||||
controller-lint:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
**/*.sum
|
||||
.github/workflows/cache-test
|
||||
- name: Lint
|
||||
run: make -C controller analyze
|
||||
- name: go mod tidy
|
||||
run: |
|
||||
go mod tidy
|
||||
git diff --exit-code go.mod go.sum
|
||||
- name: Gen
|
||||
# TODO: the rest of codegen
|
||||
run: make generate-apis check-clean-repo
|
||||
|
||||
controller-e2e:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
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: |
|
||||
@ -155,6 +45,20 @@ jobs:
|
||||
- name: Set Path
|
||||
run: |
|
||||
echo "./tools" >> $GITHUB_PATH
|
||||
- name: Fake cache
|
||||
run: |
|
||||
cargo build --profile ci
|
||||
cargo clean -p agentgateway || true
|
||||
cargo clean -p agentgateway-app || true
|
||||
cargo clean -p cel || true
|
||||
cargo clean -p agent-celx || true
|
||||
cargo clean -p agent-core || true
|
||||
cargo clean -p agent-hbone || true
|
||||
cargo clean -p htpasswd-verify-fork || true
|
||||
cargo clean -p hyper-util-fork || true
|
||||
cargo clean -p agent-xds || true
|
||||
|
||||
echo "./tools" >> $GITHUB_PATH
|
||||
- name: Setup
|
||||
run: TEST_MODE=e2e ./controller/test/setup/setup-kind-ci.sh
|
||||
- name: E2E
|
||||
@ -162,13 +66,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
|
||||
@ -177,64 +81,3 @@ jobs:
|
||||
run: |
|
||||
echo '# E2E Timings\n'
|
||||
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
controller-conformance:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
|
||||
with:
|
||||
toolchain: "${{ env.RUST_VERSION }}"
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
with:
|
||||
# We only read the cache from 'E2E' job, since they should have identical cache.
|
||||
save-if: "false"
|
||||
shared-key: "controller-e2e" # Pull E2E job's cache
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
|
||||
with:
|
||||
go-version: "${{ env.GO_VERSION }}"
|
||||
cache-dependency-path: |
|
||||
**/*.sum
|
||||
.github/workflows/cache-e2e
|
||||
- name: Set Path
|
||||
run: |
|
||||
echo "./tools" >> $GITHUB_PATH
|
||||
- name: Setup
|
||||
run: TEST_MODE=conformance ./controller/test/setup/setup-kind-ci.sh
|
||||
- name: Conformance
|
||||
run: |
|
||||
make -C controller all-conformance
|
||||
- name: Debug Info
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
kubectl describe deployment -n agentgateway-system
|
||||
kubectl get pods -n agentgateway-system
|
||||
kubectl logs -n agentgateway-system -l app.kubernetes.io/name=agentgateway
|
||||
- name: Upload cargo timings
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
with:
|
||||
name: cargo-timings-conformance
|
||||
path: target/cargo-timings/cargo-timing*.html
|
||||
retention-days: 2
|
||||
- name: Summary
|
||||
run: |
|
||||
cat-yamls () {
|
||||
local files=("$@")
|
||||
local count=$#
|
||||
|
||||
for ((i=0; i<count-1; i++)); do
|
||||
cat "${files[i]}"
|
||||
echo -e "\n---"
|
||||
done
|
||||
|
||||
if [ $count -gt 0 ]; then
|
||||
cat "${files[count-1]}"
|
||||
fi
|
||||
}
|
||||
|
||||
echo -e '\n# Conformance Reports\n\n```yaml' >> $GITHUB_STEP_SUMMARY
|
||||
cat-yamls ./controller/_test/conformance/*.yaml >> $GITHUB_STEP_SUMMARY
|
||||
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
|
||||
echo -e '# Conformance Timings\n' >> $GITHUB_STEP_SUMMARY
|
||||
cat controller/_test/ci-step-timings.log >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
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 }}
|
||||
|
||||
861
Cargo.lock
generated
861
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
77
Cargo.toml
77
Cargo.toml
@ -13,7 +13,6 @@ members = [
|
||||
"crates/celx",
|
||||
"crates/core",
|
||||
"crates/hbone",
|
||||
"crates/protos",
|
||||
"crates/xds",
|
||||
"crates/xtask",
|
||||
]
|
||||
@ -25,7 +24,6 @@ default-members = [
|
||||
"crates/celx",
|
||||
"crates/core",
|
||||
"crates/hbone",
|
||||
"crates/protos",
|
||||
"crates/xds",
|
||||
]
|
||||
|
||||
@ -44,47 +42,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 +93,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 +123,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 +135,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 +150,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 +166,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 +199,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 +210,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 +223,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:
|
||||
|
||||
52
README.md
52
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">
|
||||
@ -41,31 +41,20 @@
|
||||
|
||||
[](https://youtu.be/SomP92JWPmE)
|
||||
|
||||
## Key Features
|
||||
## Key Features:
|
||||
|
||||
- **LLM Gateway**<br>
|
||||
Route traffic to major LLM providers (OpenAI, Anthropic, Gemini, Bedrock, and more) through a unified OpenAI-compatible API with budget and spend controls, prompt enrichment, load balancing, and failover.
|
||||
|
||||
- **MCP Gateway**<br>
|
||||
Connect LLMs to tools and external data sources via MCP with tool federation, stdio/HTTP/SSE/Streamable HTTP transports, OpenAPI integration, and OAuth authentication.
|
||||
|
||||
- **A2A Gateway**<br>
|
||||
Enable secure agent-to-agent communication using A2A, with capability discovery, modality negotiation, and task collaboration.
|
||||
|
||||
- **Inference Routing**<br>
|
||||
Intelligent routing to self-hosted models using Kubernetes Inference Gateway extensions, with decisions based on GPU utilization, KV cache, LoRA adapters, and queue depth.
|
||||
|
||||
- **Guardrails**<br>
|
||||
Multi-layered content filtering with regex, OpenAI moderation, AWS Bedrock Guardrails, Google Model Armor, and custom webhooks.
|
||||
|
||||
- **Security & Observability**<br>
|
||||
Auth (JWT, API keys, OAuth), fine-grained RBAC with CEL policy engine, rate limiting, TLS, and OpenTelemetry metrics/logs/tracing.
|
||||
- [x] **Highly performant:** agentgateway is written in rust, and is designed from the ground up to handle any scale you can throw at it.
|
||||
- [x] **Security First:** agentgateway includes a robust MCP/A2A focused RBAC system.
|
||||
- [x] **Multi Tenant:** agentgateway supports multiple tenants, each with their own set of resources and users.
|
||||
- [x] **Dynamic:** agentgateway supports dynamic configuration updates via xDS, without any downtime.
|
||||
- [x] **Run Anywhere:** agentgateway can run anywhere with any agent framework, from a single machine to a large scale multi-tenant deployment.
|
||||
- [x] **Legacy API Support:** agentgateway can transform legacy APIs into MCP resources. Currently supports OpenAPI. (gRPC coming soon)
|
||||
- [x] **Kubernetes Native:** agentgateway includes a built-in Kubernetes controller for dynamic provisioning and management via the Kubernetes Gateway API.
|
||||
<br>
|
||||
|
||||
## Getting Started
|
||||
## Getting Started
|
||||
|
||||
- [Standalone Quickstart](https://agentgateway.dev/docs/quickstart) — Get started with agentgateway in minutes.
|
||||
- [Kubernetes Quickstart](https://agentgateway.dev/docs/kubernetes/latest) — Deploy on Kubernetes using the built-in controller and Gateway API.
|
||||
To get started with agentgateway, please check out the [Getting Started Guide](https://agentgateway.dev/docs/quickstart).
|
||||
|
||||
## Documentation
|
||||
|
||||
@ -80,23 +69,6 @@ Agentgateway has a built-in UI for you to explore agentgateway connecting agent-
|
||||
<img alt="agentgateway UI" src="img/UI-homepage.png">
|
||||
</div>
|
||||
|
||||
## Sponsors
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" width="33.3%">
|
||||
<a href="https://blacksmith.sh/">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith-light.svg">
|
||||
<img src="https://raw.githubusercontent.com/agentgateway/agentgateway/main/img/blacksmith.svg" alt="Blacksmith" height="48">
|
||||
</picture>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Thank you to our sponsors for helping to fund the development of agentgateway!
|
||||
|
||||
## Contributing
|
||||
|
||||
For instructions on how to contribute to the agentgateway project, see the [CONTRIBUTION.md](CONTRIBUTION.md) file.
|
||||
@ -108,7 +80,7 @@ Recordings of the community meetings will be published on our [google drive](htt
|
||||
|
||||
## Roadmap
|
||||
|
||||
`agentgateway` is currently in active development. If you'd like a feature that's missing, open an issue in our [GitHub repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
`agentgateway` is currently in active development. If you want a feature missing, open an issue in our [Github repo](https://github.com/agentgateway/agentgateway/issues).
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
1771
api/resource.pb.go
1771
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)
|
||||
@ -831,17 +809,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)
|
||||
|
||||
@ -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) \
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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: "[]",
|
||||
|
||||
@ -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
|
||||
@ -434,28 +386,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) {
|
||||
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,14 +331,14 @@ type MCPBackend struct {
|
||||
// +required
|
||||
Targets []McpTargetSelector `json:"targets"`
|
||||
|
||||
// `sessionRouting` configures MCP session behavior for requests.
|
||||
// Defaults to `Stateful` if not set.
|
||||
// SessionRouting configures MCP session behavior for requests.
|
||||
// Defaults to Stateful if not set.
|
||||
// +optional
|
||||
SessionRouting SessionRouting `json:"sessionRouting,omitempty"`
|
||||
|
||||
// `failureMode` controls behavior when MCP targets fail to initialize or
|
||||
// become unavailable at runtime. `FailOpen` skips failed targets and
|
||||
// continues serving from healthy ones. `FailClosed` (default) fails the
|
||||
// FailureMode controls behavior when MCP targets fail to initialize or
|
||||
// become unavailable at runtime. "FailOpen" skips failed targets and
|
||||
// continues serving from healthy ones. "FailClosed" (default) fails the
|
||||
// entire session if any target fails.
|
||||
// +optional
|
||||
FailureMode FailureMode `json:"failureMode,omitempty"`
|
||||
@ -375,26 +357,23 @@ 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 +384,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,16 +129,16 @@ type AgentgatewayParametersConfigs struct {
|
||||
|
||||
// The container environment variables. These override any existing
|
||||
// values. If you want to delete an environment variable entirely, use
|
||||
// `$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
|
||||
// `$patch: delete` with AgentgatewayParametersOverlays instead. Note that
|
||||
// [variable
|
||||
// expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
|
||||
// does apply, but is highly discouraged -- to set dependent environment
|
||||
// variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
|
||||
// `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
// variables, you can use $(VAR_NAME), but it's highly
|
||||
// discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
// `$(VAR_NAME)`.
|
||||
//
|
||||
// If `SESSION_KEY` is specified, it takes precedence over the
|
||||
// controller-managed per-`Gateway` session key `Secret`.
|
||||
// controller-managed per-Gateway session key Secret.
|
||||
//
|
||||
// +optional
|
||||
Env []corev1.EnvVar `json:"env,omitempty"`
|
||||
@ -150,11 +150,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 +178,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 +187,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 +197,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"`
|
||||
}
|
||||
|
||||
@ -1218,6 +1218,27 @@ func (in *BackendWithAI) DeepCopy() *BackendWithAI {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackendWithMCP) DeepCopyInto(out *BackendWithMCP) {
|
||||
*out = *in
|
||||
in.BackendSimple.DeepCopyInto(&out.BackendSimple)
|
||||
if in.MCP != nil {
|
||||
in, out := &in.MCP, &out.MCP
|
||||
*out = new(BackendMCP)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendWithMCP.
|
||||
func (in *BackendWithMCP) DeepCopy() *BackendWithMCP {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BackendWithMCP)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BasicAuthentication) DeepCopyInto(out *BasicAuthentication) {
|
||||
*out = *in
|
||||
@ -1484,11 +1505,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)
|
||||
@ -1878,11 +1894,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 +1906,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 +2142,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 +2154,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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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!"
|
||||
|
||||
@ -153,7 +153,7 @@ 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 {
|
||||
|
||||
@ -3,7 +3,7 @@ package v1
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
|
||||
embedded "github.com/agentgateway/agentgateway/controller/hack/crdgen/testdata/ifthenembedded/embedded"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@ -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.26.0|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.20260308004542-b60714bc2ea3|Apache License 2.0
|
||||
[ghodss/yaml](https://github.com/ghodss/yaml)|v1.0.1-0.20190212211648-25d852aebe32|MIT License
|
||||
[go-jose/v4](https://github.com/go-jose/go-jose)|v4.1.3|Apache License 2.0
|
||||
[go-logr/logr](https://github.com/go-logr/logr)|v1.4.3|Apache License 2.0
|
||||
@ -15,10 +15,10 @@ Name|Version|License
|
||||
[grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)|v1.4.0|Apache License 2.0
|
||||
[kagent-dev/mockllm](https://github.com/kagent-dev/mockllm)|v0.0.5|Apache License 2.0
|
||||
[kelseyhightower/envconfig](https://github.com/kelseyhightower/envconfig)|v1.4.0|MIT License
|
||||
[modelcontextprotocol/go-sdk](https://github.com/modelcontextprotocol/go-sdk)|v1.4.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.24.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.51.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/sync](https://golang.org/x/sync)|v0.19.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/time](https://golang.org/x/time)|v0.14.0|BSD 3-clause "New" or "Revised" License
|
||||
[x/tools](https://golang.org/x/tools)|v0.42.0|BSD 3-clause "New" or "Revised" License
|
||||
[googleapis/rpc](https://google.golang.org/genproto/googleapis/rpc)|v0.0.0-20260226221140-a57be14db171|Apache License 2.0
|
||||
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.79.1|Apache License 2.0
|
||||
[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.20260310163805-1e4fee88597d|Apache License 2.0
|
||||
[istio.io/client-go](https://istio.io/client-go)|v1.29.0-alpha.0.0.20260310170739-44d7c6ab3a5b|Apache License 2.0
|
||||
[istio.io/istio](https://istio.io/istio)|v0.0.0-20260311173339-67ad6fb5ba6a|Apache License 2.0
|
||||
[k8s.io/api](https://k8s.io/api)|v0.35.2|Apache License 2.0
|
||||
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.35.2|Apache License 2.0
|
||||
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.35.2|Apache License 2.0
|
||||
[k8s.io/client-go](https://k8s.io/client-go)|v0.35.2|Apache License 2.0
|
||||
[klog/v2](https://k8s.io/klog/v2)|v2.130.1|Apache License 2.0
|
||||
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20260210185600-b8788abfbbc2|Apache License 2.0
|
||||
[sigs.k8s.io/controller-runtime](https://sigs.k8s.io/controller-runtime)|v0.23.1|Apache License 2.0
|
||||
[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)|v1.4.0-rc.2|Apache License 2.0
|
||||
[gateway-api-inference-extension/conformance](https://sigs.k8s.io/gateway-api-inference-extension/conformance)|v0.0.0-20260310170806-b32dfd041324|Apache License 2.0
|
||||
[gateway-api/conformance](https://sigs.k8s.io/gateway-api/conformance)|v1.5.1-0.20260302214453-c33c5449a202|Apache License 2.0
|
||||
[sigs.k8s.io/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,16 @@ spec:
|
||||
description: |-
|
||||
The container environment variables. These override any existing
|
||||
values. If you want to delete an environment variable entirely, use
|
||||
`$patch: delete` with `AgentgatewayParametersOverlays` instead. Note that
|
||||
`$patch: delete` with AgentgatewayParametersOverlays instead. Note that
|
||||
[variable
|
||||
expansion](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/)
|
||||
does apply, but is highly discouraged -- to set dependent environment
|
||||
variables, you can use `$(VAR_NAME)`, but it's highly discouraged.
|
||||
`$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
variables, you can use $(VAR_NAME), but it's highly
|
||||
discouraged. `$$(VAR_NAME)` avoids expansion and results in a literal
|
||||
`$(VAR_NAME)`.
|
||||
|
||||
If `SESSION_KEY` is specified, it takes precedence over the
|
||||
controller-managed per-`Gateway` session key `Secret`.
|
||||
controller-managed per-Gateway session key Secret.
|
||||
items:
|
||||
description: EnvVar represents an environment variable present in
|
||||
a Container.
|
||||
@ -311,18 +309,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 +341,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 +432,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 +443,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 +482,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 +612,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 +642,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 +725,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 +796,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.NewAgentgatewayValidator(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
|
||||
|
||||
@ -12,13 +12,12 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
legacyA2aProtocol = "kgateway.dev/a2a"
|
||||
a2aProtocol = "agentgateway.dev/a2a"
|
||||
a2aProtocol = "kgateway.dev/a2a"
|
||||
)
|
||||
|
||||
// NewA2APlugin creates a new A2A policy plugin
|
||||
@ -49,8 +48,7 @@ func translatePoliciesForService(krtctx krt.HandlerContext, svc *corev1.Service,
|
||||
}).UnsortedList()
|
||||
|
||||
for _, port := range svc.Spec.Ports {
|
||||
// support legacy kgateway.dev/a2a and agentgateway.dev/a2a
|
||||
if port.AppProtocol != nil && (*port.AppProtocol == a2aProtocol || *port.AppProtocol == legacyA2aProtocol) {
|
||||
if port.AppProtocol != nil && *port.AppProtocol == a2aProtocol {
|
||||
logger.Debug("found A2A service", "service", svc.Name, "namespace", svc.Namespace, "port", port.Port)
|
||||
hostname := fmt.Sprintf("%s.%s.svc.%s", svc.Name, svc.Namespace, clusterDomain)
|
||||
policy := &api.Policy{
|
||||
|
||||
@ -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,8 +19,9 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/api/v1alpha1/shared"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/jwks_url"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/translator/sslutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -49,7 +49,7 @@ func TranslateInlineBackendPolicy(
|
||||
},
|
||||
Spec: agentgateway.AgentgatewayPolicySpec{Backend: policy},
|
||||
}
|
||||
res, err := translateBackendPolicyToAgw(ctx, dummy)
|
||||
res, err := translateBackendPolicyToAgw(ctx, dummy, nil)
|
||||
return slices.MapFilter(res, func(e *api.Policy) **api.BackendPolicySpec {
|
||||
return ptr.Of(e.GetBackend())
|
||||
}), err
|
||||
@ -58,6 +58,7 @@ func TranslateInlineBackendPolicy(
|
||||
func translateBackendPolicyToAgw(
|
||||
ctx PolicyCtx,
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
policyTarget *api.PolicyTarget,
|
||||
) ([]*api.Policy, error) {
|
||||
backend := policy.Spec.Backend
|
||||
if backend == nil {
|
||||
@ -67,65 +68,113 @@ func translateBackendPolicyToAgw(
|
||||
var errs []error
|
||||
|
||||
policyName := getBackendPolicyName(policy.Namespace, policy.Name)
|
||||
appendPolicy := func(kind string) func(*api.Policy, error) {
|
||||
return func(p *api.Policy, err error) {
|
||||
if err != nil {
|
||||
name := fmt.Sprintf("%s %s", kind, policyName)
|
||||
logger.Error("error processing policy", "policy", name, "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if p != nil {
|
||||
agwPolicies = append(agwPolicies, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if s := backend.HTTP; s != nil {
|
||||
appendPolicy("backendHTTP")(translateBackendHTTP(policy), nil)
|
||||
pol := translateBackendHTTP(policy, policyTarget)
|
||||
agwPolicies = append(agwPolicies, pol)
|
||||
}
|
||||
|
||||
if s := backend.Tunnel; s != nil {
|
||||
appendPolicy("backendTunnel")(translateBackendTunnel(ctx, policy))
|
||||
pol, err := translateBackendTunnel(ctx, policy, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing backend tunnel", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if pol != nil {
|
||||
agwPolicies = append(agwPolicies, pol)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
agwPolicies = append(agwPolicies, pol)
|
||||
}
|
||||
}
|
||||
|
||||
if s := backend.MCP; s != nil {
|
||||
if backend.MCP.Authorization != nil {
|
||||
appendPolicy("backendMCPAuthorization")(translateBackendMCPAuthorization(policy))
|
||||
pol := translateBackendMCPAuthorization(policy, policyTarget)
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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) (*api.Policy, error) {
|
||||
var errs []error
|
||||
|
||||
healthPolicy := policy.Spec.Backend.Health
|
||||
@ -159,9 +208,7 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api
|
||||
|
||||
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))
|
||||
})
|
||||
unhealthyCondition = string(*healthPolicy.UnhealthyCondition)
|
||||
}
|
||||
|
||||
p := &api.BackendPolicySpec_Health{
|
||||
@ -169,8 +216,9 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api
|
||||
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_{
|
||||
@ -183,13 +231,14 @@ func translateBackendHealthPolicy(policy *agentgateway.AgentgatewayPolicy) (*api
|
||||
return 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) (*api.Policy, error) {
|
||||
// TODO
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func translateBackendTransformation(
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
target *api.PolicyTarget,
|
||||
) (*api.Policy, error) {
|
||||
var errs []error
|
||||
transformation := policy.Spec.Backend.Transformation
|
||||
@ -204,8 +253,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{
|
||||
@ -223,7 +273,7 @@ func translateBackendTransformation(
|
||||
return tp, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
|
||||
var errs []error
|
||||
tls := policy.Spec.Backend.TLS
|
||||
|
||||
@ -240,7 +290,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 +312,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 +322,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 +347,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{
|
||||
@ -314,7 +366,7 @@ func translateBackendTLS(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy)
|
||||
return tlsPolicy, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
|
||||
func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) *api.Policy {
|
||||
http := policy.Spec.Backend.HTTP
|
||||
p := &api.BackendPolicySpec_BackendHTTP{}
|
||||
if v := http.Version; v != nil {
|
||||
@ -329,8 +381,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{
|
||||
@ -346,14 +399,18 @@ func translateBackendHTTP(policy *agentgateway.AgentgatewayPolicy) *api.Policy {
|
||||
return tp
|
||||
}
|
||||
|
||||
func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) (*api.Policy, error) {
|
||||
tunnel := policy.Spec.Backend.Tunnel
|
||||
|
||||
proxy, err := buildBackendRef(ctx, tunnel.BackendRef, policy.Namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tunnelPolicy := &api.Policy{
|
||||
Key: policy.Namespace + "/" + policy.Name + backendTunnelPolicySuffix,
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Key: policy.Namespace + "/" + policy.Name + backendTunnelPolicySuffix + attachmentName(target),
|
||||
Name: TypedResourceName(wellknown.AgentgatewayPolicyGVK.Kind, policy),
|
||||
Target: target,
|
||||
Kind: &api.Policy_Backend{
|
||||
Backend: &api.BackendPolicySpec{
|
||||
Kind: &api.BackendPolicySpec_BackendTunnel_{
|
||||
@ -369,38 +426,32 @@ func translateBackendTunnel(ctx PolicyCtx, policy *agentgateway.AgentgatewayPoli
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", tunnelPolicy.Name)
|
||||
|
||||
return tunnelPolicy, err
|
||||
return tunnelPolicy, nil
|
||||
}
|
||||
|
||||
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (*api.Policy, error) {
|
||||
func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy, target *api.PolicyTarget) *api.Policy {
|
||||
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 +462,27 @@ func translateBackendMCPAuthorization(policy *agentgateway.AgentgatewayPolicy) (
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", mcpPolicy.Name)
|
||||
|
||||
return mcpPolicy, errors.Join(errs...)
|
||||
return 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) (*api.Policy, error) {
|
||||
backend := policy.Spec.Backend
|
||||
if backend == nil || backend.MCP == nil || backend.MCP.Authentication == nil {
|
||||
return nil, nil
|
||||
}
|
||||
authnPolicy := backend.MCP.Authentication
|
||||
if authnPolicy == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
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 +494,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 +522,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 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) (*api.Policy, error) {
|
||||
var errs []error
|
||||
aiSpec := agwPolicy.Spec.Backend.AI
|
||||
|
||||
@ -622,9 +637,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 +648,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_{
|
||||
@ -654,12 +667,15 @@ func translateBackendAI(ctx PolicyCtx, agwPolicy *agentgateway.AgentgatewayPolic
|
||||
return 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) (*api.Policy, error) {
|
||||
var errs []error
|
||||
auth := policy.Spec.Backend.Auth
|
||||
|
||||
if auth == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var translatedAuth *api.BackendAuthPolicy
|
||||
var kindErrs []error
|
||||
|
||||
if auth.InlineKey != nil && *auth.InlineKey != "" {
|
||||
translatedAuth = &api.BackendAuthPolicy{
|
||||
@ -672,11 +688,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 +697,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 +717,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 +737,7 @@ func translateBackendAuth(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy
|
||||
"policy", policy.Name,
|
||||
"agentgateway_policy", authPolicy.Name)
|
||||
|
||||
return authPolicy, errors.Join(append(errs, kindErrs...)...)
|
||||
return authPolicy, errors.Join(errs...)
|
||||
}
|
||||
|
||||
// translateRouteType converts kgateway RouteType to agentgateway proto RouteType
|
||||
@ -762,39 +769,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 +835,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 +892,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{
|
||||
|
||||
@ -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
|
||||
@ -45,7 +45,7 @@ func NewBackendTLSPlugin(agw *AgwCollections) AgwPlugin {
|
||||
st, o := krt.NewStatusManyCollection(agw.BackendTLSPolicies, func(krtctx krt.HandlerContext, btls *gwv1.BackendTLSPolicy) (*gwv1.PolicyStatus, []AgwPolicy) {
|
||||
return translatePoliciesForBackendTLS(krtctx, agw.ControllerName, input.References, agw.ConfigMaps, agw.Secrets, agw.Services, backendTLSTarget, agw.Gateways, btls)
|
||||
}, agw.KrtOpts.ToOptions("agentgateway/BackendTLSPolicy")...)
|
||||
return ConvertStatusCollection(st), o
|
||||
return convertStatusCollection(st), o
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -130,14 +130,16 @@ func translatePoliciesForBackendTLS(
|
||||
}
|
||||
}
|
||||
|
||||
backendTLSPoliciesForThisTarget := krtutil.FetchIndexObjects(krtctx, targetIndex, tgtRef)
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
backendTLSPoliciesForThisTarget := krt.FetchOne(krtctx, targetIndex, krt.FilterKey(tgtRef.String()))
|
||||
if backendTLSPoliciesForThisTarget != nil {
|
||||
if err := checkConflicted(btls, target, backendTLSPoliciesForThisTarget); err != nil {
|
||||
conds[string(gwv1.PolicyConditionAccepted)].error = &ConfigError{
|
||||
Reason: string(gwv1.PolicyReasonConflicted),
|
||||
Message: err.Error(),
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
}
|
||||
// We cannot send this policy to agentgateway, as it would not know the priority logic.
|
||||
continue
|
||||
}
|
||||
|
||||
switch string(target.Kind) {
|
||||
@ -209,7 +211,7 @@ func translatePoliciesForBackendTLS(
|
||||
if scrt == nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
if _, err := ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
if _, err := sslutils.ValidateTlsSecretData(nn.Name, nn.Namespace, scrt.Data); err != nil {
|
||||
logger.Warn("ignoring Gateway.spec.tls.backend; secret not found")
|
||||
} else {
|
||||
res.Cert = scrt.Data[corev1.TLSCertKey]
|
||||
@ -252,9 +254,9 @@ func translatePoliciesForBackendTLS(
|
||||
func checkConflicted(
|
||||
btls *gwv1.BackendTLSPolicy,
|
||||
target gwv1.LocalPolicyTargetReferenceWithSectionName,
|
||||
allMatches []*gwv1.BackendTLSPolicy,
|
||||
allMatches *krt.IndexObject[utils.TypedNamespacedName, *gwv1.BackendTLSPolicy],
|
||||
) error {
|
||||
for _, m := range allMatches {
|
||||
for _, m := range allMatches.Objects {
|
||||
if m.UID == btls.UID {
|
||||
// This is ourself, skip it
|
||||
continue
|
||||
@ -351,7 +353,7 @@ func getBackendTLSCACert(
|
||||
}
|
||||
return nil, fmt.Errorf("certificate reference not found: %v", ref)
|
||||
}
|
||||
caCert, err := GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
caCert, err := sslutils.GetCACertFromConfigMap(ptr.Flatten(cfgmap))
|
||||
if err != nil {
|
||||
conds[string(gwv1.BackendTLSPolicyReasonResolvedRefs)].error = &ConfigError{
|
||||
Reason: string(gwv1.BackendTLSPolicyReasonInvalidCACertificateRef),
|
||||
|
||||
@ -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,6 +24,7 @@ const (
|
||||
func translateFrontendPolicyToAgw(
|
||||
policyCtx PolicyCtx,
|
||||
policy *agentgateway.AgentgatewayPolicy,
|
||||
policyTarget *api.PolicyTarget,
|
||||
) ([]*api.Policy, error) {
|
||||
frontend := policy.Spec.Frontend
|
||||
if frontend == nil {
|
||||
@ -34,61 +34,60 @@ func translateFrontendPolicyToAgw(
|
||||
var errs []error
|
||||
|
||||
policyName := getFrontendPolicyName(policy.Namespace, policy.Name)
|
||||
appendPolicy := func(kind string) func(*api.Policy, error) {
|
||||
return func(p *api.Policy, err error) {
|
||||
if err != nil {
|
||||
name := fmt.Sprintf("%s %s", kind, policyName)
|
||||
logger.Error("error processing policy", "policy", name, "error", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if p != nil {
|
||||
agwPolicies = append(agwPolicies, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if s := frontend.HTTP; s != nil {
|
||||
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, err := translateFrontendAccessLog(policyCtx, policy, policyName, policyTarget)
|
||||
if err != nil {
|
||||
logger.Error("error processing access log", "err", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
agwPolicies = append(agwPolicies, pol)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
if pol != nil {
|
||||
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) (*api.Policy, 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 +101,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,21 +110,17 @@ 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
|
||||
@ -139,12 +131,13 @@ func translateFrontendTracing(ctx PolicyCtx, policy *agentgateway.AgentgatewayPo
|
||||
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,41 +156,34 @@ 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 tracingPolicy, nil
|
||||
}
|
||||
|
||||
func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string) (*api.Policy, error) {
|
||||
func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) (*api.Policy, error) {
|
||||
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))
|
||||
return nil, fmt.Errorf("failed to translate access log OTLP backend ref: %v", err)
|
||||
}
|
||||
|
||||
var protocol api.FrontendPolicySpec_Logging_OtlpAccessLog_Protocol
|
||||
@ -212,7 +198,7 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
|
||||
|
||||
var path *string
|
||||
if otlp.Path != nil {
|
||||
path = ptr.Of(*otlp.Path)
|
||||
path = ptr.Of(string(*otlp.Path))
|
||||
}
|
||||
|
||||
spec.OtlpAccessLog = &api.FrontendPolicySpec_Logging_OtlpAccessLog{
|
||||
@ -223,8 +209,9 @@ func translateFrontendAccessLog(ctx PolicyCtx, policy *agentgateway.Agentgateway
|
||||
}
|
||||
|
||||
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 +223,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 loggingPolicy, nil
|
||||
}
|
||||
|
||||
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
func translateFrontendTCP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) *api.Policy {
|
||||
tcp := policy.Spec.Frontend.TCP
|
||||
spec := &api.FrontendPolicySpec_TCP{}
|
||||
if ka := tcp.KeepAlive; ka != nil {
|
||||
@ -258,8 +246,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 +260,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
|
||||
}
|
||||
|
||||
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) *api.Policy {
|
||||
tls := policy.Spec.Frontend.TLS
|
||||
spec := &api.FrontendPolicySpec_TLS{}
|
||||
if ka := tls.HandshakeTimeout; ka != nil {
|
||||
@ -380,8 +336,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 +350,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
|
||||
}
|
||||
|
||||
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string) *api.Policy {
|
||||
func translateFrontendHTTP(policy *agentgateway.AgentgatewayPolicy, name string, target *api.PolicyTarget) *api.Policy {
|
||||
http := policy.Spec.Frontend.HTTP
|
||||
spec := &api.FrontendPolicySpec_HTTP{}
|
||||
if v := http.MaxBufferSize; v != nil {
|
||||
@ -427,8 +385,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 +399,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
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@ import (
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -35,7 +35,7 @@ func NewInferencePlugin(agw *AgwCollections) AgwPlugin {
|
||||
status, policyCol := krt.NewStatusManyCollection(agw.InferencePools, func(krtctx krt.HandlerContext, infPool *inf.InferencePool) (*inf.InferencePoolStatus, []AgwPolicy) {
|
||||
return translatePoliciesForInferencePool(krtctx, agw.ControllerName, input.References, agw.Services, infPool)
|
||||
}, agw.KrtOpts.ToOptions("agentgateway/InferencePools")...)
|
||||
return ConvertStatusCollection(status), policyCol
|
||||
return convertStatusCollection(status), policyCol
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -136,9 +136,9 @@ func validateInferencePoolEndpointPickerRef(krtctx krt.HandlerContext, pool *inf
|
||||
kind := epr.Kind
|
||||
if kind == "" {
|
||||
// InferencePool defaults this field to Service.
|
||||
kind = wellknown.ServiceKind
|
||||
kind = inf.Kind(wellknown.ServiceKind)
|
||||
}
|
||||
if kind != wellknown.ServiceKind {
|
||||
if kind != inf.Kind(wellknown.ServiceKind) {
|
||||
errs = append(errs, fmt.Sprintf("endpointPickerRef.kind must be %q, got %q", wellknown.ServiceKind, kind))
|
||||
}
|
||||
|
||||
@ -254,8 +254,8 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
return []inf.ParentReference{}
|
||||
}
|
||||
return []inf.ParentReference{{
|
||||
Kind: defaultInferencePoolStatusKind,
|
||||
Name: defaultInferencePoolStatusName,
|
||||
Kind: inf.Kind(defaultInferencePoolStatusKind),
|
||||
Name: inf.ObjectName(defaultInferencePoolStatusName),
|
||||
}}
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ func desiredInferencePoolParentRefs(attachedGateways map[types.NamespacedName]st
|
||||
for _, g := range gateways {
|
||||
refs = append(refs, inf.ParentReference{
|
||||
Group: ptr.Of(inf.Group(wellknown.GatewayGroup)),
|
||||
Kind: wellknown.GatewayKind,
|
||||
Kind: inf.Kind(wellknown.GatewayKind),
|
||||
Namespace: inf.Namespace(g.Namespace),
|
||||
Name: inf.ObjectName(g.Name),
|
||||
})
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
|
||||
"istio.io/istio/pilot/pkg/util/protoconv"
|
||||
@ -12,18 +13,16 @@ import (
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// AgwResourceStatusSyncHandler defines a function that handles status syncing for a specific resource type in AgentGateway
|
||||
type AgwResourceStatusSyncHandler func(ctx context.Context, client apiclient.Client, namespacedName types.NamespacedName, status any) error
|
||||
|
||||
type PolicyPluginInput struct {
|
||||
References ReferenceIndex
|
||||
}
|
||||
|
||||
type BackendPlugin struct {
|
||||
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[ir.AgwResource])
|
||||
BuildReferences func() krt.Collection[*PolicyAttachment]
|
||||
}
|
||||
|
||||
type PolicyPlugin struct {
|
||||
Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy])
|
||||
BuildReferences func(input PolicyPluginInput) krt.Collection[*PolicyAttachment]
|
||||
@ -55,10 +54,24 @@ func (p AgwPolicy) ResourceName() string {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@ -1,211 +1,14 @@
|
||||
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"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/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
|
||||
@ -233,12 +36,10 @@ func (r RouteAttachment) Equals(other RouteAttachment) bool {
|
||||
func BuildReferenceIndex(
|
||||
ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend],
|
||||
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment],
|
||||
referenceTypes ReferenceTypes,
|
||||
) ReferenceIndex {
|
||||
return ReferenceIndex{
|
||||
Ancestors: ancestors,
|
||||
attachments: attachments,
|
||||
explicitReferences: referenceTypes,
|
||||
Ancestors: ancestors,
|
||||
attachments: attachments,
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,8 +66,6 @@ type ReferenceIndex struct {
|
||||
attachments krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment]
|
||||
// Gateway --> Gateway: trivial, no collection needed
|
||||
// ListenerSet --> Gateway: NOT present; ListenerSet attachment not implemented (but really should be!) in AgentgatewayPolicy anyways
|
||||
|
||||
explicitReferences ReferenceTypes
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
|
||||
@ -276,13 +75,13 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
|
||||
return sets.New(object.NamespacedName)
|
||||
case wellknown.HTTPRouteGVK.Kind, wellknown.GRPCRouteGVK.Kind, wellknown.TCPRouteGVK.Kind, wellknown.TLSRouteGVK.Kind:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.attachments, object) {
|
||||
for _, ancestor := range krt.FetchOne(ctx, p.attachments, krt.FilterKey(object.String())).Objects {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
default:
|
||||
gateways := sets.New[types.NamespacedName]()
|
||||
for _, ancestor := range krtutil.FetchIndexObjects(ctx, p.Ancestors, object) {
|
||||
for _, ancestor := range krt.FetchOne(ctx, p.Ancestors, krt.FilterKey(object.String())).Objects {
|
||||
gateways.Insert(ancestor.Gateway)
|
||||
}
|
||||
return gateways
|
||||
@ -290,19 +89,21 @@ func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object u
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) LookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName] {
|
||||
return p.lookupGatewaysForBackend(ctx, object, sets.New[utils.TypedNamespacedName]())
|
||||
return p.lookupGatewaysForBackend(ctx, object, map[string]struct{}{})
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen sets.Set[utils.TypedNamespacedName]) sets.Set[types.NamespacedName] {
|
||||
if seen.InsertContains(object) {
|
||||
func (p ReferenceIndex) lookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName, seen map[string]struct{}) sets.Set[types.NamespacedName] {
|
||||
key := object.String()
|
||||
if _, ok := seen[key]; ok {
|
||||
return sets.New[types.NamespacedName]()
|
||||
}
|
||||
seen[key] = struct{}{}
|
||||
|
||||
base := p.LookupGatewaysForTarget(ctx, object)
|
||||
if p.PolicyAttachments == nil {
|
||||
return base
|
||||
}
|
||||
for _, pref := range krtutil.FetchIndexObjects(ctx, p.PolicyAttachments, object) {
|
||||
for _, pref := range krt.FetchOne(ctx, p.PolicyAttachments, krt.FilterKey(key)).Objects {
|
||||
base = base.Union(p.lookupGatewaysForBackend(ctx, pref.Target, seen))
|
||||
}
|
||||
return base
|
||||
@ -312,15 +113,3 @@ func (p ReferenceIndex) WithPolicyAttachments(references krt.IndexCollection[uti
|
||||
p.PolicyAttachments = references
|
||||
return p
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName) ([]*api.PolicyTarget, bool) {
|
||||
return p.explicitReferences.PolicyTargets(krtctx, namespace, name, gk, sectionName)
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) PolicyBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
return p.explicitReferences.PolicyBackend(krtctx, defaultNamespace, gk, name, namespace, port)
|
||||
}
|
||||
|
||||
func (p ReferenceIndex) RouteBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error) {
|
||||
return p.explicitReferences.RouteBackend(krtctx, defaultNamespace, gk, name, namespace, port)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
@ -51,9 +51,9 @@ status:
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: be
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
|
||||
@ -30,8 +30,8 @@ status:
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/mtls not found
|
||||
reason: PartiallyValid
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
|
||||
@ -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
|
||||
@ -30,8 +30,8 @@ status:
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: secret default/aws-auth-secret not found
|
||||
reason: PartiallyValid
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
|
||||
@ -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
|
||||
@ -267,9 +267,60 @@ status:
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
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
|
||||
|
||||
@ -46,24 +46,6 @@ 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
|
||||
@ -97,7 +79,7 @@ output:
|
||||
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
hostname: example.com
|
||||
key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzJ4UGkreEwrNU05ZTYKdUpiNEI5ZjlEczJ6MU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1Mgp1Z3ZPL3psTlZkMjN1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDCmZjalZna0g3R2Z4Zk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEYKRUljcWpSSDFXTU9GS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVQo3RHE3Y2YyUWZWd2Z6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qCm8zcHltTlRuQWdNQkFBRUNnZ0VBQnZ3cGZZWkxjQ3FPWTNFaE9VTE9KYnBtY05SVndoRk94NlFEbkI3NUhyV3oKUU9Kc2VvOE9KVXN1NWt1UFN1MlA4WWJCeXlqdVRoSTRNa0xvcDBxVEhXVGJYN3JTNU0yb2xYVWZBa0treXpZcQpaY09EL3JpaUZTSGVZTGQwNGpySmQ3N3RQc3hTbDVyZWRRNUFSSzRCRTRyL1hZR2lBaUhPeEJFdmgyYm9BMTE4Cm1pejZzMjhhSXVxekZoUUdpOEh5ejREOVJCUzJkRWFsazFWK2V1QVhocHFxZ29HRms4TFhrWGxtUlpzZVdYN0MKZEpyVjhQL0grTGZXb3JCM09KRGs3SWIrek9Cc0pLeklwM3NiRlVsajdraGcyd2xjYi9SZUQrUU5BR1VQR3h1YQpHVndqRFVBSmpwb1RmamhIdjdhYUwwaWtyVVB6a1J2TEFQdjBwc0syb1FLQmdRRE05V2tyZkFhZjh2ZVNxR2lzCk1aSkNtOWFVVkUwdGY4eWkxL3owaGxRYlJFb25Mc2xZM0NCWlFZMHZ1T1owWFc1U29PQ1BUamRKRW1lUjFHTFIKVS9BSUJwRmhnNW5VMVIxaEprUkkyOWtPaGFHVXFBREpSR1ErZWdhK0IrQldLNVhUa3hGVFdFRjBSRDhVWENkQQpXa2lzaFBrU1V0VjV2VjdqNy9ibitSR09hUUtCZ1FEa1NQSmlBMTFNODhBSENTdjRWaHJDb3NRdjZURnZyK0p2CnFJVmlmMHowcFBvT0ZDVE1OdUcxN1Zxa29WV0d6U0R6ejBMYUJHWllGRlk5M2E0cGtxZWNnS3kxZVN1eHJKdlEKUko4WTRKSXpKYXlDbzRhc0lURGJPV21LaGk1am92bHkxRDVmSlFKMjNyUVNsWlRSbHVOdWJpVWxTQkErTS9EcQptcFg4c3ZkK3p3S0JnSCszTlEvWnV5OFVjZDA3Zis0OC9ZendHdWhYRjdpUWVHM0k5V0ZTQ3pycWRPS3hydG5tCllXbjlCUU9Gem1VWWkxU0YxeWkxYnBIa0hCR3RMTjZQMVhUSzB2RFcxcGJmTGUySnNPZE54NVhiQTNMa3RZaTEKUzFuN0pCUnFTQXFxSWpTeTRncnpaZVlUV05OUkVVeHlkZks2OFpIUGVDTGlOQzBKTE93a01pSnhBb0dCQUkvMgpGS3lNdEp6ZnBueUpZeW96bXFLZHBKMFdNTy9lK2l3eUdSTzVkZDFkNExkYUtxNkIrYXNSNkxTamJWMGFKU3E3CnpNdlNOSHhkTHRuSzM1Y2wvZjlyQWY5YlQ1dTNYM2RpbnZaQVFOSnljcXpiMVFUZDFZS2FYUjFYYXcrNGFoanAKRWdCTVJaYVM4UG83VEdNMEJXN1JsU2xDbmNPc1c4U0hBZ2tmRDRidkFvR0FUdmxGT0JiNDJmb3hIMTZsQzVtbQpsZThYdWd0eE5zUGY1OTVUVWw4OFRVZVhnZXlFUlQwMDY4NGo4M0pxcjViTENoc016RlYraTUwUjVQWnZsYW1tCnVkdm04NEFmblN1MktHaVBoTFovZkU2K3NVT284NWIza3R6UkZreFBIQklkbEt6V3FWRDhhV0NjcmxGbjdXTVUKM3RlUllXL2NFRFExUFRnTGZBa2I3Rms9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
|
||||
root: ""
|
||||
root: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGekNDQWYrZ0F3SUJBZ0lVVVAramhQa3Jpa2RxVzg3bEhNRHBXM3dZMTN3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0d6RVpNQmNHQTFVRUF3d1FkR1Z6ZEM1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TlRBM01ESXhNak0wTWpSYQpGdzB5TmpBM01ESXhNak0wTWpSYU1Cc3hHVEFYQmdOVkJBTU1FSFJsYzNRdVpYaGhiWEJzWlM1amIyMHdnZ0VpCk1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzJ4UGkreEwrNU05ZTZ1SmI0QjlmOURzMnoKMU1xZXEyT21FYVBBd2cxQk9hUnBnOXBaNVg5amFqL0xHa0o4WDdCUjZEZk1PRXZ4RUJ1MnVndk8vemxOVmQyMwp1V2N4ZFNNalJCNTJtR1pETnljc1NDS1NKNzFFZWFXamhJNytJR2RKSjJyemF3Mk5ad2lDZmNqVmdrSDdHZnhmCk9ZYzdtbTE4d2lmOVl4VkppODdJRjhhQkpFNnU3YUtoblFUK1NnRDJ3OTErT1pORlZCZEZFSWNxalJIMVdNT0YKS2tDWThlanIwYWlCV2ltUVZrNDFpTGoxL0YvYlNxaGRhZE1sQlJjM1RvTEZYT1kzOUhsVTdEcTdjZjJRZlZ3Zgp6a1VWaUZ3cHp2UEVUWC9XVk85SWlWRXhEM2NwQzN6VWpEdWtqU0FkMjZRUzR4UDRtdm5qbzNweW1OVG5BZ01CCkFBR2pVekJSTUIwR0ExVWREZ1FXQkJTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQWZCZ05WSFNNRUdEQVcKZ0JTazNGbFdpSDkyMzZ5NWhoajdJdFQvZWZTc1ZqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01BMEdDU3FHU0liMwpEUUVCQ3dVQUE0SUJBUUIvajhlRDRUZlV1Q1BQQ3AzN1BkL1lpV1VGYTBwWldEMXJKY3dadG1aRlcyRTcvODZUCmwweUJFY2diS0lzWm1VVDJybkpHNHpjQ3VtQXhwelA1THVvTzlXdTVSVWdxRmJNK25HblEzOXc1M21WQzNDVjQKaGNaeFNOaXpNaWNTd21BMDFNNEhUZHY5UDd0ai83bTl0VGI4VlEvVHl3STNrZE1hak9QREkrR3RyRTc2bStwUApzb3pRb3R2Uk1SbW9uYTkrNDk2TEJGc1N0QmFQOE5pQXFaZnVsZU5qMGhEMW9BZEwzZWtRK0haMWIxQUJmYTZECkJ4SXJRQ1Z2eUM0SmwwekxtbkVEUElCdnNyb0NWaXZxNEMvTUtYYlhzbi9iRHJoTUhkNXlxRHYxL21tdkdSU24KMmI1dk5hMWFWdElxV0pHS3B1STJyS3pkN0xTSVF2K2t1RkYzCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
verifySubjectAltNames:
|
||||
- '*.example.com'
|
||||
- api.example.com
|
||||
|
||||
@ -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
|
||||
@ -143,33 +143,6 @@ output:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tracing:
|
||||
attributes:
|
||||
- name: http.useragent
|
||||
value: request.headers["user-agent"]
|
||||
clientSampling: "true"
|
||||
protocol: GRPC
|
||||
randomSampling: "true"
|
||||
remove:
|
||||
- response.code
|
||||
resources:
|
||||
- name: service.name
|
||||
value: agent-gateway
|
||||
key: frontend/default/agw:frontend-tracing:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
|
||||
@ -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
|
||||
@ -1,79 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: tracing-invalid-attribute
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
frontend:
|
||||
tracing:
|
||||
backendRef:
|
||||
name: otel-collector
|
||||
port: 4318
|
||||
attributes:
|
||||
add:
|
||||
- name: trace.id
|
||||
expression: foolen_{{request.id}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: otel-collector
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 4318
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
frontend:
|
||||
tracing:
|
||||
attributes:
|
||||
- name: trace.id
|
||||
value: foolen_{{request.id}}
|
||||
protocol: GRPC
|
||||
providerBackend:
|
||||
port: 4318
|
||||
service:
|
||||
hostname: otel-collector.default.svc.cluster.local
|
||||
namespace: default
|
||||
key: frontend/default/tracing-invalid-attribute:frontend-tracing:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: tracing-invalid-attribute
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: tracing-invalid-attribute
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'frontend tracing attribute "trace.id" is not a valid CEL expression:
|
||||
foolen_{{request.id}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,58 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: authorization-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
authorization:
|
||||
policy:
|
||||
matchExpressions:
|
||||
- foolen_{{request.path}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/authorization-invalid-cel:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: authorization-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
allow:
|
||||
- foolen_{{request.path}}
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: authorization-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'authorization matchExpression is not a valid CEL expression: foolen_{{request.path}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,59 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: authorization-require-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
authorization:
|
||||
action: Require
|
||||
policy:
|
||||
matchExpressions:
|
||||
- foolen_{{request.path}}
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/authorization-require-invalid-cel:rbac:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: authorization-require-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
authorization:
|
||||
require:
|
||||
- foolen_{{request.path}}
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: authorization-require-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'authorization matchExpression is not a valid CEL expression: foolen_{{request.path}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -38,8 +38,6 @@ output:
|
||||
transformation:
|
||||
request:
|
||||
set:
|
||||
- expression: foolen_{{header("content-length")}}
|
||||
name: x-invalid-header
|
||||
- expression: '''foolen_'' + request.headers[''content-length'']'
|
||||
name: x-valid-header
|
||||
status:
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: grpc-invalid-metadata
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
extAuth:
|
||||
backendRef:
|
||||
name: extauthz
|
||||
port: 1024
|
||||
grpc:
|
||||
requestMetadata:
|
||||
user: foolen_{{jwt.sub}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: extauthz
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 1024
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/grpc-invalid-metadata:extauth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: grpc-invalid-metadata
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
extAuthz:
|
||||
grpc:
|
||||
metadata:
|
||||
user: foolen_{{jwt.sub}}
|
||||
target:
|
||||
port: 1024
|
||||
service:
|
||||
hostname: extauthz.default.svc.cluster.local
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: grpc-invalid-metadata
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'extAuth grpc requestMetadata "user" is not a valid CEL expression:
|
||||
foolen_{{jwt.sub}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,74 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: http-invalid-path
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
extAuth:
|
||||
backendRef:
|
||||
name: extauthz
|
||||
port: 1024
|
||||
http:
|
||||
path: foolen_{{request.path}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: extauthz
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 1024
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/http-invalid-path:extauth:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: http-invalid-path
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
extAuthz:
|
||||
http:
|
||||
path: foolen_{{request.path}}
|
||||
target:
|
||||
port: 1024
|
||||
service:
|
||||
hostname: extauthz.default.svc.cluster.local
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: http-invalid-path
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'extAuth http path is not a valid CEL expression: foolen_{{request.path}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -13,7 +13,6 @@ spec:
|
||||
backendRef:
|
||||
name: extauthz
|
||||
port: 1024
|
||||
failureMode: FailOpen
|
||||
forwardBody:
|
||||
maxSize: 1024
|
||||
http:
|
||||
@ -57,7 +56,6 @@ output:
|
||||
namespace: default
|
||||
traffic:
|
||||
extAuthz:
|
||||
failureMode: ALLOW
|
||||
http:
|
||||
addRequestHeaders:
|
||||
x-custom-header: random()
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: global-rl-invalid-cel
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
rateLimit:
|
||||
global:
|
||||
backendRef:
|
||||
name: rl-svc
|
||||
port: 4444
|
||||
domain: api-gateway
|
||||
descriptors:
|
||||
- entries:
|
||||
- name: user-agent
|
||||
expression: foolen_{{request.headers["user-agent"]}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: rl-svc
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 4444
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/global-rl-invalid-cel:rl-global:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: global-rl-invalid-cel
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
remoteRateLimit:
|
||||
descriptors:
|
||||
- entries:
|
||||
- key: user-agent
|
||||
value: foolen_{{request.headers["user-agent"]}}
|
||||
domain: api-gateway
|
||||
target:
|
||||
port: 4444
|
||||
service:
|
||||
hostname: rl-svc.default.svc.cluster.local
|
||||
namespace: default
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: global-rl-invalid-cel
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: 'rate limit descriptor entry "user-agent" is not a valid CEL expression:
|
||||
foolen_{{request.headers["user-agent"]}}'
|
||||
reason: PartiallyValid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -14,7 +14,6 @@ spec:
|
||||
backendRef:
|
||||
name: rl-svc
|
||||
port: 4444
|
||||
failureMode: FailOpen
|
||||
domain: "api-gateway"
|
||||
descriptors:
|
||||
- entries:
|
||||
@ -53,7 +52,6 @@ output:
|
||||
- key: user-agent
|
||||
value: request.headers["user-agent"]
|
||||
domain: api-gateway
|
||||
failureMode: FAIL_OPEN
|
||||
target:
|
||||
port: 4444
|
||||
service:
|
||||
|
||||
@ -1,109 +0,0 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: listenerset-gw
|
||||
namespace: default
|
||||
spec:
|
||||
gatewayClassName: agentgateway
|
||||
allowedListeners:
|
||||
namespaces:
|
||||
from: All
|
||||
listeners:
|
||||
- name: http
|
||||
protocol: HTTP
|
||||
port: 8081
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: ListenerSet
|
||||
metadata:
|
||||
name: listenerset
|
||||
namespace: default
|
||||
spec:
|
||||
parentRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: listenerset-gw
|
||||
listeners:
|
||||
- name: http-9090
|
||||
protocol: HTTP
|
||||
port: 9090
|
||||
allowedRoutes:
|
||||
namespaces:
|
||||
from: All
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: listenerset-route
|
||||
namespace: default
|
||||
spec:
|
||||
parentRefs:
|
||||
- group: gateway.networking.k8s.io
|
||||
kind: ListenerSet
|
||||
name: listenerset
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: reviews
|
||||
port: 8080
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: listenerset-route-policy
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: HTTPRoute
|
||||
name: listenerset-route
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
timeouts:
|
||||
request: 5s
|
||||
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: listenerset-gw
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/listenerset-route-policy:timeout:default/listenerset-route
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: listenerset-route-policy
|
||||
namespace: default
|
||||
target:
|
||||
route:
|
||||
kind: HTTPRoute
|
||||
name: listenerset-route
|
||||
namespace: default
|
||||
traffic:
|
||||
timeout:
|
||||
request: 5s
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: listenerset-route-policy
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: listenerset-gw
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -1,109 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
jwtAuthentication:
|
||||
mode: Strict
|
||||
providers:
|
||||
- issuer: https://auth.example.com/
|
||||
audiences:
|
||||
- my-api
|
||||
jwks:
|
||||
inline: |
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"kty": "RSA",
|
||||
"e": "AQAB",
|
||||
"use": "sig",
|
||||
"kid": "test-key",
|
||||
"alg": "RS256",
|
||||
"n": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
mcp:
|
||||
provider: Auth0
|
||||
resourceMetadata:
|
||||
oauthScopesSupported:
|
||||
- read
|
||||
- write
|
||||
resourceDocumentation: https://docs.example.com/mcp
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/jwt-mcp:jwt:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
jwt:
|
||||
mcp:
|
||||
provider: AUTH0
|
||||
resourceMetadata:
|
||||
extra:
|
||||
oauthScopesSupported:
|
||||
- read
|
||||
- write
|
||||
resourceDocumentation: https://docs.example.com/mcp
|
||||
mode: STRICT
|
||||
providers:
|
||||
- audiences:
|
||||
- my-api
|
||||
inline: |
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"kty": "RSA",
|
||||
"e": "AQAB",
|
||||
"use": "sig",
|
||||
"kid": "test-key",
|
||||
"alg": "RS256",
|
||||
"n": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
issuer: https://auth.example.com/
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: jwt-mcp
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -267,9 +267,60 @@ status:
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
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
|
||||
|
||||
@ -95,9 +95,9 @@ status:
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: be
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
|
||||
@ -1,116 +0,0 @@
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec:
|
||||
targetRefs:
|
||||
- kind: Gateway
|
||||
name: test
|
||||
group: gateway.networking.k8s.io
|
||||
- kind: Gateway
|
||||
name: not-test
|
||||
group: gateway.networking.k8s.io
|
||||
- kind: Gateway
|
||||
name: not-test2
|
||||
group: gateway.networking.k8s.io
|
||||
traffic:
|
||||
retry:
|
||||
attempts: 2
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: not-test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:retry:default/not-test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: not-test
|
||||
namespace: default
|
||||
traffic:
|
||||
retry:
|
||||
attempts: 2
|
||||
- gateway:
|
||||
Name: not-test2
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:retry:default/not-test2
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: not-test2
|
||||
namespace: default
|
||||
traffic:
|
||||
retry:
|
||||
attempts: 2
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:retry:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
retry:
|
||||
attempts: 2
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: agw
|
||||
namespace: default
|
||||
spec: null
|
||||
status:
|
||||
ancestors:
|
||||
- ancestorRef:
|
||||
group: agentgateway.dev
|
||||
name: StatusSummary
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: |-
|
||||
Policy is not attached: Gateway default/not-test not found
|
||||
Policy is not attached: Gateway default/not-test2 not found
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
- ancestorRef:
|
||||
group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: test
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
@ -13,24 +13,7 @@ spec:
|
||||
attempts: 2147483648
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:retry:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
retry:
|
||||
attempts: 255
|
||||
output: []
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
@ -47,13 +30,13 @@ status:
|
||||
namespace: default
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: Policy accepted
|
||||
reason: Valid
|
||||
message: failed to parse retry attempts should be positive int32 (2147483648)
|
||||
reason: Invalid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Attached to all targets
|
||||
reason: Attached
|
||||
status: "True"
|
||||
message: Policy is not attached due to invalid status
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
@ -13,23 +13,7 @@ spec:
|
||||
attempts: -4
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
- gateway:
|
||||
Name: test
|
||||
Namespace: default
|
||||
resource:
|
||||
policy:
|
||||
key: traffic/default/agw:retry:default/test
|
||||
name:
|
||||
kind: AgentgatewayPolicy
|
||||
name: agw
|
||||
namespace: default
|
||||
target:
|
||||
gateway:
|
||||
name: test
|
||||
namespace: default
|
||||
traffic:
|
||||
retry: {}
|
||||
output: []
|
||||
status:
|
||||
- apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
@ -47,7 +31,12 @@ status:
|
||||
conditions:
|
||||
- lastTransitionTime: fake
|
||||
message: failed to parse retry attempts should be positive int32 (-4)
|
||||
reason: PartiallyValid
|
||||
reason: Invalid
|
||||
status: "True"
|
||||
type: Accepted
|
||||
- lastTransitionTime: fake
|
||||
message: Policy is not attached due to invalid status
|
||||
reason: Pending
|
||||
status: "False"
|
||||
type: Attached
|
||||
controllerName: agentgateway.dev/agentgateway
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ import (
|
||||
"istio.io/istio/pkg/slices"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
)
|
||||
|
||||
var _ status.WorkerQueue = &TestStatusQueue{}
|
||||
|
||||
@ -29,12 +29,11 @@ import (
|
||||
agwv1alpha1 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/apiclient/fake"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/controller"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/schemes"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
func CompareGolden(t test.Failer, content []byte, goldenFile string) {
|
||||
@ -103,7 +102,8 @@ var timestampRegex = regexp.MustCompile(`lastTransitionTime:.*`)
|
||||
//
|
||||
// The output is generally created by running the test with `REFRESH_GOLDEN=true`.
|
||||
func RunForDirectory[Status any, Output any](t *testing.T, base string, run func(t *testing.T, ctx plugins.PolicyCtx) (Status, []Output)) {
|
||||
val := apitests.NewAgentgatewayValidatorSkipMissing(t)
|
||||
val := apitests.NewAgentgatewayValidator(t)
|
||||
val.SkipMissing = true
|
||||
defaults, defaultsErr := file.AsString(filepath.Join(base, "_defaults.yaml"))
|
||||
for _, f := range file.ReadDirOrFail(t, base) {
|
||||
name := filepath.Base(f)
|
||||
@ -150,7 +150,7 @@ type testOutput[Status any, Output any] struct {
|
||||
Output []Output `json:"output"`
|
||||
}
|
||||
|
||||
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *syncer.Syncer) {
|
||||
func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (*TestStatusQueue, *agentgatewaysyncer.Syncer) {
|
||||
fc := fake.NewClient(t)
|
||||
stop := test.NewStop(t)
|
||||
debugger := new(krt.DebugHandler)
|
||||
@ -161,7 +161,7 @@ func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (
|
||||
t.Log(string(b))
|
||||
}
|
||||
})
|
||||
syncer := syncer.NewAgwSyncer(
|
||||
syncer := agentgatewaysyncer.NewAgwSyncer(
|
||||
wellknown.DefaultAgwControllerName,
|
||||
// Only used for NACK, so no need to do anything special here.
|
||||
fc,
|
||||
@ -190,7 +190,7 @@ func Syncer(t *testing.T, ctx plugins.PolicyCtx, includeStatusKinds ...string) (
|
||||
// agwPluginFactory is a factory function that returns the agent gateway plugins
|
||||
// It is based on agwPluginFactory(cfg)(ctx, cfg.AgwCollections) in start.go
|
||||
func agwPluginFactory(agwCollections *plugins.AgwCollections) plugins.AgwPlugin {
|
||||
agwPlugins := controller.Plugins(agwCollections)
|
||||
agwPlugins := plugins.Plugins(agwCollections)
|
||||
mergedPlugins := plugins.MergePlugins(agwPlugins...)
|
||||
return mergedPlugins
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ func CreateAgwMirrorFilter(
|
||||
BackendObjectReference: filter.BackendRef,
|
||||
Weight: &weightOne,
|
||||
},
|
||||
}, ns, k)
|
||||
}, ns, k, ctx.Backends)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -258,7 +258,7 @@ func CreateAgwExternalAuthFilter(
|
||||
BackendObjectReference: filter.BackendRef,
|
||||
Weight: ptr.Of(int32(1)),
|
||||
},
|
||||
}, ns, k)
|
||||
}, ns, k, ctx.Backends)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -545,7 +545,7 @@ func buildAgwGRPCDestination(
|
||||
Group: "gateway.networking.k8s.io",
|
||||
Version: "v1",
|
||||
Kind: "GRPCRoute",
|
||||
})
|
||||
}, ctx.Backends)
|
||||
if err != nil {
|
||||
logger.Error("error building agent gateway destination", "error", err)
|
||||
if isInvalidBackend(err) {
|
||||
|
||||
@ -421,7 +421,8 @@ func renderAncestorYAML(t *testing.T, parent, target *ancestorRef, routeKind str
|
||||
}
|
||||
|
||||
func TestAncestors(t *testing.T) {
|
||||
validator := apitests.NewAgentgatewayValidatorSkipMissing(t)
|
||||
validator := apitests.NewAgentgatewayValidator(t)
|
||||
validator.SkipMissing = true
|
||||
parents := []ancestorRef{{
|
||||
Kind: ancestorListenerSetKind,
|
||||
Name: "listenerset",
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
)
|
||||
|
||||
// ParentErrorReason is the error string for a ParentError (reason parent could not be referenced)
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
package translator
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
@ -32,20 +31,21 @@ import (
|
||||
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/api"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
v1alpha2 "github.com/agentgateway/agentgateway/controller/api/v1alpha1/agentgateway"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// ConvertHTTPRouteToAgw converts a HTTPRouteRule to an agentgateway HTTPRoute
|
||||
func ConvertHTTPRouteToAgw(ctx RouteContext, r gwv1.HTTPRouteRule,
|
||||
obj *gwv1.HTTPRoute, pos int,
|
||||
) (*api.Route, *reporter.RouteCondition) {
|
||||
routeRuleKey := strconv.Itoa(pos)
|
||||
res := &api.Route{
|
||||
// unique for route rule
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, pos),
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, routeRuleKey),
|
||||
Name: utils.RouteName(wellknown.HTTPRouteKind, obj.Namespace, obj.Name, r.Name),
|
||||
// filled in later
|
||||
ListenerKey: "",
|
||||
@ -154,9 +154,10 @@ func isPolicyErrorCritical(filterError *reporter.RouteCondition) bool {
|
||||
func ConvertTCPRouteToAgw(ctx RouteContext, r gwv1a2.TCPRouteRule,
|
||||
obj *gwv1a2.TCPRoute, pos int,
|
||||
) (*api.TCPRoute, *reporter.RouteCondition) {
|
||||
routeRuleKey := strconv.Itoa(pos)
|
||||
res := &api.TCPRoute{
|
||||
// unique for route rule
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, pos),
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, routeRuleKey),
|
||||
Name: utils.RouteName(wellknown.TCPRouteKind, obj.Namespace, obj.Name, r.Name),
|
||||
ListenerKey: "",
|
||||
}
|
||||
@ -176,10 +177,11 @@ func ConvertTCPRouteToAgw(ctx RouteContext, r gwv1a2.TCPRouteRule,
|
||||
func ConvertGRPCRouteToAgw(ctx RouteContext, r gwv1.GRPCRouteRule,
|
||||
obj *gwv1.GRPCRoute, pos int,
|
||||
) (*api.Route, *reporter.RouteCondition) {
|
||||
routeRuleKey := strconv.Itoa(pos)
|
||||
res := &api.Route{
|
||||
// unique for route rule
|
||||
// Add .grpc suffix to distinguish from HTTP
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, pos) + ".grpc",
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, routeRuleKey) + ".grpc",
|
||||
Name: utils.RouteName(wellknown.GRPCRouteKind, obj.Namespace, obj.Name, r.Name),
|
||||
ListenerKey: "",
|
||||
}
|
||||
@ -244,9 +246,10 @@ func ConvertGRPCRouteToAgw(ctx RouteContext, r gwv1.GRPCRouteRule,
|
||||
func ConvertTLSRouteToAgw(ctx RouteContext, r gwv1.TLSRouteRule,
|
||||
obj *gwv1.TLSRoute, pos int,
|
||||
) (*api.TCPRoute, *reporter.RouteCondition) {
|
||||
routeRuleKey := strconv.Itoa(pos)
|
||||
res := &api.TCPRoute{
|
||||
// unique for route rule
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, pos) + ".tls",
|
||||
Key: utils.InternalRouteRuleKey(obj.Namespace, obj.Name, routeRuleKey),
|
||||
Name: utils.RouteName(wellknown.TLSRouteKind, obj.Namespace, obj.Name, r.Name),
|
||||
ListenerKey: "",
|
||||
}
|
||||
@ -282,7 +285,7 @@ func buildAgwTCPDestination(
|
||||
dst, err := buildAgwDestination(ctx, gwv1.HTTPBackendRef{
|
||||
BackendRef: fwd,
|
||||
Filters: nil, // TCP Routes don't have per-backend filters?
|
||||
}, ns, wellknown.TCPRouteGVK)
|
||||
}, ns, wellknown.TCPRouteGVK, ctx.Backends)
|
||||
if err != nil {
|
||||
logger.Error("error building agent gateway destination", "error", err)
|
||||
if isInvalidBackend(err) {
|
||||
@ -312,7 +315,7 @@ func buildAgwTLSDestination(
|
||||
dst, err := buildAgwDestination(ctx, gwv1.HTTPBackendRef{
|
||||
BackendRef: fwd,
|
||||
Filters: nil, // TLS Routes don't have per-backend filters
|
||||
}, ns, wellknown.TLSRouteGVK)
|
||||
}, ns, wellknown.TLSRouteGVK, ctx.Backends)
|
||||
if err != nil {
|
||||
logger.Error("error building agent gateway destination", "error", err)
|
||||
if isInvalidBackend(err) {
|
||||
@ -576,7 +579,7 @@ func buildAgwHTTPDestination(
|
||||
var invalidBackendErr *reporter.RouteCondition
|
||||
var res []*api.RouteBackend
|
||||
for _, fwd := range forwardTo {
|
||||
dst, err := buildAgwDestination(ctx, fwd, ns, wellknown.HTTPRouteGVK)
|
||||
dst, err := buildAgwDestination(ctx, fwd, ns, wellknown.HTTPRouteGVK, ctx.Backends)
|
||||
if err != nil {
|
||||
logger.Error("erroring building agent gateway destination", "error", err)
|
||||
if isInvalidBackend(err) {
|
||||
@ -603,19 +606,13 @@ func buildAgwDestination(
|
||||
to gwv1.HTTPBackendRef,
|
||||
ns string,
|
||||
k schema.GroupVersionKind,
|
||||
backendCol krt.Collection[*v1alpha2.AgentgatewayBackend],
|
||||
) (*api.RouteBackend, *reporter.RouteCondition) {
|
||||
weight := int32(1) // default
|
||||
if to.Weight != nil {
|
||||
weight = *to.Weight
|
||||
}
|
||||
rb := &api.RouteBackend{
|
||||
Weight: weight,
|
||||
}
|
||||
ref := NormalizeReference(to.Group, to.Kind, wellknown.ServiceGVK)
|
||||
// check if the reference is allowed
|
||||
if toNs := to.Namespace; toNs != nil && string(*toNs) != ns {
|
||||
if !ctx.Grants.BackendAllowed(ctx.Krt, k, to.Name, *toNs, ns, ref) {
|
||||
return rb, &reporter.RouteCondition{
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonRefNotPermitted,
|
||||
@ -623,44 +620,158 @@ func buildAgwDestination(
|
||||
}
|
||||
}
|
||||
}
|
||||
backendRef, err := ctx.References.RouteBackend(ctx.Krt, ns, ref.GroupKind(), to.Name, to.Namespace, to.Port)
|
||||
// Even in the error case, we still populate a partial backend
|
||||
rb.Backend = backendRef
|
||||
if err != nil {
|
||||
var backendErr *plugins.BackendReferenceError
|
||||
if errors.As(err, &backendErr) {
|
||||
switch backendErr.Reason {
|
||||
case plugins.BackendReferenceErrorReasonUnsupportedValue:
|
||||
return rb, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: backendErr.Message,
|
||||
}
|
||||
case plugins.BackendReferenceErrorReasonBackendNotFound:
|
||||
return rb, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonBackendNotFound,
|
||||
Message: backendErr.Message,
|
||||
}
|
||||
case plugins.BackendReferenceErrorReasonInvalidKind:
|
||||
return rb, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonInvalidKind,
|
||||
Message: backendErr.Message,
|
||||
}
|
||||
|
||||
namespace := ns // use default
|
||||
if to.Namespace != nil {
|
||||
namespace = string(*to.Namespace)
|
||||
}
|
||||
var invalidBackendErr *reporter.RouteCondition
|
||||
var hostname string
|
||||
weight := int32(1) // default
|
||||
if to.Weight != nil {
|
||||
weight = *to.Weight
|
||||
}
|
||||
rb := &api.RouteBackend{
|
||||
Weight: weight,
|
||||
}
|
||||
var port *gwv1.PortNumber
|
||||
|
||||
switch ref.GroupKind() {
|
||||
case wellknown.InferencePoolGVK.GroupKind():
|
||||
if strings.Contains(string(to.Name), ".") {
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: "service name invalid; the name of the Service must be used, not the hostname.",
|
||||
}
|
||||
}
|
||||
return rb, &reporter.RouteCondition{
|
||||
hostname = kubeutils.GetInferenceServiceHostname(string(to.Name), namespace)
|
||||
key := namespace + "/" + string(to.Name)
|
||||
svc := ptr.Flatten(krt.FetchOne(ctx.Krt, ctx.InferencePools, krt.FilterKey(key)))
|
||||
logger.Debug("found pull pool for service", "svc", svc, "key", key)
|
||||
if svc == nil {
|
||||
invalidBackendErr = &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("backendRef %s not found", key),
|
||||
}
|
||||
} else {
|
||||
rb.Backend = &api.BackendReference{
|
||||
Kind: &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: hostname,
|
||||
Namespace: namespace,
|
||||
},
|
||||
},
|
||||
// InferencePool only supports single port
|
||||
Port: uint32(svc.Spec.TargetPorts[0].Number), //nolint:gosec // G115: InferencePool TargetPort is int32 with validation 1-65535, always safe
|
||||
}
|
||||
}
|
||||
case wellknown.HostnameGVK.GroupKind():
|
||||
// Hostname is an Istio-specific backend kind where the name is the literal hostname
|
||||
// Used for referencing services by their full hostname (e.g., from ServiceEntry)
|
||||
// The actual resolution to ServiceEntry happens via the BackendIndex alias mechanism
|
||||
port = to.Port
|
||||
if port == nil {
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: "port is required in backendRef for Hostname kind",
|
||||
}
|
||||
}
|
||||
if to.Namespace != nil {
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: "namespace may not be set with Hostname type",
|
||||
}
|
||||
}
|
||||
// Use the name directly as the hostname
|
||||
hostname = string(to.Name)
|
||||
// Note: Backend validation happens via BackendIndex which uses the Hostname->ServiceEntry alias
|
||||
// No need to explicitly check ServiceEntries here as the BackendIndex handles the resolution
|
||||
rb.Backend = &api.BackendReference{
|
||||
Kind: &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: hostname,
|
||||
Namespace: namespace,
|
||||
},
|
||||
},
|
||||
Port: uint32(*port), //nolint:gosec // G115: Gateway API PortNumber is int32 with validation 1-65535, always safe
|
||||
}
|
||||
case wellknown.ServiceGVK.GroupKind():
|
||||
port = to.Port
|
||||
if strings.Contains(string(to.Name), ".") {
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: "service name invalid; the name of the Service must be used, not the hostname.",
|
||||
}
|
||||
}
|
||||
hostname = kubeutils.GetServiceHostname(string(to.Name), namespace)
|
||||
key := namespace + "/" + string(to.Name)
|
||||
svc := ptr.Flatten(krt.FetchOne(ctx.Krt, ctx.Services, krt.FilterKey(key)))
|
||||
if svc == nil {
|
||||
invalidBackendErr = &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("backend(%s) not found", hostname),
|
||||
}
|
||||
}
|
||||
// TODO: All kubernetes service types currently require a Port, so we do this for everything; consider making this per-type if we have future types
|
||||
// that do not require port.
|
||||
if port == nil {
|
||||
// "Port is required when the referent is a Kubernetes Service."
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionAccepted,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonUnsupportedValue,
|
||||
Message: "port is required in backendRef",
|
||||
}
|
||||
}
|
||||
rb.Backend = &api.BackendReference{
|
||||
Kind: &api.BackendReference_Service_{
|
||||
Service: &api.BackendReference_Service{
|
||||
Hostname: hostname,
|
||||
Namespace: namespace,
|
||||
},
|
||||
},
|
||||
Port: uint32(*port), //nolint:gosec // G115: Gateway API PortNumber is int32 with validation 1-65535, always safe
|
||||
}
|
||||
case wellknown.AgentgatewayBackendGVK.GroupKind():
|
||||
backendRefKey := ns + "/" + string(to.Name)
|
||||
fetchedKgwBackend := krt.FetchOne(ctx.Krt, backendCol, krt.FilterKey(backendRefKey))
|
||||
if fetchedKgwBackend == nil {
|
||||
logger.Error("failed to get kgateway Backend", "backend", backendRefKey)
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonBackendNotFound,
|
||||
Message: fmt.Sprintf("kgateway Backend not found: %s", backendRefKey),
|
||||
}
|
||||
}
|
||||
kgwBackend := *fetchedKgwBackend
|
||||
logger.Debug("successfully resolved kgateway Backend", "backend", kgwBackend.Name)
|
||||
rb.Backend = &api.BackendReference{
|
||||
Kind: &api.BackendReference_Backend{
|
||||
Backend: backendRefKey,
|
||||
},
|
||||
}
|
||||
default:
|
||||
return nil, &reporter.RouteCondition{
|
||||
Type: gwv1.RouteConditionResolvedRefs,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: gwv1.RouteReasonInvalidKind,
|
||||
Message: err.Error(),
|
||||
Message: fmt.Sprintf("referencing unsupported backendRef: group %q kind %q", ptr.OrEmpty(to.Group), ptr.OrEmpty(to.Kind)),
|
||||
}
|
||||
}
|
||||
return rb, nil
|
||||
return rb, invalidBackendErr
|
||||
}
|
||||
|
||||
var knownReferences = sets.New(
|
||||
@ -837,7 +948,7 @@ func ReferenceAllowed(
|
||||
return nil
|
||||
}
|
||||
|
||||
func extractParentReferenceInfo(ctx RouteContext, parents ParentResolver, obj controllers.Object) []RouteParentReference {
|
||||
func extractParentReferenceInfo(ctx RouteContext, parents RouteParents, obj controllers.Object) []RouteParentReference {
|
||||
routeRefs, hostnames, kind := GetCommonRouteInfo(obj)
|
||||
localNamespace := obj.GetNamespace()
|
||||
var parentRefs []RouteParentReference
|
||||
@ -852,7 +963,7 @@ func extractParentReferenceInfo(ctx RouteContext, parents ParentResolver, obj co
|
||||
Port: ptr.OrEmpty(ref.Port),
|
||||
}
|
||||
gk := ir
|
||||
currentParents := parents.ParentsFor(ctx.Krt, gk)
|
||||
currentParents := parents.Fetch(ctx.Krt, gk)
|
||||
appendParent := func(pr *ParentInfo, pk ParentReference) {
|
||||
bannedHostnames := sets.New[string]()
|
||||
for _, gw := range currentParents {
|
||||
@ -871,8 +982,7 @@ func extractParentReferenceInfo(ctx RouteContext, parents ParentResolver, obj co
|
||||
|
||||
rpi := RouteParentReference{
|
||||
ParentGateway: pr.ParentGateway,
|
||||
ListenerKey: pr.ListenerKey,
|
||||
ServiceKey: pr.ServiceKey,
|
||||
InternalName: pr.InternalName,
|
||||
InternalKind: ir.Kind,
|
||||
Hostname: pr.OriginalHostname,
|
||||
DeniedReason: deniedReason,
|
||||
@ -917,12 +1027,11 @@ func (p ParentReference) String() string {
|
||||
// ParentInfo holds info about a "Parent" - something that can be referenced as a ParentRef in the API.
|
||||
// Today, this is just Gateway
|
||||
type ParentInfo struct {
|
||||
ParentGateway types.NamespacedName
|
||||
ParentGateway types.NamespacedName
|
||||
// +krtEqualsTodo ensure gateway class changes trigger equality differences
|
||||
ParentGatewayClassName string
|
||||
// ListenerKey is the internal key of the listener resource created for this parent.
|
||||
ListenerKey string
|
||||
// ServiceKey (optionally) links a parent reference to an individual Service.
|
||||
ServiceKey *types.NamespacedName
|
||||
// InternalName refers to the internal name we can reference it by. For example "my-ns/my-gateway"
|
||||
InternalName string
|
||||
// AllowedKinds indicates which kinds can be admitted by this Parent
|
||||
AllowedKinds []gwv1.RouteGroupKind
|
||||
// Hostnames is the hostnames that must be match to reference to the Parent. For gateway this is listener hostname
|
||||
@ -941,10 +1050,8 @@ type ParentInfo struct {
|
||||
|
||||
// RouteParentReference holds information about a route's parent reference
|
||||
type RouteParentReference struct {
|
||||
// ListenerKey is the internal key of the listener resource created for this parent.
|
||||
ListenerKey string
|
||||
// ServiceKey (optionally) links a parent reference to an individual Service.
|
||||
ServiceKey *types.NamespacedName
|
||||
// InternalName refers to the internal name of the parent we can reference it by. For example "my-ns/my-gateway"
|
||||
InternalName string
|
||||
// InternalKind is the Kind of the Parent
|
||||
InternalKind string
|
||||
// DeniedReason, if present, indicates why the reference was not valid
|
||||
@ -971,15 +1078,10 @@ func FilteredReferences(parents []RouteParentReference) []RouteParentReference {
|
||||
ret = append(ret, p)
|
||||
}
|
||||
// To ensure deterministic order, sort them
|
||||
return slices.SortFunc(ret, func(a, b RouteParentReference) int {
|
||||
if r := cmp.Compare(a.ListenerKey, b.ListenerKey); r != 0 {
|
||||
return r
|
||||
}
|
||||
if r := cmp.Compare(a.ParentGateway.Namespace, b.ParentGateway.Namespace); r != 0 {
|
||||
return r
|
||||
}
|
||||
return cmp.Compare(a.ParentGateway.Name, b.ParentGateway.Name)
|
||||
sort.Slice(ret, func(i, j int) bool {
|
||||
return ret[i].InternalName < ret[j].InternalName
|
||||
})
|
||||
return ret
|
||||
}
|
||||
|
||||
// IsManaged checks if a Gateway is managed (ie we create the Deployment and Service) or unmanaged.
|
||||
|
||||
@ -22,12 +22,12 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/logging"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/utils/kubeutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -197,9 +197,7 @@ func (g GatewayListener) Equals(other GatewayListener) bool {
|
||||
|
||||
func (g ParentInfo) Equals(other ParentInfo) bool {
|
||||
return g.ParentGateway == other.ParentGateway &&
|
||||
g.ParentGatewayClassName == other.ParentGatewayClassName &&
|
||||
g.ListenerKey == other.ListenerKey &&
|
||||
ptr.Equal(g.ServiceKey, other.ServiceKey) &&
|
||||
g.InternalName == other.InternalName &&
|
||||
g.OriginalHostname == other.OriginalHostname &&
|
||||
g.SectionName == other.SectionName &&
|
||||
g.Port == other.Port &&
|
||||
@ -303,7 +301,7 @@ func GatewayTransformationFunc(cfg GatewayCollectionConfig) func(ctx krt.Handler
|
||||
pri := ParentInfo{
|
||||
ParentGateway: config.NamespacedName(obj),
|
||||
ParentGatewayClassName: string(obj.Spec.GatewayClassName),
|
||||
ListenerKey: name,
|
||||
InternalName: utils.InternalGatewayName(obj.Namespace, name, ""),
|
||||
AllowedKinds: allowed,
|
||||
Hostnames: hostnames,
|
||||
OriginalHostname: string(ptr.OrEmpty(l.Hostname)),
|
||||
@ -507,7 +505,7 @@ func ListenerSetBuilder(
|
||||
allowed, _ := GenerateSupportedKinds(standardListener)
|
||||
pri := ParentInfo{
|
||||
ParentGateway: config.NamespacedName(parentGwObj),
|
||||
ListenerKey: name,
|
||||
InternalName: obj.Namespace + "/" + name,
|
||||
AllowedKinds: allowed,
|
||||
Hostnames: hostnames,
|
||||
OriginalHostname: string(ptr.OrEmpty(l.Hostname)),
|
||||
@ -550,13 +548,6 @@ func reportNotAllowedListenerSet(status *gwv1.ListenerSetStatus, obj *gwv1.Liste
|
||||
status.Conditions = SetConditions(obj.Generation, status.Conditions, gatewayConditions)
|
||||
}
|
||||
|
||||
// ParentResolver allows expanding a parent reference into the information needed
|
||||
// to link a route to the gateway(s) it applies to.
|
||||
type ParentResolver interface {
|
||||
// Fetch returns the parents for a given parent key.
|
||||
ParentsFor(ctx krt.HandlerContext, pk utils.TypedNamespacedName) []*ParentInfo
|
||||
}
|
||||
|
||||
// RouteParents holds information about things Routes can reference as parents.
|
||||
type RouteParents struct {
|
||||
Gateways krt.Collection[*GatewayListener]
|
||||
@ -564,7 +555,7 @@ type RouteParents struct {
|
||||
}
|
||||
|
||||
// Fetch returns the parents for a given parent key.
|
||||
func (p RouteParents) ParentsFor(ctx krt.HandlerContext, pk utils.TypedNamespacedName) []*ParentInfo {
|
||||
func (p RouteParents) Fetch(ctx krt.HandlerContext, pk utils.TypedNamespacedName) []*ParentInfo {
|
||||
return slices.Map(krt.Fetch(ctx, p.Gateways, krt.FilterIndex(p.GatewayIndex, pk)), func(gw *GatewayListener) *ParentInfo {
|
||||
return &gw.ParentInfo
|
||||
})
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/testutils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer"
|
||||
)
|
||||
|
||||
func TestReferences(t *testing.T) {
|
||||
@ -66,7 +66,7 @@ func TestBackends(t *testing.T) {
|
||||
return a.ResourceName()
|
||||
})
|
||||
a := ri.Outputs.Addresses.List()
|
||||
a = slices.SortBy(a, func(a syncer.Address) string {
|
||||
a = slices.SortBy(a, func(a agentgatewaysyncer.Address) string {
|
||||
return a.ResourceName()
|
||||
})
|
||||
res := []any{}
|
||||
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// Reference stores a reference to a namespaced GVK, as used by ReferencePolicy
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"iter"
|
||||
"strings"
|
||||
|
||||
networkingclient "istio.io/client-go/pkg/apis/networking/v1"
|
||||
"istio.io/istio/pkg/config"
|
||||
@ -14,7 +15,6 @@ import (
|
||||
"istio.io/istio/pkg/slices"
|
||||
"istio.io/istio/pkg/util/protomarshal"
|
||||
"istio.io/istio/pkg/util/sets"
|
||||
"istio.io/istio/pkg/workloadapi"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -28,11 +28,11 @@ import (
|
||||
agwir "github.com/agentgateway/agentgateway/controller/pkg/agentgateway/ir"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/plugins"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/agentgateway/utils"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/agentgatewaysyncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/kgateway/wellknown"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/krtutil"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/pluginsdk/reporter"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/reports"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/syncer/status"
|
||||
"github.com/agentgateway/agentgateway/controller/pkg/wellknown"
|
||||
)
|
||||
|
||||
// AgwRouteCollection creates the collection of translated Routes
|
||||
@ -45,7 +45,7 @@ func AgwRouteCollection(
|
||||
inputs RouteContextInputs,
|
||||
krtopts krtutil.KrtOptions,
|
||||
) (krt.Collection[agwir.AgwResource], krt.Collection[*plugins.RouteAttachment], krt.Collection[*utils.AncestorBackend]) {
|
||||
httpRouteStatus, httpRoutes := createRouteCollectionGeneric(httpRouteCol, inputs, krtopts, "HTTPRoutes",
|
||||
httpRouteStatus, httpRoutes := createRouteCollection(httpRouteCol, inputs, krtopts, "HTTPRoutes",
|
||||
func(ctx RouteContext, obj *gwv1.HTTPRoute) (RouteContext, iter.Seq2[AgwRoute, *reporter.RouteCondition]) {
|
||||
route := obj.Spec
|
||||
return ctx, func(yield func(AgwRoute, *reporter.RouteCondition) bool) {
|
||||
@ -61,7 +61,7 @@ func AgwRouteCollection(
|
||||
})
|
||||
status.RegisterStatus(queue, httpRouteStatus, GetStatus)
|
||||
|
||||
grpcRouteStatus, grpcRoutes := createRouteCollectionGeneric(grpcRouteCol, inputs, krtopts, "GRPCRoutes",
|
||||
grpcRouteStatus, grpcRoutes := createRouteCollection(grpcRouteCol, inputs, krtopts, "GRPCRoutes",
|
||||
func(ctx RouteContext, obj *gwv1.GRPCRoute) (RouteContext, iter.Seq2[AgwRoute, *reporter.RouteCondition]) {
|
||||
route := obj.Spec
|
||||
return ctx, func(yield func(AgwRoute, *reporter.RouteCondition) bool) {
|
||||
@ -78,7 +78,7 @@ func AgwRouteCollection(
|
||||
})
|
||||
status.RegisterStatus(queue, grpcRouteStatus, GetStatus)
|
||||
|
||||
tcpRouteStatus, tcpRoutes := createRouteCollectionGeneric(tcpRouteCol, inputs, krtopts, "TCPRoutes",
|
||||
tcpRouteStatus, tcpRoutes := createTCPRouteCollection(tcpRouteCol, inputs, krtopts, "TCPRoutes",
|
||||
func(ctx RouteContext, obj *gwv1a2.TCPRoute) (RouteContext, iter.Seq2[AgwTCPRoute, *reporter.RouteCondition]) {
|
||||
route := obj.Spec
|
||||
return ctx, func(yield func(AgwTCPRoute, *reporter.RouteCondition) bool) {
|
||||
@ -95,7 +95,7 @@ func AgwRouteCollection(
|
||||
})
|
||||
status.RegisterStatus(queue, tcpRouteStatus, GetStatus)
|
||||
|
||||
tlsRouteStatus, tlsRoutes := createRouteCollectionGeneric(tlsRouteCol, inputs, krtopts, "TLSRoutes",
|
||||
tlsRouteStatus, tlsRoutes := createTCPRouteCollection(tlsRouteCol, inputs, krtopts, "TLSRoutes",
|
||||
func(ctx RouteContext, obj *gwv1.TLSRoute) (RouteContext, iter.Seq2[AgwTCPRoute, *reporter.RouteCondition]) {
|
||||
route := obj.Spec
|
||||
return ctx, func(yield func(AgwTCPRoute, *reporter.RouteCondition) bool) {
|
||||
@ -161,6 +161,7 @@ func ProcessParentReferences[T any](
|
||||
gwResult ConversionResult[T],
|
||||
routeNN types.NamespacedName, // <-- route namespace/name so we can detect cross-NS parents
|
||||
routeReporter reporter.RouteReporter,
|
||||
resourceMapper func(T, RouteParentReference) *api.Resource,
|
||||
) []agwir.AgwResource {
|
||||
resources := make([]agwir.AgwResource, 0, len(parentRefs))
|
||||
|
||||
@ -261,7 +262,7 @@ func ProcessParentReferences[T any](
|
||||
msg = "Parent listener not usable or not permitted"
|
||||
} else if parent.OriginalReference.SectionName != nil || parent.OriginalReference.Port != nil {
|
||||
// Use string literal to avoid compile issues if the constant name differs.
|
||||
reason = "NoMatchingParent"
|
||||
reason = gwv1.RouteConditionReason("NoMatchingParent")
|
||||
msg = "No listener with the specified sectionName on the parent Gateway"
|
||||
}
|
||||
pr.SetCondition(reporter.RouteCondition{
|
||||
@ -293,56 +294,6 @@ func ProcessParentReferences[T any](
|
||||
return resources
|
||||
}
|
||||
|
||||
func resourceMapper(t any, parent RouteParentReference) *api.Resource {
|
||||
var serviceKey *workloadapi.NamespacedHostname
|
||||
if parent.ServiceKey != nil {
|
||||
serviceKey = &workloadapi.NamespacedHostname{
|
||||
Namespace: parent.ServiceKey.Namespace,
|
||||
Hostname: parent.ServiceKey.Name,
|
||||
}
|
||||
}
|
||||
|
||||
switch tt := t.(type) {
|
||||
case AgwTCPRoute:
|
||||
// safety: a shallow clone is ok because we only modify a top level field (Key)
|
||||
inner := protomarshal.ShallowClone(tt.TCPRoute)
|
||||
inner.ListenerKey = parent.ListenerKey
|
||||
inner.ServiceKey = serviceKey
|
||||
inner.Key += routeKeySuffix(parent)
|
||||
if inner.ServiceKey != nil {
|
||||
// if linked by Service, no need for hostname matching
|
||||
inner.Hostnames = nil
|
||||
}
|
||||
|
||||
return ToAgwResource(AgwTCPRoute{TCPRoute: inner})
|
||||
case AgwRoute:
|
||||
// safety: a shallow clone is ok because we only modify a top level field (Key)
|
||||
inner := protomarshal.ShallowClone(tt.Route)
|
||||
inner.ListenerKey = parent.ListenerKey
|
||||
inner.ServiceKey = serviceKey
|
||||
inner.Key += routeKeySuffix(parent)
|
||||
if inner.ServiceKey != nil {
|
||||
// if linked by Service, no need for hostname matching
|
||||
inner.Hostnames = nil
|
||||
}
|
||||
|
||||
return ToAgwResource(AgwRoute{Route: inner})
|
||||
default:
|
||||
log.Fatalf("unknown route kind %T", t)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func routeKeySuffix(parent RouteParentReference) string {
|
||||
if parent.ServiceKey != nil {
|
||||
return ".svc." + parent.ServiceKey.Namespace + "." + parent.ServiceKey.Name
|
||||
}
|
||||
if sec := string(parent.ParentSection); sec != "" {
|
||||
return "." + sec
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// reasonResolvedRefs picks a ResolvedRefs reason from a conversion failure condition.
|
||||
// Falls back to "ResolvedRefs" (when ok) or "Invalid" (when not ok and no specific reason).
|
||||
func reasonResolvedRefs(cond *reporter.RouteCondition, ok bool) gwv1.RouteConditionReason {
|
||||
@ -352,7 +303,7 @@ func reasonResolvedRefs(cond *reporter.RouteCondition, ok bool) gwv1.RouteCondit
|
||||
if cond != nil && cond.Reason != "" {
|
||||
return cond.Reason
|
||||
}
|
||||
return "Invalid"
|
||||
return gwv1.RouteConditionReason("Invalid")
|
||||
}
|
||||
|
||||
// buildAttachedRoutesMapAllowed is the same as buildAttachedRoutesMap,
|
||||
@ -397,6 +348,7 @@ func createRouteCollectionGeneric[T controllers.Object, R comparable, ST any](
|
||||
krtopts krtutil.KrtOptions,
|
||||
collectionName string,
|
||||
translator func(ctx RouteContext, obj T) (RouteContext, iter.Seq2[R, *reporter.RouteCondition]),
|
||||
resourceTransformer func(route R, parent RouteParentReference) *api.Resource,
|
||||
buildStatus func(status gwv1.RouteStatus) ST,
|
||||
) (
|
||||
krt.StatusCollection[T, ST],
|
||||
@ -429,12 +381,80 @@ func createRouteCollectionGeneric[T controllers.Object, R comparable, ST any](
|
||||
gwResult,
|
||||
routeNN,
|
||||
routeReporter,
|
||||
resourceTransformer,
|
||||
)
|
||||
status := rm.BuildRouteStatusWithParentRefDefaulting(context.Background(), obj, inputs.ControllerName, true)
|
||||
return ptr.Of(buildStatus(*status)), resources
|
||||
}, krtopts.ToOptions(collectionName)...)
|
||||
}
|
||||
|
||||
// Simplified HTTP route collection function
|
||||
func createRouteCollection[T controllers.Object, ST any](
|
||||
routeCol krt.Collection[T],
|
||||
inputs RouteContextInputs,
|
||||
krtopts krtutil.KrtOptions,
|
||||
collectionName string,
|
||||
translator func(ctx RouteContext, obj T) (RouteContext, iter.Seq2[AgwRoute, *reporter.RouteCondition]),
|
||||
buildStatus func(status gwv1.RouteStatus) ST,
|
||||
) (
|
||||
krt.StatusCollection[T, ST],
|
||||
krt.Collection[agwir.AgwResource],
|
||||
) {
|
||||
return createRouteCollectionGeneric(
|
||||
routeCol,
|
||||
inputs,
|
||||
krtopts,
|
||||
collectionName,
|
||||
translator,
|
||||
func(e AgwRoute, parent RouteParentReference) *api.Resource {
|
||||
// safety: a shallow clone is ok because we only modify a top level field (Key)
|
||||
inner := protomarshal.ShallowClone(e.Route)
|
||||
_, name, _ := strings.Cut(parent.InternalName, "/")
|
||||
inner.ListenerKey = name
|
||||
if sec := string(parent.ParentSection); sec != "" {
|
||||
inner.Key = inner.GetKey() + "." + sec
|
||||
} else {
|
||||
inner.Key = inner.GetKey()
|
||||
}
|
||||
return ToAgwResource(AgwRoute{Route: inner})
|
||||
},
|
||||
buildStatus,
|
||||
)
|
||||
}
|
||||
|
||||
// Simplified TCP route collection function (plugins parameter removed)
|
||||
func createTCPRouteCollection[T controllers.Object, ST any](
|
||||
routeCol krt.Collection[T],
|
||||
inputs RouteContextInputs,
|
||||
krtopts krtutil.KrtOptions,
|
||||
collectionName string,
|
||||
translator func(ctx RouteContext, obj T) (RouteContext, iter.Seq2[AgwTCPRoute, *reporter.RouteCondition]),
|
||||
buildStatus func(status gwv1.RouteStatus) ST,
|
||||
) (
|
||||
krt.StatusCollection[T, ST],
|
||||
krt.Collection[agwir.AgwResource],
|
||||
) {
|
||||
return createRouteCollectionGeneric(
|
||||
routeCol,
|
||||
inputs,
|
||||
krtopts,
|
||||
collectionName,
|
||||
translator,
|
||||
func(e AgwTCPRoute, parent RouteParentReference) *api.Resource {
|
||||
inner := protomarshal.Clone(e.TCPRoute)
|
||||
_, name, _ := strings.Cut(parent.InternalName, "/")
|
||||
inner.ListenerKey = name
|
||||
if sec := string(parent.ParentSection); sec != "" {
|
||||
inner.Key = inner.GetKey() + "." + sec
|
||||
} else {
|
||||
inner.Key = inner.GetKey()
|
||||
}
|
||||
return ToAgwResource(AgwTCPRoute{TCPRoute: inner})
|
||||
},
|
||||
buildStatus,
|
||||
)
|
||||
}
|
||||
|
||||
// ListenersPerGateway returns the set of listener sectionNames referenced for each parent Gateway,
|
||||
// regardless of whether they are allowed.
|
||||
func ListenersPerGateway(parentRefs []RouteParentReference) map[types.NamespacedName]map[string]struct{} {
|
||||
@ -520,13 +540,12 @@ type RouteContext struct {
|
||||
// RouteContextInputs defines the collections needed to translate a route.
|
||||
type RouteContextInputs struct {
|
||||
Grants ReferenceGrants
|
||||
RouteParents ParentResolver
|
||||
RouteParents RouteParents
|
||||
Services krt.Collection[*corev1.Service]
|
||||
InferencePools krt.Collection[*inf.InferencePool]
|
||||
Namespaces krt.Collection[*corev1.Namespace]
|
||||
ServiceEntries krt.Collection[*networkingclient.ServiceEntry]
|
||||
Backends krt.Collection[*agentgateway.AgentgatewayBackend]
|
||||
References plugins.ReferenceTypes
|
||||
ControllerName string
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 9090
|
||||
targetPort: 9090
|
||||
appProtocol: agentgateway.dev/a2a
|
||||
appProtocol: kgateway.dev/a2a
|
||||
---
|
||||
# Output
|
||||
output:
|
||||
|
||||
@ -25,10 +25,7 @@ output:
|
||||
ai:
|
||||
providerGroups:
|
||||
- providers:
|
||||
- inlinePolicies:
|
||||
- auth:
|
||||
key: {}
|
||||
name: openai-secure
|
||||
- name: openai-secure
|
||||
openai:
|
||||
model: gpt-4o
|
||||
key: default/ai-priority-with-secret
|
||||
|
||||
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