diff --git a/Makefile b/Makefile index f84d533..588c2cd 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,33 @@ GHCR_PACKAGES_PUBLIC ?= false .DEFAULT_GOAL := help -.PHONY: help create install dev upgrade upgrade-dev uninstall cleanup delete test test-cleanup check-pre-commit check-helm-docs setup-pre-commit docs docs-check lint floci setup-local-registry cleanup-local-registry flush-local-registry setup-kind load-test-images prepare-test-e2e helm-test cleanup-test-e2e +.PHONY: \ + help \ + check-pre-commit \ + check-helm-docs \ + setup-pre-commit \ + docs \ + docs-check \ + lint \ + create \ + delete \ + floci \ + install \ + dev \ + upgrade \ + upgrade-dev \ + uninstall \ + cleanup \ + test \ + test-cleanup \ + prepare-test-e2e \ + setup-local-registry \ + setup-kind \ + load-test-images \ + helm-test \ + flush-local-registry \ + cleanup-test-e2e \ + cleanup-local-registry help: ## Show this help message @printf '\033[33m%s\n' \ @@ -37,14 +63,10 @@ help: ## Show this help message '|_| |___|_| \_\_____|____/ \___/|_____| |_| ' @printf '\033[0m\n' @awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m\033[0m\n\nTargets:\n"} \ - /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) + /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } \ + /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) -check-pre-commit: ## Verify that pre-commit is installed - @command -v pre-commit >/dev/null 2>&1 || { \ - echo "Error: pre-commit is not installed."; \ - echo "Install it from https://github.com/pre-commit/pre-commit"; \ - exit 1; \ - } +##@ Tooling check-helm-docs: ## Verify that helm-docs is installed @command -v helm-docs >/dev/null 2>&1 || { \ @@ -53,24 +75,42 @@ check-helm-docs: ## Verify that helm-docs is installed exit 1; \ } +check-pre-commit: ## Verify that pre-commit is installed + @command -v pre-commit >/dev/null 2>&1 || { \ + echo "Error: pre-commit is not installed."; \ + echo "Install it from https://github.com/pre-commit/pre-commit"; \ + exit 1; \ + } + setup-pre-commit: check-pre-commit check-helm-docs ## Install pre-commit hooks for this repo pre-commit install pre-commit install-hooks +##@ Docs + docs: check-helm-docs ## Regenerate chart documentation with helm-docs helm-docs --chart-search-root=helm docs-check: ## Validate Mintlify docs navigation (path depth and lost pages) $(MAKE) -C docs check +##@ Lint + lint: ## Lint and template-render the helm chart helm lint --strict $(CHART) helm template $(RELEASE) $(CHART) > /dev/null @echo "All helm checks passed." +##@ Local kind cluster (single-node dev) + create: ## Create a local kind cluster kind create cluster +delete: ## Delete the local kind cluster + kind delete cluster + +##@ Release lifecycle (install / upgrade / uninstall) + floci: ## Deploy floci S3 emulator + create the engine's managed_storage bucket in $(NAMESPACE) kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f - kubectl apply -n $(NAMESPACE) -f local-floci.yaml @@ -99,9 +139,23 @@ cleanup: ## Uninstall the release, delete PVCs, and remove the namespace kubectl delete pvc --namespace $(NAMESPACE) --all --ignore-not-found kubectl delete namespace $(NAMESPACE) --ignore-not-found +##@ Helm tests (against the installed release) + test: ## Run helm tests against the installed release helm test $(RELEASE) --namespace $(NAMESPACE) --logs +test-cleanup: ## Delete leftover helm test pods from previous runs + @pods=$$(kubectl get pods -n $(NAMESPACE) -o name 2>/dev/null | grep "^pod/$(RELEASE)-test-" || true); \ + if [ -z "$$pods" ]; then \ + echo "No stale test pods found."; \ + else \ + echo "$$pods" | xargs kubectl delete -n $(NAMESPACE); \ + fi + +##@ E2E quickstart pipeline + +prepare-test-e2e: setup-kind load-test-images ## Full e2e setup: start the registry, create the kind cluster, publish images + setup-local-registry: ## Start the local Docker registry the kind node mirrors through (idempotent) @if [ "$(GHCR_PACKAGES_PUBLIC)" = "true" ]; then \ echo "GHCR_PACKAGES_PUBLIC=true: skipping local registry (kind nodes pull images directly)."; \ @@ -109,12 +163,6 @@ setup-local-registry: ## Start the local Docker registry the kind node mirrors t REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) ./scripts/ci/setup-local-registry.sh; \ fi -cleanup-local-registry: ## Stop and remove the local Docker registry container (cached images are lost) - @docker rm -f $(REGISTRY_NAME) >/dev/null 2>&1 || true - @echo "Removed local registry '$(REGISTRY_NAME)' (if it existed). Re-run 'make setup-local-registry' to recreate." - -flush-local-registry: cleanup-local-registry setup-local-registry ## Recreate the local registry from scratch (drops cached images) - setup-kind: setup-local-registry ## Create (or reuse) the e2e kind cluster and wire it to the local registry @NODE_IMAGE='$(NODE_IMAGE)' REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) GHCR_PACKAGES_PUBLIC=$(GHCR_PACKAGES_PUBLIC) ./scripts/ci/setup-kind-cluster.sh $(KIND_CLUSTER) @@ -125,21 +173,14 @@ load-test-images: ## Pull the chart + floci images and push them into the local REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) ./scripts/ci/load-e2e-images.sh $(KIND_CLUSTER); \ fi -prepare-test-e2e: setup-kind load-test-images ## Full e2e setup: start the registry, create the kind cluster, publish images - helm-test: ## Run the quickstart end-to-end check against the current cluster (run prepare-test-e2e first) NAMESPACE=$(NAMESPACE) RELEASE=$(RELEASE) CHART_DIR=$(CHART) ./scripts/ci/helm-test.sh +flush-local-registry: cleanup-local-registry setup-local-registry ## Recreate the local registry from scratch (drops cached images) + cleanup-test-e2e: ## Tear down the e2e kind cluster (the local registry is left running; use flush-local-registry to drop it) kind delete cluster --name $(KIND_CLUSTER) -test-cleanup: ## Delete leftover helm test pods from previous runs - @pods=$$(kubectl get pods -n $(NAMESPACE) -o name 2>/dev/null | grep "^pod/$(RELEASE)-test-" || true); \ - if [ -z "$$pods" ]; then \ - echo "No stale test pods found."; \ - else \ - echo "$$pods" | xargs kubectl delete -n $(NAMESPACE); \ - fi - -delete: ## Delete the local kind cluster - kind delete cluster +cleanup-local-registry: ## Stop and remove the local Docker registry container (cached images are lost) + @docker rm -f $(REGISTRY_NAME) >/dev/null 2>&1 || true + @echo "Removed local registry '$(REGISTRY_NAME)' (if it existed). Re-run 'make setup-local-registry' to recreate." diff --git a/README.md b/README.md index a7fd764..f2450f0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ For more detailed information checkout our [official documentation](https://docs ## Scope -The chart deploys a complete Firebolt Instance consistingo of a Gateway (Envoy), Metadata Service, PostgreSQL and Firebolt Engines into any Kubernetes cluster. For day-2 operational capabilities (zero-downtime engine rollouts, autoscaling, drift correction, reusable per-engine templates), take a look at the [Firebolt Kubernetes Operator](https://github.com/firebolt-db/firebolt-kubernetes-operator). +The chart deploys a complete Firebolt Instance consisting of a Gateway (Envoy), Metadata Service, PostgreSQL and Firebolt Engines into any Kubernetes cluster. For day-2 operational capabilities (zero-downtime engine rollouts, autoscaling, drift correction, reusable per-engine templates), take a look at the [Firebolt Kubernetes Operator](https://github.com/firebolt-db/firebolt-kubernetes-operator). ## Architecture