@@ -63,6 +63,37 @@ vet: ## Run go vet against code.
6363test : manifests generate fmt vet envtest # # Run tests.
6464 KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test $$(go list ./... | grep -v /e2e ) -coverprofile cover.out
6565
66+ # Sets up a local Kubernetes cluster using Kind.
67+ # By default:
68+ # - The cluster name is read from the `name:` field in the Kind config file (CONFIG_FILE).
69+ # - cert-manager is installed automatically.
70+ # - metrics-server is installed automatically (can be disabled).
71+ # Variables you can override:
72+ # - CONFIG_FILE: Path to your Kind config file.
73+ # - CLUSTER_NAME: Cluster name (overrides the name from the config file).
74+ # - INSTALL_METRICS_SERVER: Set to false to skip metrics-server installation.
75+ # Usage examples:
76+ # make setup-kind-cluster
77+ # make setup-kind-cluster CONFIG_FILE=utils/configs/my-config.yaml
78+ # make setup-kind-cluster CLUSTER_NAME=my-cluster
79+ # make setup-kind-cluster INSTALL_METRICS_SERVER=false
80+ INSTALL_METRICS_SERVER ?= true
81+ CONFIG_FILE := utils/configs/kind-notebooks-config.yaml
82+ DEFAULT_CLUSTER_NAME := $(shell grep '^name:' $(CONFIG_FILE ) | awk '{print $$2}')
83+ CLUSTER_NAME ?= $(DEFAULT_CLUSTER_NAME )
84+ .PHONY : setup-kind-cluster
85+ setup-kind-cluster :
86+ KIND_EXPERIMENTAL_PROVIDER=$(CONTAINER_TOOL ) kind delete cluster --name $(CLUSTER_NAME ) || true
87+ KIND_EXPERIMENTAL_PROVIDER=$(CONTAINER_TOOL ) kind create cluster --name $(CLUSTER_NAME ) --config=$(CONFIG_FILE )
88+ ./utils/scripts/install_cert_manager.sh
89+ ifeq ($(INSTALL_METRICS_SERVER ) ,true)
90+ ./utils/scripts/install_metrics_server.sh
91+ else
92+ @echo "--- Skipping metrics-server installation (INSTALL_METRICS_SERVER set to $(INSTALL_METRICS_SERVER)) ---"
93+ endif
94+ @echo "--- Setting the current context to $(CLUSTER_NAME) cluster ---"
95+ kubectl config set-context kind-$(CLUSTER_NAME) --namespace=workspace-controller-system
96+
6697# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6798# Prometheus and CertManager are installed by default; skip with:
6899# - PROMETHEUS_INSTALL_SKIP=true
0 commit comments