Skip to content

Commit f1877f7

Browse files
committed
refactor(makefile): update Kind integration in Makefile templates
Remove the hardcoded Kind version and related logic from Makefile templates. Introduce a variable for the Kind binary in e2e tests to allow using Kind installations located outside of $PATH.
1 parent 4c0b8d6 commit f1877f7

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
7171
# - CERT_MANAGER_INSTALL_SKIP=true
7272
.PHONY: test-e2e
7373
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
74-
@command -v kind >/dev/null 2>&1 || { \
74+
@command -v $(KIND) >/dev/null 2>&1 || { \
7575
echo "Kind is not installed. Please install Kind manually."; \
7676
exit 1; \
7777
}
78-
@kind get clusters | grep -q 'kind' || { \
78+
@$(KIND) get clusters | grep -q 'kind' || { \
7979
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8080
exit 1; \
8181
}
@@ -169,6 +169,7 @@ $(LOCALBIN):
169169

170170
## Tool Binaries
171171
KUBECTL ?= kubectl
172+
KIND ?= kind
172173
KUSTOMIZE ?= $(LOCALBIN)/kustomize
173174
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
174175
ENVTEST ?= $(LOCALBIN)/setup-envtest

docs/book/src/getting-started/testdata/project/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6767
# - CERT_MANAGER_INSTALL_SKIP=true
6868
.PHONY: test-e2e
6969
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
70-
@command -v kind >/dev/null 2>&1 || { \
70+
@command -v $(KIND) >/dev/null 2>&1 || { \
7171
echo "Kind is not installed. Please install Kind manually."; \
7272
exit 1; \
7373
}
74-
@kind get clusters | grep -q 'kind' || { \
74+
@$(KIND) get clusters | grep -q 'kind' || { \
7575
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7676
exit 1; \
7777
}
@@ -165,6 +165,7 @@ $(LOCALBIN):
165165

166166
## Tool Binaries
167167
KUBECTL ?= kubectl
168+
KIND ?= kind
168169
KUSTOMIZE ?= $(LOCALBIN)/kustomize
169170
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170171
ENVTEST ?= $(LOCALBIN)/setup-envtest

docs/book/src/multiversion-tutorial/testdata/project/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
7171
# - CERT_MANAGER_INSTALL_SKIP=true
7272
.PHONY: test-e2e
7373
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
74-
@command -v kind >/dev/null 2>&1 || { \
74+
@command -v $(KIND) >/dev/null 2>&1 || { \
7575
echo "Kind is not installed. Please install Kind manually."; \
7676
exit 1; \
7777
}
78-
@kind get clusters | grep -q 'kind' || { \
78+
@$(KIND) get clusters | grep -q 'kind' || { \
7979
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8080
exit 1; \
8181
}
@@ -169,6 +169,7 @@ $(LOCALBIN):
169169

170170
## Tool Binaries
171171
KUBECTL ?= kubectl
172+
KIND ?= kind
172173
KUSTOMIZE ?= $(LOCALBIN)/kustomize
173174
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
174175
ENVTEST ?= $(LOCALBIN)/setup-envtest

pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
146146
# - CERT_MANAGER_INSTALL_SKIP=true
147147
.PHONY: test-e2e
148148
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
149-
@command -v kind >/dev/null 2>&1 || { \
149+
@command -v $(KIND) >/dev/null 2>&1 || { \
150150
echo "Kind is not installed. Please install Kind manually."; \
151151
exit 1; \
152152
}
153-
@kind get clusters | grep -q 'kind' || { \
153+
@$(KIND) get clusters | grep -q 'kind' || { \
154154
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
155155
exit 1; \
156156
}
@@ -244,6 +244,7 @@ $(LOCALBIN):
244244
245245
## Tool Binaries
246246
KUBECTL ?= kubectl
247+
KIND ?= kind
247248
KUSTOMIZE ?= $(LOCALBIN)/kustomize
248249
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
249250
ENVTEST ?= $(LOCALBIN)/setup-envtest

testdata/project-v4-multigroup/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6767
# - CERT_MANAGER_INSTALL_SKIP=true
6868
.PHONY: test-e2e
6969
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
70-
@command -v kind >/dev/null 2>&1 || { \
70+
@command -v $(KIND) >/dev/null 2>&1 || { \
7171
echo "Kind is not installed. Please install Kind manually."; \
7272
exit 1; \
7373
}
74-
@kind get clusters | grep -q 'kind' || { \
74+
@$(KIND) get clusters | grep -q 'kind' || { \
7575
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7676
exit 1; \
7777
}
@@ -165,6 +165,7 @@ $(LOCALBIN):
165165

166166
## Tool Binaries
167167
KUBECTL ?= kubectl
168+
KIND ?= kind
168169
KUSTOMIZE ?= $(LOCALBIN)/kustomize
169170
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170171
ENVTEST ?= $(LOCALBIN)/setup-envtest

testdata/project-v4-with-plugins/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6767
# - CERT_MANAGER_INSTALL_SKIP=true
6868
.PHONY: test-e2e
6969
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
70-
@command -v kind >/dev/null 2>&1 || { \
70+
@command -v $(KIND) >/dev/null 2>&1 || { \
7171
echo "Kind is not installed. Please install Kind manually."; \
7272
exit 1; \
7373
}
74-
@kind get clusters | grep -q 'kind' || { \
74+
@$(KIND) get clusters | grep -q 'kind' || { \
7575
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7676
exit 1; \
7777
}
@@ -165,6 +165,7 @@ $(LOCALBIN):
165165

166166
## Tool Binaries
167167
KUBECTL ?= kubectl
168+
KIND ?= kind
168169
KUSTOMIZE ?= $(LOCALBIN)/kustomize
169170
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170171
ENVTEST ?= $(LOCALBIN)/setup-envtest

testdata/project-v4/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6767
# - CERT_MANAGER_INSTALL_SKIP=true
6868
.PHONY: test-e2e
6969
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
70-
@command -v kind >/dev/null 2>&1 || { \
70+
@command -v $(KIND) >/dev/null 2>&1 || { \
7171
echo "Kind is not installed. Please install Kind manually."; \
7272
exit 1; \
7373
}
74-
@kind get clusters | grep -q 'kind' || { \
74+
@$(KIND) get clusters | grep -q 'kind' || { \
7575
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7676
exit 1; \
7777
}
@@ -165,6 +165,7 @@ $(LOCALBIN):
165165

166166
## Tool Binaries
167167
KUBECTL ?= kubectl
168+
KIND ?= kind
168169
KUSTOMIZE ?= $(LOCALBIN)/kustomize
169170
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170171
ENVTEST ?= $(LOCALBIN)/setup-envtest

0 commit comments

Comments
 (0)