-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Make Kind Cluster Name Configurable for E2E Tests #4617
base: master
Are you sure you want to change the base?
🐛 Make Kind Cluster Name Configurable for E2E Tests #4617
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kersten The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @kersten. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@@ -69,13 +69,14 @@ test: manifests generate fmt vet setup-envtest ## Run tests. | |||
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally. | |||
# CertManager is installed by default; skip with: | |||
# - CERT_MANAGER_INSTALL_SKIP=true | |||
KIND_CLUSTER_NAME ?= kind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, we would need to create the cluster name
That would mean that this specific cluster must exist to run the tests, so I think we cannot move forward with this one without having a target with a setup for the e2e tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we create the cluster? This change simply extracts the hardcoded kind
cluster name into a variable, allowing it to be set dynamically.
Our use case: We create separate Kind clusters for each operator to enable isolated testing. However, the current make test-e2e
target fails because it only checks for a cluster named kind
, rather than the actual cluster we are using (e.g., kind-example-cluster
). By making the cluster name configurable, we ensure the e2e tests can run in any Kind cluster we specify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decide to create a cluster name, we should also have a target for it, like setup-e2e-test, so that we can call it here. That’s the point I’m trying to make. 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure if I got your point. Do you mean something like:
.PHONY: setup-e2e-test
setup-e2e-test: ## Set up a Kind cluster for e2e tests if it does not exist
@$(KIND) get clusters | grep -q '$(KIND_CLUSTER_NAME)' || { \
echo "Creating Kind cluster: $(KIND_CLUSTER_NAME)"; \
$(KIND) create cluster --name $(KIND_CLUSTER_NAME); \
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe creating a Kind cluster should be outside the scope of this PR. While we agree that having such a target would be valuable for generalizing multiple projects, this PR specifically focuses on making the Kind cluster name configurable.
The current logic implicitly assumes the cluster name is "kind", and this change simply makes that explicit. It remains fully backward compatible since the default cluster name is still set to "kind", ensuring no disruption to existing workflows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kersten,
We cannot modify the targets to force users to use a cluster name that isn't configured by the Makefile targets. If we move forward with it, it will fail when we make test-e2e, right? (indeed it will probably fail in the ci)
While I might think that we're moving in the right direction by introducing a test-e2e-setup
target to create the cluster name and then referencing it here, we need to make these changes as part of a dedicated PR. This will allow us to propose the full implementation, validate everything, and ensure it's properly handled before proceeding. we will need to ensure that it is the right direction to change the full scaffolds.
These changes are particularly sensitive (see for example - check the latest comment #4391), so we must approach scaffold modifications carefully. Once merged, any subsequent release could include this change, making it critical to get it right from the start.
So, let’s ensure everything is in place before moving forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point now. The default case would work fine, but it would fail if a different cluster name is used. I'll make the necessary changes.
98104b1
to
bc64f91
Compare
/ok-to-test |
@@ -69,17 +69,18 @@ test: manifests generate fmt vet setup-envtest ## Run tests. | |||
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have just one commit with all changes?
We have a policy that is to ensure that we have a good history and each PR has just one purpose. ( 1 PR one goal/need/fix addressed )
Introduce the `KIND_CLUSTER` 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` instead of assuming the default 'kind'. This improves flexibility for users running multiple Kind clusters.
78e009f
to
5f60baf
Compare
Description
This PR introduces the
KIND_CLUSTER
variable in the Makefile, allowing users to specify a custom Kind cluster name when running end-to-end (e2e) tests.Previously, the Makefile assumed that the Kind cluster was named kind, which limited flexibility for users managing multiple Kind clusters. With this change, the cluster name is configurable, making the e2e test setup more dynamic.
Motivation
Changes
KIND_CLUSTER
variable (defaults to kind if not set).$(KIND_CLUSTER)
instead of assuming kind.