@@ -53,7 +53,8 @@ OPERATOR_SDK_VERSION ?= v1.39.2
5353ENVTEST_K8S_VERSION = 1.31.0
5454
5555# Image URL to use all building/pushing image targets
56- IMG ?= quay.io/llamastack/llama-stack-k8s-operator:latest
56+ IMG_TAG ?= latest
57+ IMG ?= $(IMAGE_TAG_BASE ) :$(IMG_TAG )
5758
5859# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5960ifeq (,$(shell go env GOBIN) )
@@ -63,7 +64,7 @@ GOBIN=$(shell go env GOBIN)
6364endif
6465
6566# CONTAINER_TOOL defines the container tool to be used for building images.
66- # Be aware that the target commands are only tested with Docker which is
67+ # Be aware that the target commands are only tested with Docker/Podman which is
6768# scaffolded by default. However, you might want to replace it to use other
6869# tools. (i.e. podman)
6970CONTAINER_TOOL ?= podman
@@ -77,6 +78,9 @@ SHELL = /usr/bin/env bash -o pipefail
7778# See README.md, default go test timeout 10m
7879E2E_TEST_FLAGS = -timeout 30m
7980
81+ # Include local.mk if it exists (for custom overrides)
82+ -include local.mk
83+
8084.PHONY : all
8185all : build
8286
@@ -108,12 +112,21 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
108112 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
109113
110114GOLANGCI_TMP_FILE = .golangci.mktmp.yml
115+
111116.PHONY : fmt
112117fmt : golangci-lint yq # # Formats code and imports.
113118 go fmt ./...
114119 $(YQ ) e ' .linters = {"disable-all": true, "enable": ["gci"]}' .golangci.yml > $(GOLANGCI_TMP_FILE )
115120 $(GOLANGCI_LINT ) run --config=$(GOLANGCI_TMP_FILE ) --fix
116- CLEANFILES += $(GOLANGCI_TMP_FILE )
121+
122+ .PHONY : clean
123+ clean : # # Remove temporary files, caches, and downloaded tools
124+ @# Clean golangci-lint cache only if golangci-lint is available
125+ @if command -v $(GOLANGCI_LINT ) > /dev/null 2>&1 ; then \
126+ $(GOLANGCI_LINT ) cache clean; \
127+ fi
128+ rm -f $(GOLANGCI_TMP_FILE ) Dockerfile.cross cover.out
129+ rm -rf $(LOCALBIN )
117130
118131.PHONY : vet
119132vet : # # Run go vet against code.
@@ -125,7 +138,7 @@ test: manifests generate fmt vet envtest ## Run tests.
125138
126139.PHONY : test-e2e
127140test-e2e : # # Run e2e tests
128- ./hack/deploy-ollama.sh # Deploy Ollama
141+ ./hack/deploy-ollama.sh # Deploy Ollama for e2e tests
129142 go test -v ./tests/e2e/ -run ^TestE2E -v ${E2E_TEST_FLAGS}
130143
131144GOLANGCI_LINT_TIMEOUT ?= 5m0s
@@ -150,12 +163,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
150163# If you wish to build the manager image targeting other platforms you can use the --platform flag.
151164# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
152165# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
153- .PHONY : docker -build
154- docker -build : # # Build docker image with the manager.
166+ .PHONY : image -build
167+ image -build : # # Build image with the manager.
155168 $(CONTAINER_TOOL ) build -t ${IMG} .
156169
157- .PHONY : docker -push
158- docker -push : # # Push docker image with the manager.
170+ .PHONY : image -push
171+ image -push : # # Push image with the manager.
159172 $(CONTAINER_TOOL ) push ${IMG}
160173
161174# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
@@ -183,7 +196,7 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
183196 $(KUSTOMIZE ) build config/default > release/operator.yaml
184197
185198.PHONY : image
186- image : docker -build docker -push # # Build and push image with the manager.
199+ image : image -build image -push # # Build and push image with the manager.
187200
188201# #@ Deployment
189202
@@ -322,7 +335,7 @@ bundle-build: ## Build the bundle image.
322335
323336.PHONY : bundle-push
324337bundle-push : # # Push the bundle image.
325- $(MAKE ) docker -push IMG=$(BUNDLE_IMG )
338+ $(MAKE ) image -push IMG=$(BUNDLE_IMG )
326339
327340.PHONY : opm
328341OPM = $(LOCALBIN ) /opm
@@ -358,12 +371,12 @@ endif
358371# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
359372.PHONY : catalog-build
360373catalog-build : opm # # Build a catalog image.
361- $(OPM ) index add --container-tool docker --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
374+ $(OPM ) index add --container-tool $( CONTAINER_TOOL ) --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
362375
363376# Push the catalog image.
364377.PHONY : catalog-push
365378catalog-push : # # Push a catalog image.
366- $(MAKE ) docker -push IMG=$(CATALOG_IMG )
379+ $(MAKE ) image -push IMG=$(CATALOG_IMG )
367380
368381# Pre-commit checks called explicitly
369382.PHONY : pre-commit
0 commit comments