Skip to content

Commit 98104b1

Browse files
committed
feat(makefile): allow configuring Kind cluster name for e2e tests
Introduce the `KIND_CLUSTER_NAME` variable to allow running e2e tests on Kind clusters with custom names. The Makefile now checks for an active cluster using the configured `KIND_CLUSTER_NAME` instead of assuming the default 'kind'. This improves flexibility for users running multiple Kind clusters.
1 parent 4c0b8d6 commit 98104b1

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6969
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
7070
# CertManager is installed by default; skip with:
7171
# - CERT_MANAGER_INSTALL_SKIP=true
72+
KIND_CLUSTER_NAME ?= kind
7273
.PHONY: test-e2e
7374
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7475
@command -v kind >/dev/null 2>&1 || { \
7576
echo "Kind is not installed. Please install Kind manually."; \
7677
exit 1; \
7778
}
78-
@kind get clusters | grep -q 'kind' || { \
79+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7980
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8081
exit 1; \
8182
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666
# CertManager is installed by default; skip with:
6767
# - CERT_MANAGER_INSTALL_SKIP=true
68+
KIND_CLUSTER_NAME ?= kind
6869
.PHONY: test-e2e
6970
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7071
@command -v kind >/dev/null 2>&1 || { \
7172
echo "Kind is not installed. Please install Kind manually."; \
7273
exit 1; \
7374
}
74-
@kind get clusters | grep -q 'kind' || { \
75+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7576
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7677
exit 1; \
7778
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6969
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
7070
# CertManager is installed by default; skip with:
7171
# - CERT_MANAGER_INSTALL_SKIP=true
72+
KIND_CLUSTER_NAME ?= kind
7273
.PHONY: test-e2e
7374
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7475
@command -v kind >/dev/null 2>&1 || { \
7576
echo "Kind is not installed. Please install Kind manually."; \
7677
exit 1; \
7778
}
78-
@kind get clusters | grep -q 'kind' || { \
79+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7980
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8081
exit 1; \
8182
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
144144
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
145145
# CertManager is installed by default; skip with:
146146
# - CERT_MANAGER_INSTALL_SKIP=true
147+
KIND_CLUSTER_NAME ?= kind
147148
.PHONY: test-e2e
148149
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
149150
@command -v kind >/dev/null 2>&1 || { \
150151
echo "Kind is not installed. Please install Kind manually."; \
151152
exit 1; \
152153
}
153-
@kind get clusters | grep -q 'kind' || { \
154+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
154155
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
155156
exit 1; \
156157
}

testdata/project-v4-multigroup/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666
# CertManager is installed by default; skip with:
6767
# - CERT_MANAGER_INSTALL_SKIP=true
68+
KIND_CLUSTER_NAME ?= kind
6869
.PHONY: test-e2e
6970
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7071
@command -v kind >/dev/null 2>&1 || { \
7172
echo "Kind is not installed. Please install Kind manually."; \
7273
exit 1; \
7374
}
74-
@kind get clusters | grep -q 'kind' || { \
75+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7576
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7677
exit 1; \
7778
}

testdata/project-v4-with-plugins/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666
# CertManager is installed by default; skip with:
6767
# - CERT_MANAGER_INSTALL_SKIP=true
68+
KIND_CLUSTER_NAME ?= kind
6869
.PHONY: test-e2e
6970
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7071
@command -v kind >/dev/null 2>&1 || { \
7172
echo "Kind is not installed. Please install Kind manually."; \
7273
exit 1; \
7374
}
74-
@kind get clusters | grep -q 'kind' || { \
75+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7576
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7677
exit 1; \
7778
}

testdata/project-v4/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666
# CertManager is installed by default; skip with:
6767
# - CERT_MANAGER_INSTALL_SKIP=true
68+
KIND_CLUSTER_NAME ?= kind
6869
.PHONY: test-e2e
6970
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
7071
@command -v kind >/dev/null 2>&1 || { \
7172
echo "Kind is not installed. Please install Kind manually."; \
7273
exit 1; \
7374
}
74-
@kind get clusters | grep -q 'kind' || { \
75+
@kind get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
7576
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7677
exit 1; \
7778
}

0 commit comments

Comments
 (0)