|
14 | 14 | # Be aware that the target commands are only tested with Docker which is
|
15 | 15 | # scaffolded by default. However, you might want to replace it to use other
|
16 | 16 | # tools. (i.e. podman)
|
17 |
| -CONTAINER_TOOL ?= docker |
| 17 | +CONTAINER_TOOL ?= podman |
18 | 18 |
|
19 | 19 | # Setting SHELL to bash allows bash commands to be executed by recipes.
|
20 | 20 | # Options are set to exit when a recipe line exits non-zero or a piped command fails.
|
@@ -63,6 +63,37 @@ vet: ## Run go vet against code.
|
63 | 63 | test: manifests generate fmt vet envtest ## Run tests.
|
64 | 64 | KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
|
65 | 65 |
|
| 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 | + |
66 | 97 | # The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
|
67 | 98 | # Prometheus and CertManager are installed by default; skip with:
|
68 | 99 | # - PROMETHEUS_INSTALL_SKIP=true
|
|
0 commit comments