Skip to content

Commit ee26893

Browse files
authored
Merge branch 'main' into response-api
Signed-off-by: Dan Sun <[email protected]>
2 parents b3ed0e3 + 2861c1b commit ee26893

File tree

182 files changed

+10642
-9039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+10642
-9039
lines changed

.envoy-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.36.2

.github/workflows/build_and_test.yaml

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ jobs:
6868
~/go/bin
6969
key: unittest-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}-${{ matrix.os }}
7070
- run: make test-coverage
71-
- if: failure()
72-
run: cat ollama.log || true
7371
- name: Upload coverage to Codecov
7472
if: matrix.os == 'ubuntu-latest'
7573
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
@@ -136,20 +134,13 @@ jobs:
136134
test_extproc:
137135
needs: changes
138136
if: ${{ needs.changes.outputs.code == 'true' }}
139-
name: External Processor Test (Envoy v${{ matrix.version }} on ${{ matrix.os }})
137+
name: External Processor Test (${{ matrix.os }})
140138
strategy:
141139
fail-fast: false
142140
matrix:
143-
# Note: we cannot run the latest Envoy version on macOS due to https://github.com/tetratelabs/archive-envoy/issues/12.
144-
# Once it's supported, the following "binary installation" steps below can be just removed and
145-
# we can simply exec.Cmd with "go tool -modfile=tools/go.mod func-e run" with the envoy version configured via ENVOY_VERSION env var.
146-
include:
147-
- version: 1.35.0 # NOTE: when updating this, also update the comment in the CONTRIBUTING.md file.
148-
os: ubuntu-latest
149-
- version: 1.35.0 # NOTE: when updating this, also update the comment in the CONTRIBUTING.md file.
150-
os: macos-latest
151-
- version: latest
152-
os: ubuntu-latest
141+
os:
142+
- ubuntu-latest
143+
- macos-latest
153144
runs-on: ${{ matrix.os }}
154145
steps:
155146
- uses: actions/checkout@v4
@@ -164,19 +155,6 @@ jobs:
164155
~/go/pkg/mod
165156
~/go/bin
166157
key: extproc-tests-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
167-
- name: Install stable Envoy via func-e
168-
if: matrix.version != 'latest'
169-
run: |
170-
go tool -modfile=tools/go.mod func-e use ${{ matrix.version }}
171-
echo $HOME/.func-e/versions/${{ matrix.version }}/bin >> $GITHUB_PATH
172-
- name: Install latest Envoy
173-
if: matrix.version == 'latest'
174-
run: |
175-
export ENVOY_BIN_DIR=$HOME/envoy/bin
176-
mkdir -p $ENVOY_BIN_DIR
177-
docker run -v $ENVOY_BIN_DIR:/tmp/ci -w /tmp/ci \
178-
--entrypoint /bin/cp envoyproxy/envoy-dev:latest /usr/local/bin/envoy .
179-
echo $ENVOY_BIN_DIR >> $GITHUB_PATH
180158
- env:
181159
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BEDROCK_USER_AWS_ACCESS_KEY_ID }}
182160
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_USER_AWS_SECRET_ACCESS_KEY }}
@@ -292,10 +270,6 @@ jobs:
292270
key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }}
293271
- uses: docker/setup-buildx-action@v3
294272
- run: make test-e2e-inference-extension
295-
env:
296-
# We only need to test with the latest stable version of EG, since these e2e tests
297-
# do not depend on the EG version.
298-
EG_VERSION: v1.5.0
299273

300274
test_e2e_namespaced:
301275
needs: changes
@@ -361,7 +335,7 @@ jobs:
361335
- name: Download Envoy via func-e
362336
run: go tool -modfile=tools/go.mod func-e run --version
363337
env:
364-
FUNC_E_HOME: /tmp/envoy-gateway # hard-coded directory in EG
338+
FUNC_E_DATA_HOME: ~/.local/share/aigw
365339
- name: Install Goose
366340
env:
367341
GOOSE_VERSION: v1.10.0

.github/workflows/retest.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ permissions:
99

