Skip to content

Commit 1024da7

Browse files
authored
feat(gateway): add provider-agnostic setup-gateway target (#305)
Signed-off-by: Suraj Deshmukh <suraj.deshmukh@microsoft.com>
1 parent 92dd7fb commit 1024da7

6 files changed

Lines changed: 106 additions & 4 deletions

File tree

Makefile

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: install dev dev-frontend dev-backend build compile lint test clean help providers-test verify-versions test-verify-versions
22
.PHONY: controller-build controller-docker-build controller-install controller-deploy controller-generate generate-deploy-manifests
3-
.PHONY: model-downloader-docker-build
3+
.PHONY: model-downloader-docker-build setup-gateway cleanup-gateway
44

55
# Controller image
66
CONTROLLER_IMG ?= ghcr.io/kaito-project/airunway/controller:latest
@@ -59,6 +59,10 @@ help:
5959
@echo "Provider Targets:"
6060
@echo " providers-test Run all provider tests"
6161
@echo ""
62+
@echo "Cluster Setup Targets:"
63+
@echo " setup-gateway Install Gateway API CRDs, Istio, BBR, and the inference Gateway"
64+
@echo " cleanup-gateway Remove the inference Gateway and BBR (CRDs/Istio left intact)"
65+
@echo ""
6266
@echo "Image Build Variables:"
6367
@echo " PLATFORM=<platform> Target platform for image builds (default: linux/amd64)"
6468
@echo " PUSH=true Push image instead of loading it locally (default: false)"
@@ -200,6 +204,57 @@ model-downloader-docker-build:
200204
docker buildx build --platform $(PLATFORM) $(IMAGE_OUTPUT_FLAG) -f images/model-downloader/Dockerfile -t $(MODEL_DOWNLOADER_IMG) images/model-downloader
201205
@echo "✅ Model downloader image built: $(MODEL_DOWNLOADER_IMG) ($(PLATFORM), $(if $(PUSH_ENABLED),pushed,loaded locally))"
202206

207+
# ==================== Cluster Setup Targets ====================
208+
209+
# Provider-agnostic inference-gateway bootstrap: installs Gateway API CRDs,
210+
# Istio (with the Gateway API Inference Extension enabled), the Body-Based
211+
# Router, and an `inference-gateway` Gateway resource. Required before
212+
# deploying any provider that routes through the inference gateway. Versions
213+
# are pinned in versions.env (GATEWAY_API_VERSION, ISTIO_VERSION, GAIE_VERSION).
214+
GATEWAY_NAMESPACE ?= default
215+
GATEWAY_NAME ?= inference-gateway
216+
GATEWAY_API_URL := https://github.com/kubernetes-sigs/gateway-api/releases/download/$(GATEWAY_API_VERSION)/standard-install.yaml
217+
GATEWAY_MANIFEST := hack/inference-gateway.yaml
218+
BBR_CHART := oci://registry.k8s.io/gateway-api-inference-extension/charts/body-based-routing
219+
GAIE_MANIFEST_URL := https://github.com/kubernetes-sigs/gateway-api-inference-extension/releases/download/$(GAIE_VERSION)/manifests.yaml
220+
221+
setup-gateway: verify-versions
222+
@command -v istioctl >/dev/null 2>&1 || { echo "❌ istioctl not found on PATH. Install Istio $(ISTIO_VERSION): https://istio.io/latest/docs/setup/getting-started/"; exit 1; }
223+
@echo "Installing Gateway API CRDs $(GATEWAY_API_VERSION)..."
224+
kubectl apply -f $(GATEWAY_API_URL)
225+
@echo "Installing Gateway API Inference Extension (GAIE) CRDs $(GAIE_VERSION)..."
226+
kubectl apply -f $(GAIE_MANIFEST_URL)
227+
@echo "Installing Istio $(ISTIO_VERSION) (inference extension enabled)..."
228+
istioctl install --skip-confirmation \
229+
--set profile=minimal \
230+
--set tag=$(ISTIO_VERSION) \
231+
--set values.pilot.env.ENABLE_GATEWAY_API_INFERENCE_EXTENSION=true
232+
@echo "Installing Body-Based Router (BBR) $(GAIE_VERSION) into namespace $(GATEWAY_NAMESPACE)..."
233+
helm upgrade -i body-based-router \
234+
--namespace $(GATEWAY_NAMESPACE) --create-namespace \
235+
--set provider.name=istio \
236+
--version "$(GAIE_VERSION)" \
237+
--wait \
238+
$(BBR_CHART)
239+
@echo "Creating Gateway resource $(GATEWAY_NAME) in namespace $(GATEWAY_NAMESPACE)..."
240+
@command -v envsubst >/dev/null 2>&1 || { echo "❌ envsubst not found on PATH (provided by gettext)."; exit 1; }
241+
GATEWAY_NAME=$(GATEWAY_NAME) GATEWAY_NAMESPACE=$(GATEWAY_NAMESPACE) \
242+
envsubst < $(GATEWAY_MANIFEST) | kubectl apply -f -
243+
@echo "✅ Inference gateway ready (Istio $(ISTIO_VERSION), gateway/$(GATEWAY_NAME))"
244+
245+
# Tear down the inference Gateway and BBR. Gateway API CRDs and Istio are left
246+
# intact because they may be shared with other workloads.
247+
cleanup-gateway:
248+
@command -v envsubst >/dev/null 2>&1 || { echo "❌ envsubst not found on PATH (provided by gettext)."; exit 1; }
249+
@GATEWAY_NAME=$(GATEWAY_NAME) GATEWAY_NAMESPACE=$(GATEWAY_NAMESPACE) \
250+
envsubst < $(GATEWAY_MANIFEST) | kubectl delete -f - --ignore-not-found
251+
@helm uninstall body-based-router --namespace $(GATEWAY_NAMESPACE) --ignore-not-found || helm uninstall body-based-router --namespace $(GATEWAY_NAMESPACE) || true
252+
@echo "⚠️ Gateway API CRDs, GAIE CRDs, and Istio left intact (may be shared). Remove manually if needed:"
253+
@echo " kubectl delete -f \"$(GATEWAY_API_URL)\" --ignore-not-found"
254+
@echo " kubectl delete -f \"$(GAIE_MANIFEST_URL)\" --ignore-not-found"
255+
@echo " istioctl uninstall --purge -y"
256+
@echo "✅ Inference gateway and BBR removed"
257+
203258
# ==================== Version Drift Guard ====================
204259

205260
# Verify all version references are in sync with versions.env.

docs/gateway.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ AI Runway works with any Gateway API implementation that supports the [Inference
7474
7575
## Setup
7676

77+
> [!TIP]
78+
> **Istio shortcut:** `make setup-gateway` (from the repo root) performs the entire manual
79+
> **Istio** setup below in one shot — it installs the Gateway API CRDs (Step 1), the Gateway
80+
> API Inference Extension (GAIE) CRDs (Step 2), Istio with the inference extension enabled
81+
> (Step 3), the `inference-gateway` Gateway resource (Step 4), and the Body-Based Router (see
82+
> [Body-Based Routing](#body-based-routing-bbr)). The
83+
> `GATEWAY_API_VERSION`, `ISTIO_VERSION`, and `GAIE_VERSION` it uses are pinned in
84+
> [`/versions.env`](../versions.env), and `istioctl` must be on your PATH. For other gateway
85+
> implementations, follow the manual steps below.
86+
7787
### Step 1: Install Gateway API CRDs
7888

7989
```bash

hack/inference-gateway.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Provider-agnostic inference gateway used by the root `setup-gateway` target.
2+
# The name and namespace are filled in by envsubst at apply time
3+
# (defaults: inference-gateway / default — see GATEWAY_NAME / GATEWAY_NAMESPACE
4+
# in the root Makefile).
5+
apiVersion: gateway.networking.k8s.io/v1
6+
kind: Gateway
7+
metadata:
8+
name: ${GATEWAY_NAME}
9+
namespace: ${GATEWAY_NAMESPACE}
10+
labels:
11+
# Identifies this as the airunway inference gateway. The controller's
12+
# auto-selection and the backend status check use this label to
13+
# disambiguate when more than one Gateway exists in the cluster (see
14+
# controller/internal/gateway/detection.go and gateway_reconciler.go).
15+
airunway.ai/inference-gateway: "true"
16+
spec:
17+
gatewayClassName: istio
18+
infrastructure:
19+
annotations:
20+
# Required on AKS with Istio. Azure otherwise probes GET / on port 80,
21+
# but the gateway returns 404 there and the public IP can time out.
22+
service.beta.kubernetes.io/port_80_health-probe_protocol: tcp
23+
listeners:
24+
- name: http
25+
protocol: HTTP
26+
port: 80

providers/dynamo/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ setup-dynamo: verify-versions
7070
curl -fsSL "$(DYNAMO_PRE_DEPLOY_URL)" -o "$$TMPSCRIPT" && \
7171
chmod +x "$$TMPSCRIPT" && \
7272
bash "$$TMPSCRIPT"
73-
@echo "Pre-deployment checks passed. Installing GAIE components..."
74-
@kubectl apply -f $(GAIE_MANIFEST_URL)
73+
@echo "Pre-deployment checks passed. Setting up the inference gateway (Gateway API CRDs, GAIE CRDs, Istio, BBR, Gateway)..."
74+
@$(MAKE) -C ../.. setup-gateway
7575
@echo "Installing Dynamo platform v$(DYNAMO_VERSION)..."
7676
@helm upgrade -i dynamo-platform "$(DYNAMO_CHART_URL)" \
7777
--namespace $(DYNAMO_NAMESPACE) \
7878
--create-namespace \
79-
--set "dynamo-operator.controllerManager.manager.image.tag=$(DYNAMO_VERSION)"
79+
--set "dynamo-operator.controllerManager.manager.image.tag=$(DYNAMO_VERSION)" \
80+
--wait
8081
@echo "✅ Dynamo platform v$(DYNAMO_VERSION) installed in namespace $(DYNAMO_NAMESPACE)"
8182

8283
## Uninstall Dynamo platform from the cluster

shared/types/versions.generated.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
export const GAIE_VERSION = "v1.5.0";
66
export const DYNAMO_VERSION = "1.1.1";
77
export const KAITO_VERSION = "0.10.0";
8+
export const GATEWAY_API_VERSION = "v1.5.1";
9+
export const ISTIO_VERSION = "1.30.0";

versions.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ DYNAMO_VERSION=1.1.1
2424

2525
# KAITO workspace operator Helm chart version (kaito/workspace chart).
2626
KAITO_VERSION=0.10.0
27+
28+
# Gateway API CRDs (a separate project from GAIE). Used by the root
29+
# `setup-gateway` Makefile target to install standard-install.yaml.
30+
GATEWAY_API_VERSION=v1.5.1
31+
32+
# Istio control plane installed by the root `setup-gateway` target
33+
# (gatewayClassName: istio). Requires a matching local istioctl on PATH.
34+
ISTIO_VERSION=1.30.0

0 commit comments

Comments
 (0)