Skip to content

Commit 3b2ca1b

Browse files
authored
Merge pull request #18 from RobotSail/update-makefile
fix up the Makefile
2 parents 2ef9b05 + 77cf2ff commit 3b2ca1b

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

Makefile

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
4040
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
4141
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
4242

43+
# Sets the versioning for our tool
44+
CONTROLLER_TOOLS_VERSION := v0.8.0
45+
KUSTOMIZE_VERSION := v4.5.5
46+
KUSTOMIZE_MAJOR := v4
47+
4348
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
4449
# You can enable this value if you would like to use SHA Based Digests
4550
# To enable set flag to true
@@ -146,25 +151,39 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
146151
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
147152

148153
.PHONY: deploy
149-
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
154+
deploy: manifests kustomize controller-gen ## Deploy controller to the K8s cluster specified in ~/.kube/config.
150155
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
151156
$(KUSTOMIZE) build config/default | kubectl apply -f -
152157

153158
.PHONY: undeploy
154159
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
155160
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
156161

157-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
162+
## Location to install dependencies to
163+
LOCALBIN ?= $(shell pwd)/bin
164+
$(LOCALBIN):
165+
@echo "🤖 Ensuring $(LOCALBIN) is available"
166+
mkdir -p $(LOCALBIN)
167+
@echo "✅ Done"
168+
169+
158170
.PHONY: controller-gen
159-
controller-gen: ## Download controller-gen locally if necessary.
160-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
171+
CONTROLLER_GEN = $(LOCALBIN)/controller-gen
172+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
173+
$(CONTROLLER_GEN): $(LOCALBIN)
174+
@ echo "📥 Downloading controller-gen"
175+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
176+
@ echo "✅ Done"
161177

162-
KUSTOMIZE = $(shell pwd)/bin/kustomize
163178
.PHONY: kustomize
164-
kustomize: ## Download kustomize locally if necessary.
165-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)
166-
167-
ENVTEST = $(shell pwd)/bin/setup-envtest
179+
KUSTOMIZE = $(LOCALBIN)/kustomize
180+
kustomize: $(KUSTOMIZE)## Download kustomize locally if necessary.
181+
$(KUSTOMIZE): $(LOCALBIN)
182+
@ echo "📥 Downloading kustomize"
183+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/kustomize/kustomize/$(KUSTOMIZE_MAJOR)@$(KUSTOMIZE_VERSION)
184+
@ echo "✅ Done"
185+
186+
ENVTEST = $(LOCALBIN)/setup-envtest
168187
.PHONY: envtest
169188
envtest: ## Download envtest-setup locally if necessary.
170189
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
@@ -254,3 +273,4 @@ KUTTL := $(PROJECT_DIR)/bin/kuttl
254273
KUTTL_URL := https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_linux_x86_64
255274
kuttl: ## Download kuttl
256275
$(call download-tool,$(KUTTL),$(KUTTL_URL))
276+

0 commit comments

Comments
 (0)