Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ make env-dev-kind
```

This will build images with your recent changes and load the new images to the
cluster. Note that built image tag should be specified via the `EPP_TAG` environment variable so it is used in the deployment. For example:
cluster. By default the image tag will be `dev`.

**NOTE:** The built image tag can be specified via the `EPP_TAG` environment variable so it is used in the deployment. For example:

```console
EPP_TAG=0.0.4 make env-dev-kind
Expand Down
112 changes: 8 additions & 104 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ SHELL := /usr/bin/env bash
TARGETOS ?= $(shell go env GOOS)
TARGETARCH ?= $(shell go env GOARCH)
PROJECT_NAME ?= llm-d-inference-scheduler
DEV_VERSION ?= 0.0.3
PROD_VERSION ?= 0.0.2
IMAGE_REGISTRY ?= ghcr.io/llm-d
IMAGE_TAG_BASE ?= $(IMAGE_REGISTRY)/$(PROJECT_NAME)
IMG = $(IMAGE_TAG_BASE):$(DEV_VERSION)
EPP_TAG ?= dev
IMG = $(IMAGE_TAG_BASE):$(EPP_TAG)
NAMESPACE ?= hc4ai-operator

CONTAINER_TOOL := $(shell { command -v docker >/dev/null 2>&1 && echo docker; } || { command -v podman >/dev/null 2>&1 && echo podman; } || echo "")
Expand Down Expand Up @@ -82,50 +81,8 @@ build: check-go download-tokenizer ##

##@ Container Build/Push

.PHONY: buildah-build
@if [ "$(BUILDER)" = "buildah" ]; then \
echo "🔧 Buildah detected: Performing multi-arch build..."; \
FINAL_TAG=$(IMG); \
for arch in amd64; do \
ARCH_TAG=$$FINAL_TAG-$$arch; \
echo "📦 Building for architecture: $$arch"; \
buildah build \
--arch=$$arch \
--os=linux \
--layers -t $(IMG)-$$arch . || exit 1; \
echo "🚀 Pushing image: $(IMG)-$$arch"; \
buildah push $(IMG)-$$arch docker://$(IMG)-$$arch || exit 1; \
done; \
echo "🧼 Removing existing manifest (if any)..."; \
buildah manifest rm $$FINAL_TAG || true; \
echo "🧱 Creating and pushing manifest list: $(IMG)"; \
buildah manifest create $(IMG); \
for arch in amd64; do \
ARCH_TAG=$$FINAL_TAG-$$arch; \
buildah manifest add $$FINAL_TAG $$ARCH_TAG; \
done; \
buildah manifest push --all $(IMG) docker://$(IMG); \
elif [ "$(BUILDER)" = "docker" ]; then \
echo "🐳 Docker detected: Building with buildx..."; \
sed -e '1 s/\(^FROM\)/FROM --platform=$${BUILDPLATFORM}/' Dockerfile > Dockerfile.cross; \
- docker buildx create --use --name image-builder || true; \
docker buildx use image-builder; \
docker buildx build --push \
--platform=$(PLATFORMS) \
--tag $(IMG) -f Dockerfile.cross . || exit 1; \
docker buildx rm image-builder || true; \
rm Dockerfile.cross; \
elif [ "$(BUILDER)" = "podman" ]; then \
echo "⚠️ Podman detected: Building single-arch image..."; \
podman build -t $(IMG) . || exit 1; \
podman push $(IMG) || exit 1; \
else \
echo "❌ No supported container tool available."; \
exit 1; \
fi

.PHONY: image-build
image-build: check-container-tool load-version-json ## Build Docker image ## Build Docker image using $(CONTAINER_TOOL)
image-build: check-container-tool ## Build Docker image ## Build Docker image using $(CONTAINER_TOOL)
@printf "\033[33;1m==== Building Docker image $(IMG) ====\033[0m\n"
$(CONTAINER_TOOL) build \
--platform $(TARGETOS)/$(TARGETARCH) \
Expand All @@ -134,7 +91,7 @@ image-build: check-container-tool load-version-json ## Build Docker image ## Bui
-t $(IMG) .

.PHONY: image-push
image-push: check-container-tool load-version-json ## Push Docker image $(IMG) to registry
image-push: check-container-tool ## Push Docker image $(IMG) to registry
@printf "\033[33;1m==== Pushing Docker image $(IMG) ====\033[0m\n"
$(CONTAINER_TOOL) push $(IMG)

Expand Down Expand Up @@ -236,50 +193,10 @@ uninstall-rbac: check-kubectl check-kustomize check-envsubst ## Uninstall RBAC


##@ Version Extraction
.PHONY: version dev-registry prod-registry extract-version-info

dev-version: check-jq
@jq -r '.dev-version' .version.json

prod-version: check-jq
@jq -r '.prod-version' .version.json

dev-registry: check-jq
@jq -r '."dev-registry"' .version.json

prod-registry: check-jq
@jq -r '."prod-registry"' .version.json

