1- # Image URL to use all building/pushing image targets
2- IMG ?= controller:latest
3-
41# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
52ifeq (,$(shell go env GOBIN) )
63GOBIN =$(shell go env GOPATH) /bin
74else
85GOBIN =$(shell go env GOBIN)
96endif
107
8+ # Image registry (e.g. `docker.io`)
9+ IMAGE_REGISTRY ?= docker.io
10+ # Image repository (e.g. `my-repo/my-image`).
11+ IMAGE_REPOSITORY ?= cron-operator
12+ # Image tag (e.g. `latest`).
13+ IMAGE_TAG ?= latest
14+ # Image URL to use all building/pushing image targets
15+ IMAGE ?= $(IMAGE_REPOSITORY ) :$(IMAGE_TAG )
16+
1117# CONTAINER_TOOL defines the container tool to be used for building images.
1218# Be aware that the target commands are only tested with Docker which is
1319# scaffolded by default. However, you might want to replace it to use other
@@ -117,11 +123,11 @@ run: manifests generate fmt vet ## Run a controller from your host.
117123# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
118124.PHONY : docker-build
119125docker-build : # # Build docker image with the manager.
120- $(CONTAINER_TOOL ) build -t ${IMG } .
126+ $(CONTAINER_TOOL ) build -t ${IMAGE } .
121127
122128.PHONY : docker-push
123129docker-push : # # Push docker image with the manager.
124- $(CONTAINER_TOOL ) push ${IMG }
130+ $(CONTAINER_TOOL ) push ${IMAGE }
125131
126132# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
127133# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -136,14 +142,14 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
136142 sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
137143 - $(CONTAINER_TOOL ) buildx create --name cron-operator-builder
138144 $(CONTAINER_TOOL ) buildx use cron-operator-builder
139- - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG } -f Dockerfile.cross .
145+ - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMAGE } -f Dockerfile.cross .
140146 - $(CONTAINER_TOOL ) buildx rm cron-operator-builder
141147 rm Dockerfile.cross
142148
143149.PHONY : build-installer
144150build-installer : manifests generate kustomize # # Generate a consolidated YAML with CRDs and deployment.
145151 mkdir -p dist
146- cd config/manager && " $( KUSTOMIZE) " edit set image controller=${IMG }
152+ cd config/manager && " $( KUSTOMIZE) " edit set image controller=${IMAGE }
147153 " $( KUSTOMIZE) " build config/default > dist/install.yaml
148154
149155# #@ Helm
@@ -174,7 +180,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
174180
175181.PHONY : deploy
176182deploy : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
177- cd config/manager && " $( KUSTOMIZE) " edit set image controller=${IMG }
183+ cd config/manager && " $( KUSTOMIZE) " edit set image controller=${IMAGE }
178184 " $( KUSTOMIZE) " build config/default | " $( KUBECTL) " apply -f -
179185
180186.PHONY : undeploy
0 commit comments