@@ -62,8 +62,12 @@ CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen
6262IMG_PREFIX ?= controller
6363IMG_TAG ?= latest
6464
65- # ENABLE_METRICS: If set to true, includes Prometheus Service resources.
65+ # Kind cluster name for loading images
66+ KIND_CLUSTER ?= nrr-test
67+
68+ # ENABLE_METRICS: If set to true, includes Prometheus Service and ServiceMonitor resources.
6669ENABLE_METRICS ?= false
70+ # ENABLE_TLS: If set to true (and ENABLE_METRICS is true), configures metrics to use HTTPS with CertManager.
6771ENABLE_TLS ?= false
6872# ENABLE_WEBHOOK: If set to true, includes validating webhook. Requires ENABLE_TLS=true.
6973ENABLE_WEBHOOK ?= false
@@ -173,11 +177,16 @@ run: manifests generate fmt vet ## Run a controller from your host.
173177 go run ./cmd/main.go
174178
175179# If you wish to build the manager image targeting other platforms you can use the --platform flag.
176- # (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
180+ # (i.e. docker build --platform linux/arm64 or podman build --platform linux/arm64).
181+ # However, you must enable docker buildKit for it.
177182# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
178183.PHONY : docker-build
179- docker-build : # # Build docker image with the manager.
180- DOCKER_BUILDKIT=1 $(CONTAINER_TOOL ) build -t ${IMG_PREFIX} :${IMG_TAG} .
184+ docker-build : # # Build container image with Docker.
185+ DOCKER_BUILDKIT=1 docker build -t ${IMG_PREFIX} :${IMG_TAG} .
186+
187+ .PHONY : podman-build
188+ podman-build : # # Build container image with Podman.
189+ podman build -t localhost/${IMG_PREFIX} :${IMG_TAG} .
181190
182191.PHONY : docker-push
183192docker-push : # # Push docker image with the manager.
@@ -197,9 +206,29 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
197206 - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG_PREFIX} :${IMG_TAG} .
198207 - $(CONTAINER_TOOL ) buildx rm nrrcontroller-builder
199208
209+ .PHONY : kind-load
210+ kind-load : # # Load the built image into kind cluster
211+ ifeq ($(CONTAINER_TOOL ) ,podman)
212+ @echo "Loading Podman image into kind cluster: $(KIND_CLUSTER)"
213+ @echo "Saving image to temporary tar archive..."
214+ @$(CONTAINER_TOOL) save -o /tmp/controller-image.tar localhost/$(IMG_PREFIX):$(IMG_TAG)
215+ @echo "Loading tar archive into kind cluster..."
216+ @kind load image-archive /tmp/controller-image.tar --name $(KIND_CLUSTER)
217+ @echo "Cleaning up temporary tar archive..."
218+ @rm /tmp/controller-image.tar
219+ @echo "Image loaded successfully!"
220+ else
221+ @echo "Loading Docker image into kind cluster: $(KIND_CLUSTER)"
222+ @kind load docker-image $(IMG_PREFIX):$(IMG_TAG) --name $(KIND_CLUSTER)
223+ endif
224+
200225.PHONY : docker-build-reporter
201- docker-build-reporter : # # Build docker image with the reporter.
202- DOCKER_BUILDKIT=1 $(CONTAINER_TOOL ) build -f Dockerfile.reporter -t ${IMG_PREFIX} :${IMG_TAG} .
226+ docker-build-reporter : # # Build reporter container image with Docker.
227+ DOCKER_BUILDKIT=1 docker build -f Dockerfile.reporter -t ${IMG_PREFIX} :${IMG_TAG} .
228+
229+ .PHONY : podman-build-reporter
230+ podman-build-reporter : # # Build reporter container image with Podman.
231+ podman build -f Dockerfile.reporter -t ${IMG_PREFIX} :${IMG_TAG} .
203232
204233.PHONY : docker-push-reporter
205234docker-push-reporter : # # Push docker image with the reporter.
0 commit comments