Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Check cluster is running for non-standalone Make targets #437

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ FOCUS := $(if $(TEST),-v -focus "$(TEST)")
ifeq ($(origin E2E_FLAGS), undefined)
E2E_FLAGS :=
endif
test-e2e: $(GINKGO) ## Run the e2e tests
test-e2e: check-cluster $(GINKGO) ## Run the e2e tests on existing cluster
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) test/e2e

e2e: KIND_CLUSTER_NAME := catalogd-e2e
Expand Down Expand Up @@ -214,12 +214,12 @@ kind-cluster-cleanup: $(KIND) ## Delete the kind cluster
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)

.PHONY: kind-load
kind-load: $(KIND) ## Load the built images onto the local cluster
kind-load: check-cluster $(KIND) ## Load the built images onto the local cluster
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME)
$(KIND) load docker-image $(IMAGE) --name $(KIND_CLUSTER_NAME)

.PHONY: install
install: build-container kind-load deploy wait ## Install local catalogd
install: check-cluster build-container kind-load deploy wait ## Install local catalogd to an existing cluster

.PHONY: deploy
deploy: export MANIFEST="./catalogd.yaml"
Expand All @@ -229,7 +229,7 @@ deploy: $(KUSTOMIZE) ## Deploy Catalogd to the K8s cluster specified in ~/.kube/
$(KUSTOMIZE) build $(KUSTOMIZE_OVERLAY) | sed "s/cert-git-version/cert-$(GIT_VERSION)/g" > catalogd.yaml
envsubst '$$CERT_MGR_VERSION,$$MANIFEST,$$DEFAULT_CATALOGS' < scripts/install.tpl.sh | bash -s

.PHONY: only-deploy-manifest
.PHONY: check-cluster only-deploy-manifest
only-deploy-manifest: $(KUSTOMIZE) ## Deploy just the Catalogd manifest--used in e2e testing where cert-manager is installed in a separate step
cd config/base/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE)
$(KUSTOMIZE) build $(KUSTOMIZE_OVERLAY) | kubectl apply -f -
Expand Down Expand Up @@ -267,3 +267,10 @@ quickstart: $(KUSTOMIZE) generate ## Generate the installation release manifests
.PHONY: demo-update
demo-update:
hack/scripts/generate-asciidemo.sh

.PHONY: check-cluster
check-cluster:
if ! kubectl config current-context >/dev/null 2>&1; then \
echo "Error: Could not get current Kubernetes context. Maybe use 'run' or 'e2e' targets first?"; \
exit 1; \
fi
bentito marked this conversation as resolved.
Show resolved Hide resolved