|
1 | 1 | .PHONY: install dev dev-frontend dev-backend build compile lint test clean help providers-test verify-versions test-verify-versions |
2 | 2 | .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 |
4 | 4 |
|
5 | 5 | # Controller image |
6 | 6 | CONTROLLER_IMG ?= ghcr.io/kaito-project/airunway/controller:latest |
|
59 | 59 | @echo "Provider Targets:" |
60 | 60 | @echo " providers-test Run all provider tests" |
61 | 61 | @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 "" |
62 | 66 | @echo "Image Build Variables:" |
63 | 67 | @echo " PLATFORM=<platform> Target platform for image builds (default: linux/amd64)" |
64 | 68 | @echo " PUSH=true Push image instead of loading it locally (default: false)" |
@@ -200,6 +204,57 @@ model-downloader-docker-build: |
200 | 204 | docker buildx build --platform $(PLATFORM) $(IMAGE_OUTPUT_FLAG) -f images/model-downloader/Dockerfile -t $(MODEL_DOWNLOADER_IMG) images/model-downloader |
201 | 205 | @echo "✅ Model downloader image built: $(MODEL_DOWNLOADER_IMG) ($(PLATFORM), $(if $(PUSH_ENABLED),pushed,loaded locally))" |
202 | 206 |
|
| 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 | + |
203 | 258 | # ==================== Version Drift Guard ==================== |
204 | 259 |
|
205 | 260 | # Verify all version references are in sync with versions.env. |
|
0 commit comments