1010
jobs:
1111
retest:
12-
if: |
13-
${{
14-
github.event.issue.pull_request
15-
&& github.repository == 'envoyproxy/ai-gateway'
16-
&& github.actor != 'repokitteh-read-only[bot]'
17-
&& github.actor != 'dependabot[bot]'
12+
if: ${{
13+
github.event.issue.pull_request
14+
&& github.repository == 'envoyproxy/ai-gateway'
15+
&& github.actor != 'repokitteh-read-only[bot]'
16+
&& github.actor != 'dependabot[bot]'
1817
}}
1918
name: Retest
2019
runs-on: ubuntu-22.04

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ inference-extension-conformance-test-report.yaml
4949
.mcp.json
5050

5151
.goose
52+
/aigw

CONTRIBUTING.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ For example,
4343

4444
- The latest `kubectl` binary for running `make test-e2e`.
4545
- See: https://kubernetes.io/docs/tasks/tools/
46-
- The latest `envoy` binary for running `make test-extproc`. The current required version is v1.35 or later.
47-
- On Linux, you can download the latest Envoy binary as described in https://www.envoyproxy.io/docs/envoy/latest/start/install.
48-
Alternatively, you can use `func-e` on Linux as well like on macOS below.
49-
- On macOS, since `brew envoy` tends to behind the latest version, it is recommended use `func-e` to run the latest Envoy. See https://func-e.io/.
50-
- `alias envoy='func-e run'` is a convenient way to run the latest Envoy binary via `func-e` on both macOS and Linux.
51-
For example, `func-e use 1.34` can be used to switch to a specific version of Envoy to be run with `func-e run`.
5246

5347
Other than that, everything will be automatically managed and installed via `make` targets,
5448
and you should not need to worry about the dependencies (tell us if you do).
@@ -106,3 +100,4 @@ make sure that these automated checks pass after you open a PR by following the
106100
as commit message by default. Maintainers may request contributors to
107101
edit the pull request title and description to ensure that it remains descriptive as a
108102
commit message. Alternatively, maintainers may change the commit message directly at the time of merge.
103+
- If you have any questions during the review, please feel free to ask the maintainers listed in [MAINTAINERS.md](./MAINTAINERS.md).

Dockerfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,44 @@ FROM golang:1.25 AS envoy-downloader
1515
ARG TARGETOS
1616
ARG TARGETARCH
1717
ARG COMMAND_NAME
18-
# Hard-coded directory for envoy-gateway resources
19-
# See https://github.com/envoyproxy/gateway/blob/d95ce4ce564cfff47ed1fd6c97e29c1058aa4a61/internal/infrastructure/host/proxy_infra.go#L16
20-
WORKDIR /tmp/envoy-gateway
18+
# Download Envoy binary to AIGW_DATA_HOME for the nonroot user
19+
WORKDIR /build
2120
RUN if [ "$COMMAND_NAME" = "aigw" ]; then \
2221
go install github.com/tetratelabs/func-e/cmd/func-e@latest && \
23-
func-e --platform ${TARGETOS}/${TARGETARCH} --home-dir . run --version; \
22+
FUNC_E_DATA_HOME=/home/nonroot/.local/share/aigw func-e --platform ${TARGETOS}/${TARGETARCH} run --version; \
2423
fi \
25-
&& mkdir -p certs \
26-
&& chown -R 65532:65532 . \
27-
&& chmod -R 755 .
24+
# Create directories for the nonroot user
25+
&& mkdir -p /home/nonroot /tmp/envoy-gateway/certs \
26+
&& chown -R 65532:65532 /home/nonroot /tmp/envoy-gateway \
27+
&& chmod -R 755 /home/nonroot /tmp/envoy-gateway
2828

2929
FROM gcr.io/distroless/${VARIANT}-debian12:nonroot
3030
ARG COMMAND_NAME
3131
ARG TARGETOS
3232
ARG TARGETARCH
3333

34+
# Copy pre-downloaded Envoy binary and EG certs directory
35+
COPY --from=envoy-downloader /home/nonroot /home/nonroot
3436
COPY --from=envoy-downloader /tmp/envoy-gateway /tmp/envoy-gateway
3537
COPY ./out/${COMMAND_NAME}-${TARGETOS}-${TARGETARCH} /app
3638

3739
USER nonroot:nonroot
3840

41+
# Set AIGW_RUN_ID=0 for predictable file paths in containers.
42+
# This creates the following directory structure:
43+
# ~/.config/aigw/ - XDG config (e.g., envoy-version preference)
44+
# ~/.local/share/aigw/ - XDG data (downloaded Envoy binaries via func-e)
45+
# ~/.local/state/aigw/runs/0/ - XDG state (aigw.log, envoy-gateway-config.yaml, extproc-config.yaml, resources/)
46+
# ~/.local/state/aigw/envoy-runs/0/ - XDG state (func-e stdout.log, stderr.log)
47+
# /tmp/aigw-0/ - XDG runtime (uds.sock, admin-address.txt)
48+
ENV AIGW_RUN_ID=0
49+
3950
# The healthcheck subcommand performs an HTTP GET to localhost:1064/healthlthy for "aigw run".
4051
# NOTE: This is only for aigw in practice since this is ignored by Kubernetes.
4152
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
4253
CMD ["/app", "healthcheck"]
4354

4455
ENTRYPOINT ["/app"]
56+
57+
# Default CMD for aigw - uses AIGW_RUN_ID from environment
58+
CMD ["run"]

MAINTAINERS.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Maintainers
2+
3+
The following people are responsible for maintaining the Envoy AI Gateway project.
4+
Please reach out to them for any questions, issues, or contributions related to the project.
5+
6+
- Takeshi Yoneda ([@mathetake](https://github.com/mathetake))
7+
- Area: Everything
8+
- [Envoy Proxy](https://github.com/envoyproxy/envoy) Maintainer
9+
- Dan Sun ([@yuzisun](https://github.com/yuzisun))
10+
- Area: Everything, focusing on enterprise integration & core LLM features
11+
- [KServe](https://github.com/kserve/kserve) Maintainer
12+
- Erica Hughberg ([@missBerg](https://github.com/missBerg))
13+
- Area: Documentation, WebSite, Community
14+
- Aaron Choo ([@aabchoo](https://github.com/aabchoo))
15+
- Area: Control Plane, Security Policy, Testing
16+
- Yao Weng ([@wengyao04](https://github.com/wengyao04))
17+
- Area: Control Plane, Testing
18+
- Xunzhuo (Bit) Liu ([@Xunzhuo](https://github.com/Xunzhuo))
19+
- Area: Control Plane, Inference Pool & Gateway API Inference Extension
20+
- [Envoy Gateway](https://github.com/envoyproxy/gateway) Maintainer
21+
- Ignasi Barrera ([@nacx](https://github.com/nacx))
22+
- Area: MCP, aigw CLI (standalone mode)
23+
- Johnu George ([@johnugeorge](https://github.com/johnugeorge))
24+
- Area: Enterprise features and integration, LLM features
25+
- [Kubeflow](https://github.com/kubeflow/kubeflow) Steering Committee member
26+
- Gavrish Prabhu ([@gavrissh](https://github.com/gavrissh))
27+
- Area: Control plane, Testing

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ precommit: ## Run all necessary steps to prepare for a commit.
4949
precommit: tidy spellcheck apigen apidoc format lint editorconfig helm-test
5050

5151
.PHONY: lint
52-
lint: ## This runs the linter, formatter, and tidy on the codebase.
53-
@echo "lint => ./..."
52+
lint: ## This runs the linter on the codebase.
53+
@echo "golangci-lint => ./..."
5454
@$(GO_TOOL) golangci-lint run --build-tags==test_crdcel,test_controller,test_extproc,test_e2e ./...
55+
@echo "actionlint => ./..."
56+
@$(GO_TOOL) actionlint -shellcheck="" # Disabling shellcheck as it requires additional host dependencies.
5557

5658
.PHONY: spellcheck
5759
spellcheck: ## Spell check the codebase.
@@ -102,7 +104,6 @@ editorconfig:
102104
apigen: ## Generate CRDs for the API defined in the api directory.
103105
@echo "apigen => ./api/v1alpha1/..."
104106
@$(GO_TOOL) controller-gen object crd paths="./api/v1alpha1/..." output:dir=./api/v1alpha1 output:crd:dir=./manifests/charts/ai-gateway-crds-helm/templates
105-
@$(GO_TOOL) controller-gen object crd paths="./api/v1alpha1/..." output:dir=./api/v1alpha1 output:crd:dir=./manifests/charts/ai-gateway-helm/crds
106107

107108
# This generates the API documentation for the API defined in the api/v1alpha1 directory.
108109
.PHONY: apidoc
@@ -155,6 +156,8 @@ test-crdcel: apigen ## Run the integration tests of CEL validation in CRD defini
155156
.PHONY: test-extproc # This requires the extproc binary to be built.
156157
test-extproc: build.extproc ## Run the integration tests for extproc without controller or k8s at all.
157158
@$(MAKE) build.testupstream CMD_PATH_PREFIX=tests/internal/testupstreamlib
159+
@echo "Ensure func-e is built and Envoy is installed"
160+
@@$(GO_TOOL) func-e run --version >/dev/null 2>&1
158161
@echo "Run ExtProc test"
159162
@EXTPROC_BIN=$(OUTPUT_DIR)/extproc-$(shell go env GOOS)-$(shell go env GOARCH) go test ./tests/extproc/... $(GO_TEST_E2E_ARGS)
160163

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ Envoy AI Gateway supports a wide range of AI providers, making it easy to integr
8383
<br><sub><b>Tetrate Agent Router Service</b></sub>
8484
</td>
8585
</tr>
86+
<tr>
87+
<td align="center" width="120">
88+
<img src="site/static/img/providers/anthropic.svg" width="60" height="60" alt="Anthropic"/>
89+
<br><sub><b>Anthropic</b></sub>
90+
</td>
91+
</tr>
8692
</table>
8793
</div>
8894

api/v1alpha1/ai_gateway_route.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ type AIGatewayRouteRule struct {
200200
// BackendRefs is the list of backends that this rule will route the traffic to.
201201
// Each backend can have a weight that determines the traffic distribution.
202202
//
203-
// The namespace of each backend is "local", i.e. the same namespace as the AIGatewayRoute.
203+
// The namespace of each backend defaults to the same namespace as the AIGatewayRoute when not specified.
204+
// Cross-namespace references are supported by specifying the namespace field.
205+
// When a namespace different than the AIGatewayRoute's namespace is specified,
206+
// a ReferenceGrant object is required in the referent namespace to allow that
207+
// namespace's owner to accept the reference.
204208
//
205209
// BackendRefs can reference either AIServiceBackend resources (default) or InferencePool resources
206210
// from the Gateway API Inference Extension. When referencing InferencePool resources:
@@ -278,6 +282,17 @@ type AIGatewayRouteRuleBackendRef struct {
278282
// +kubebuilder:validation:MinLength=1
279283
Name string `json:"name"`
280284

285+
// Namespace is the namespace of the backend resource.
286+
// When unspecified (or empty string), this refers to the local namespace of the AIGatewayRoute.
287+
//
288+
// Note that when a namespace different than the local namespace is specified,
289+
// a ReferenceGrant object is required in the referent namespace to allow that
290+
// namespace's owner to accept the reference. See the ReferenceGrant
291+
// documentation for details.
292+
//
293+
// +optional
294+
Namespace *gwapiv1.Namespace `json:"namespace,omitempty"`
295+
281296
// Group is the group of the backend resource.
282297
// When not specified, defaults to aigateway.envoyproxy.io (AIServiceBackend).
283298
// Currently, only "inference.networking.k8s.io" is supported for InferencePool resources.
@@ -302,6 +317,14 @@ type AIGatewayRouteRuleBackendRef struct {
302317
// +optional
303318
ModelNameOverride string `json:"modelNameOverride,omitempty"`
304319

320+
// HeaderMutation defines the request header mutation to be applied to this backend.
321+
// When both route-level and backend-level HeaderMutation are defined,
322+
// route-level takes precedence over backend-level for conflicting operations.
323+
// This field is ignored when referencing InferencePool resources.
324+
//
325+
// +optional
326+
HeaderMutation *HTTPHeaderMutation `json:"headerMutation,omitempty"`
327+
305328
// Weight is the weight of the backend. This is exactly the same as the weight in
306329
// the BackendRef in the Gateway API. See for the details:
307330
// https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.BackendRef

0 commit comments

Comments
 (0)