extract-version-info: check-jq
@echo "DEV_VERSION=$$(jq -r '."dev-version"' .version.json)"
@echo "PROD_VERSION=$$(jq -r '."prod-version"' .version.json)"
@echo "DEV_IMAGE_TAG_BASE=$$(jq -r '."dev-registry"' .version.json)"
@echo "PROD_IMAGE_TAG_BASE=$$(jq -r '."prod-registry"' .version.json)"

##@ Load Version JSON

.PHONY: load-version-json
load-version-json: check-jq
@if [ "$(DEV_VERSION)" = "0.0.1" ]; then \
DEV_VERSION=$$(jq -r '."dev-version"' .version.json); \
PROD_VERSION=$$(jq -r '."prod-version"' .version.json); \
echo "✔ Loaded DEV_VERSION from .version.json: $$DEV_VERSION"; \
echo "✔ Loaded PROD_VERSION from .version.json: $$PROD_VERSION"; \
export DEV_VERSION; \
export PROD_VERSION; \
fi && \
CURRENT_DEFAULT="ghcr.io/llm-d/$(PROJECT_NAME)"; \
if [ "$(IMAGE_TAG_BASE)" = "$$CURRENT_DEFAULT" ]; then \
IMAGE_TAG_BASE=$$(jq -r '."dev-registry"' .version.json); \
echo "✔ Loaded IMAGE_TAG_BASE from .version.json: $$IMAGE_TAG_BASE"; \
export IMAGE_TAG_BASE; \
fi && \
echo "🛠 Final values: DEV_VERSION=$$DEV_VERSION, PROD_VERSION=$$PROD_VERSION, IMAGE_TAG_BASE=$$IMAGE_TAG_BASE"
.PHONY: version extract-version-info

.PHONY: env
env: load-version-json ## Print environment variables
@echo "DEV_VERSION=$(DEV_VERSION)"
@echo "PROD_VERSION=$(PROD_VERSION)"
env: ## Print environment variables
@echo "IMAGE_TAG_BASE=$(IMAGE_TAG_BASE)"
@echo "IMG=$(IMG)"
@echo "CONTAINER_TOOL=$(CONTAINER_TOOL)"
Expand All @@ -292,13 +209,11 @@ check-tools: \
check-go \
check-ginkgo \
check-golangci-lint \
check-jq \
check-kustomize \
check-envsubst \
check-container-tool \
check-kubectl \
check-buildah \
check-podman
check-buildah
@echo "✅ All required tools are installed."

.PHONY: check-go
Expand All @@ -316,11 +231,6 @@ check-golangci-lint:
@command -v golangci-lint >/dev/null 2>&1 || { \
echo "❌ golangci-lint is not installed. Install from https://golangci-lint.run/usage/install/"; exit 1; }

.PHONY: check-jq
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove that, it's good to check this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use jq anymore. It was used to read the .version.json file

check-jq:
@command -v jq >/dev/null 2>&1 || { \
echo "❌ jq is not installed. Install it from https://stedolan.github.io/jq/download/"; exit 1; }

.PHONY: check-kustomize
check-kustomize:
@command -v kustomize >/dev/null 2>&1 || { \
Expand Down Expand Up @@ -352,12 +262,6 @@ check-builder:
echo "✅ Using builder: $(BUILDER)"; \
fi

.PHONY: check-podman
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove that, it's good to check this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman was used explicitly in the tekton build pipeline, which isno longer used.

One doesn't need to have podman installed. There is a check for one's container tool which is either docker or podman as appropriate.

check-podman:
@command -v podman >/dev/null 2>&1 || { \
echo "⚠️ Podman is not installed. You can install it with:"; \
echo "🔧 sudo apt install podman OR brew install podman"; exit 1; }

##@ Alias checking
.PHONY: check-alias
check-alias: check-container-tool
Expand Down Expand Up @@ -387,7 +291,7 @@ KIND_CLUSTER_NAME ?= llm-d-inference-scheduler-dev
KIND_GATEWAY_HOST_PORT ?= 30080

.PHONY: env-dev-kind
env-dev-kind: image-build
env-dev-kind:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep that before we run the kind

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to add 2 targets for installation on kind - one which includes image build and another one without build?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I added back the dependency.

CLUSTER_NAME=$(KIND_CLUSTER_NAME) \
GATEWAY_HOST_PORT=$(KIND_GATEWAY_HOST_PORT) \
IMAGE_REGISTRY=$(IMAGE_REGISTRY) \
Expand Down
4 changes: 2 additions & 2 deletions scripts/kind-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
: "${VLLM_SIMULATOR_IMAGE:=llm-d-inference-sim}"

# Set a default VLLM_SIMULATOR_TAG if not provided
export VLLM_SIMULATOR_TAG="${VLLM_SIMULATOR_TAG:-0.0.6}"
export VLLM_SIMULATOR_TAG="${VLLM_SIMULATOR_TAG:-dev}"

# Set a default EPP_IMAGE if not provided
: "${EPP_IMAGE:=llm-d-inference-scheduler}"

# Set a default EPP_TAG if not provided
export EPP_TAG="${EPP_TAG:-0.0.4}"
export EPP_TAG="${EPP_TAG:-dev}"

# Set the default routing side car image tag
export ROUTING_SIDECAR_TAG="${ROUTING_SIDECAR_TAG:-0.0.6}"
Expand Down