Skip to content

Commit 0d26a04

Browse files
authored
Merge pull request #291 from chrisdoherty4/feature/rework-makefile
Rework the Makefile to separate tilt commands
2 parents 9445277 + e000bea commit 0d26a04

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,23 @@ docker-push: .dockerflag.mk ## Push docker image with the manager.
229229
## --------------------------------------
230230

231231
.PHONY: tilt-up
232-
tilt-up: cluster-api kind-cluster cluster-api/tilt-settings.json generate-manifests ## Setup and run tilt for development.
232+
tilt-up: cluster-api create-kind-cluster cluster-api/tilt-settings.json generate-manifests ## Setup and run tilt for development.
233233
cd cluster-api && tilt up
234234

235-
.PHONY: kind-cluster
236-
kind-cluster: cluster-api ## Create a kind cluster with a local Docker repository.
237-
./cluster-api/hack/kind-install-for-capd.sh
235+
KIND_CLUSTER_NAME := $(shell cat ./hack/tilt-settings.json | grep kind_cluster_name | cut -d: -f2 | xargs)
236+
237+
.PHONY: create-kind-cluster
238+
create-kind-cluster: cluster-api cluster-api/tilt-settings.json ## Create a kind cluster with a local Docker repository.
239+
@if [ -z "$$(kind get clusters | grep $(KIND_CLUSTER_NAME))" ]; then \
240+
CAPI_KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ./cluster-api/hack/kind-install-for-capd.sh; \
241+
fi;
242+
243+
.PHONY: delete-kind-cluster
244+
delete-kind-cluster:
245+
kind delete cluster --name $(KIND_CLUSTER_NAME)
238246

239247
cluster-api: ## Clone cluster-api repository for tilt use.
240-
git clone --branch v1.2.12 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
248+
git clone --branch v1.3.9 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
241249

242250
cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
243251
cp ./hack/tilt-settings.json cluster-api
@@ -277,7 +285,7 @@ e2e-cluster-templates: $(CLUSTER_TEMPLATES_OUTPUT_FILES) ## Generate cluster tem
277285
cluster-template%yaml: $(KUSTOMIZE) $(CLUSTER_TEMPLATES_INPUT_FILES)
278286
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone $(basename $@) > $@
279287

280-
e2e-essentials: $(GINKGO_V1) $(KUBECTL) e2e-cluster-templates kind-cluster ## Fulfill essential tasks for e2e testing.
288+
e2e-essentials: $(GINKGO_V1) $(KUBECTL) e2e-cluster-templates create-kind-cluster ## Fulfill essential tasks for e2e testing.
281289
IMG=$(IMG_LOCAL) make generate-manifests docker-build docker-push
282290

283291
JOB ?= .*

0 commit comments

Comments
 (0)