|
1 | 1 | SHELL := /usr/bin/env bash |
2 | 2 |
|
3 | | -# Image registry + dev-environment image tags (single source of truth). |
4 | | -include versions.mk |
5 | | - |
6 | | -# Export all dev-env image references so the e2e suite sees them. |
7 | | -export IMAGE_REGISTRY COORDINATOR_TAG VLLM_SIMULATOR_TAG EPP_TAG |
8 | | -export COORDINATOR_IMAGE VLLM_IMAGE EPP_IMAGE |
9 | | - |
10 | 3 | # Defaults |
11 | 4 | TARGETOS ?= $(shell command -v go >/dev/null 2>&1 && go env GOOS || uname -s | tr '[:upper:]' '[:lower:]') |
12 | 5 | TARGETARCH ?= $(shell command -v go >/dev/null 2>&1 && go env GOARCH || uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/; s/armv7l/arm/') |
13 | 6 | PROJECT_NAME ?= llm-d-coordinator |
14 | 7 | BUILDER_IMAGE_NAME ?= llm-d-coordinator-builder |
15 | 8 | IMAGE_REGISTRY ?= ghcr.io/llm-d |
16 | 9 |
|
| 10 | +# Image tags |
| 11 | +COORDINATOR_TAG ?= dev |
| 12 | +VLLM_SIMULATOR_TAG ?= v0.10.0 |
| 13 | +EPP_TAG ?= dev |
| 14 | + |
| 15 | +# Full image references (derived; override only if you need a non-standard repo) |
| 16 | +COORDINATOR_IMAGE ?= $(IMAGE_REGISTRY)/llm-d-coordinator:$(COORDINATOR_TAG) |
| 17 | +VLLM_IMAGE ?= $(IMAGE_REGISTRY)/llm-d-inference-sim:$(VLLM_SIMULATOR_TAG) |
| 18 | +EPP_IMAGE ?= $(IMAGE_REGISTRY)/llm-d-router-endpoint-picker:$(EPP_TAG) |
| 19 | + |
| 20 | +# vllm-render defaults to the same image as the other simulated vLLM roles; override |
| 21 | +# independently to point it at a real vLLM image (e.g. vllm/vllm-openai-cpu:v0.21.0). |
| 22 | +VLLM_RENDER_IMAGE ?= $(VLLM_IMAGE) |
| 23 | +VLLM_RENDER_PORT ?= 8082 |
| 24 | + |
17 | 25 | # Internal variable mappings for the generic image-build-% target. |
18 | 26 | coordinator_IMAGE = $(COORDINATOR_IMAGE) |
19 | 27 | epp_IMAGE = $(EPP_IMAGE) |
20 | 28 |
|
| 29 | +# Export all dev-env image references so the e2e suite sees them. |
| 30 | +export IMAGE_REGISTRY COORDINATOR_TAG VLLM_SIMULATOR_TAG EPP_TAG |
| 31 | +export COORDINATOR_IMAGE VLLM_IMAGE EPP_IMAGE VLLM_RENDER_IMAGE VLLM_RENDER_PORT |
| 32 | + |
21 | 33 | BUILDER_TAG ?= dev |
22 | 34 | BUILDER_TAG_BASE ?= $(IMAGE_REGISTRY)/$(BUILDER_IMAGE_NAME) |
23 | 35 | export BUILDER_IMAGE ?= $(BUILDER_TAG_BASE):$(BUILDER_TAG) |
@@ -56,11 +68,64 @@ endif |
56 | 68 |
|
57 | 69 | BUILDER_RUN_FLAGS = --rm $(BUILDER_USER_FLAGS) \ |
58 | 70 | -v $$(pwd):/app:Z -w /app \ |
59 | | - -v $(GO_MOD_CACHE_VOL):/go/pkg/mod \ |
60 | | - -v $(GO_BUILD_CACHE_VOL):/go/cache |
| 71 | + -v $(GO_MOD_CACHE_VOL):/go/pkg/mod:z \ |
| 72 | + -v $(GO_BUILD_CACHE_VOL):/go/cache:z |
61 | 73 |
|
62 | 74 | BUILDER_RUN = $(CONTAINER_RUNTIME) run $(BUILDER_RUN_FLAGS) $(BUILDER_IMAGE) sh -c |
63 | 75 |
|
| 76 | +# Mount the container runtime socket and set CONTAINER_HOST so podman --remote |
| 77 | +# inside the builder can talk to the host's container runtime. |
| 78 | +ifeq ($(CONTAINER_RUNTIME),podman) |
| 79 | +CONTAINER_SOCK ?= $(or $(shell podman info --format '{{.Host.RemoteSocket.Path}}' 2>/dev/null | sed 's|^unix://||'),/run/podman/podman.sock) |
| 80 | +BUILDER_SOCK_FLAGS = --security-opt label=disable \ |
| 81 | + -v $(CONTAINER_SOCK):$(CONTAINER_SOCK) \ |
| 82 | + -e CONTAINER_HOST=unix://$(CONTAINER_SOCK) \ |
| 83 | + -e DOCKER_HOST=unix://$(CONTAINER_SOCK) \ |
| 84 | + -e CONTAINER_RUNTIME=podman \ |
| 85 | + -e KIND_EXPERIMENTAL_PROVIDER=podman |
| 86 | +else |
| 87 | +CONTAINER_SOCK ?= /var/run/docker.sock |
| 88 | +ifeq ($(TARGETOS),darwin) |
| 89 | +DOCKER_SOCK_GID := $(shell stat -f '%g' $(CONTAINER_SOCK) 2>/dev/null) |
| 90 | +else |
| 91 | +DOCKER_SOCK_GID := $(shell stat -c '%g' $(CONTAINER_SOCK) 2>/dev/null) |
| 92 | +endif |
| 93 | +ifneq ($(DOCKER_SOCK_GID),) |
| 94 | +DOCKER_GROUP_PARAM := --group-add $(DOCKER_SOCK_GID) |
| 95 | +else |
| 96 | +DOCKER_GROUP_PARAM := |
| 97 | +endif |
| 98 | +BUILDER_SOCK_FLAGS = $(DOCKER_GROUP_PARAM) \ |
| 99 | + -v $(CONTAINER_SOCK):$(CONTAINER_SOCK) \ |
| 100 | + -e DOCKER_HOST=unix://$(CONTAINER_SOCK) \ |
| 101 | + -e CONTAINER_RUNTIME=docker |
| 102 | +endif |
| 103 | + |
| 104 | +# Respect host KUBECONFIG if set; fall back to ~/.kube/config. |
| 105 | +HOST_KUBECONFIG ?= $(or $(KUBECONFIG),$(HOME)/.kube/config) |
| 106 | + |
| 107 | +# When K8S_CONTEXT is set, mount the host kubeconfig so the e2e suite can call |
| 108 | +# config.GetConfigWithContext(K8S_CONTEXT) against an existing cluster instead of |
| 109 | +# creating a new kind cluster. |
| 110 | +ifdef K8S_CONTEXT |
| 111 | +BUILDER_E2E_KUBECONFIG_FLAGS = -v $(HOST_KUBECONFIG):/.kube/config:ro -e KUBECONFIG=/.kube/config |
| 112 | +else |
| 113 | +BUILDER_E2E_KUBECONFIG_FLAGS = |
| 114 | +endif |
| 115 | + |
| 116 | +# Env vars forwarded into the e2e test container. |
| 117 | +E2E_ENV_VARS = COORDINATOR_IMAGE VLLM_IMAGE EPP_IMAGE VLLM_RENDER_IMAGE VLLM_RENDER_PORT \ |
| 118 | + COORDINATOR_PORT E2E_GATEWAY_PORT E2E_KEEP_CLUSTER_ON_FAILURE \ |
| 119 | + E2E_PRINT_COORDINATOR_LOGS K8S_CONTEXT READY_TIMEOUT MODEL_NAME |
| 120 | +BUILDER_E2E_ENV_FLAGS = $(foreach v,$(E2E_ENV_VARS),$(if $($(v)),-e '$(v)=$($(v))')) |
| 121 | +ifneq ($(filter command line environment,$(origin NAMESPACE)),) |
| 122 | +BUILDER_E2E_ENV_FLAGS += -e NAMESPACE=$(NAMESPACE) |
| 123 | +endif |
| 124 | + |
| 125 | +# E2e tests create their own kind cluster, need host network (for NodePort access) |
| 126 | +# and the container socket (for kind), but not the host kubeconfig. |
| 127 | +BUILDER_E2E_FLAGS = --network=host $(BUILDER_SOCK_FLAGS) $(BUILDER_E2E_ENV_FLAGS) $(BUILDER_E2E_KUBECONFIG_FLAGS) |
| 128 | + |
64 | 129 | BUILDER_STAMP = build/.builder.stamp |
65 | 130 |
|
66 | 131 | .PHONY: help |
@@ -132,7 +197,9 @@ test-unit: image-build-builder |
132 | 197 |
|
133 | 198 | .PHONY: test-e2e-coordinator |
134 | 199 | test-e2e-coordinator: image-build-coordinator image-build-epp image-build-builder image-pull ## Run coordinator e2e tests against a new kind cluster |
135 | | - test/coordinator/scripts/run_e2e_coordinator.sh |
| 200 | + @printf "\033[33;1m==== Running Coordinator End to End Tests ====\033[0m\n" |
| 201 | + $(CONTAINER_RUNTIME) run $(BUILDER_RUN_FLAGS) $(BUILDER_E2E_FLAGS) \ |
| 202 | + $(BUILDER_IMAGE) test/coordinator/scripts/run_e2e_coordinator.sh |
136 | 203 |
|
137 | 204 | .PHONY: build |
138 | 205 | build: image-build-builder ## Build the coordinator binary |
@@ -182,10 +249,6 @@ image-build-builder: check-container-tool ## Build builder image if missing loca |
182 | 249 | touch $(BUILDER_STAMP); \ |
183 | 250 | fi |
184 | 251 |
|
185 | | -.PHONY: image-build-epp |
186 | | -image-build-epp: ## Clone llm-d-inference-scheduler at pinned commit and build EPP image |
187 | | - scripts/build-epp-image.sh |
188 | | - |
189 | 252 | .PHONY: image-pull |
190 | 253 | image-pull: check-container-tool ## Pull all related images using $(CONTAINER_RUNTIME) |
191 | 254 | @printf "\033[33;1m==== Pulling Container images ====\033[0m\n" |
|
0 commit comments