Skip to content

Commit ed7ab94

Browse files
committed
add make kind-xxx
1 parent 02ee248 commit ed7ab94

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

Makefile

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ ENVTEST_K8S_VERSION = 1.26.1
1111
LOCALBIN ?= $(shell pwd)/bin
1212
export PATH := $(abspath $(LOCALBIN)):$(PATH)
1313

14+
## Location to install dependencies to
15+
$(LOCALBIN):
16+
mkdir -p $(LOCALBIN)
17+
18+
## Tool Binaries
19+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
20+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
21+
ENVTEST ?= $(LOCALBIN)/setup-envtest
22+
ENVSUBST ?= $(LOCALBIN)/envsubst
23+
KUBECTL ?= $(LOCALBIN)/kubectl
24+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
25+
GOIMPORTS ?= $(LOCALBIN)/goimports
26+
TILT ?= $(LOCALBIN)/tilt
27+
KIND ?= $(LOCALBIN)/kind
28+
29+
## Tool Versions
30+
KUSTOMIZE_VERSION ?= v5.0.0
31+
CONTROLLER_TOOLS_VERSION ?= v0.11.3
32+
ENVSUBST_VER ?= v1.4.2
33+
KUBECTL_VER := v1.25.10
34+
TILT_VER := 0.33.6
35+
KIND_VER := v0.20.0
36+
1437
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1538
ifeq (,$(shell go env GOBIN))
1639
GOBIN=$(shell go env GOPATH)/bin
@@ -72,14 +95,24 @@ lint: golangci-lint ## Run golangci-lint
7295
KIND_CLUSTER_NAME := cappx
7396
.PHONY: kind-cluster
7497
kind-cluster: kind
75-
kind create cluster --name=$(KIND_CLUSTER_NAME)
98+
@if kind get nodes --name=$(KIND_CLUSTER_NAME) | grep -q cappx; then \
99+
echo "kind cluster $(KIND_CLUSTER_NAME) already exists"; \
100+
else \
101+
kind create cluster --name=$(KIND_CLUSTER_NAME); \
102+
fi
103+
104+
.PHONY: kind-delete-cluster
105+
kind-delete-cluster: kind
106+
@if kind get nodes --name=$(KIND_CLUSTER_NAME) | grep -q cappx; then \
107+
kind delete cluster --name=$(KIND_CLUSTER_NAME); \
108+
fi
76109

77110
.PHONY: tilt-up
78-
tilt-up: tilt
111+
tilt-up: tilt kind-cluster envsubst kustomize
79112
$(TILT) up
80113

81114
.PHONY: tilt-down
82-
tilt-down: tilt
115+
tilt-down: tilt envsubst kustomize
83116
$(TILT) down
84117

85118
CLUSTER_NAME := cappx-test
@@ -235,29 +268,6 @@ release-templates: $(RELEASE_DIR)
235268

236269
##@ Build Dependencies
237270

238-
## Location to install dependencies to
239-
$(LOCALBIN):
240-
mkdir -p $(LOCALBIN)
241-
242-
## Tool Binaries
243-
KUSTOMIZE ?= $(LOCALBIN)/kustomize
244-
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
245-
ENVTEST ?= $(LOCALBIN)/setup-envtest
246-
ENVSUBST ?= $(LOCALBIN)/envsubst
247-
KUBECTL ?= $(LOCALBIN)/kubectl
248-
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
249-
GOIMPORTS ?= $(LOCALBIN)/goimports
250-
TILT ?= $(LOCALBIN)/tilt
251-
KIND ?= $(LOCALBIN)/kind
252-
253-
## Tool Versions
254-
KUSTOMIZE_VERSION ?= v5.0.0
255-
CONTROLLER_TOOLS_VERSION ?= v0.11.3
256-
ENVSUBST_VER ?= v1.4.2
257-
KUBECTL_VER := v1.25.10
258-
TILT_VER := 0.33.6
259-
KIND_VER := v0.20.0
260-
261271
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
262272
.PHONY: kustomize
263273
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.

0 commit comments

Comments
 (0)