Skip to content

✨ feat(makefile): add setup test e2e targets #4876

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kersten
Copy link
Contributor

@kersten kersten commented Jun 19, 2025

Currently, the test-e2e target in the Kubebuilder Makefile template hardcodes a single workflow: setup the Kind cluster and immediately run the end-to-end tests. This prevents projects from injecting any preparatory steps - such as installing CRDs, operators, or other third-party dependencies - before executing the actual tests.

By introducing the SETUP_TEST_E2E_TARGETS variable, users gain the flexibility to define and run one or more prerequisite targets prior to cluster setup and test execution. This change:

  • Enhances extensibility: Teams can now tailor the e2e pipeline to their specific needs without forking or patching the upstream Makefile.
  • Maintains backward compatibility: The default behavior remains unchanged when SETUP_TEST_E2E_TARGETS is unset, ensuring existing projects continue to work seamlessly.

Introduce optional targets to be executed after setting up the
Kind cluster and before running e2e tests. This allows for additional
customization and setup steps to be included in the e2e test
workflow.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 19, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kersten
Once this PR has been reviewed and has the lgtm label, please assign camilamacedo86 for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 19, 2025
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@@ -71,6 +71,9 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
# - CERT_MANAGER_INSTALL_SKIP=true
KIND_CLUSTER ?= project-test-e2e

# Optional targets to run after setting up Kind cluster and before running e2e tests
SETUP_TEST_E2E_TARGETS ?=
Copy link
Member

@camilamacedo86 camilamacedo86 Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution 🥇

But let's check the motivation:

By introducing the SETUP_TEST_E2E_TARGETS variable, users gain the flexibility to define and run one or more prerequisite targets prior to cluster setup and test execution. This change:

Do we have any prerequisites in the default scaffold?

Currently, the test-e2e target in the Kubebuilder Makefile template hardcodes a single workflow: setup the Kind cluster and immediately run the end-to-end tests. This prevents projects from injecting any preparatory steps - such as installing CRDs, operators, or other third-party dependencies - before executing the actual tests.

The key question here is: Do we need to support this in the default scaffold?

I would argue no. This kind of setup is only necessary in customised use cases. If someone chooses to modify the default scaffold to accommodate these advanced workflows, they can and should customise the Makefile accordingly as well.

In other words, we shouldn’t change the default scaffold to support edge-case scenarios that are irrelevant to the standard use case. Doing so introduces unnecessary complexity and maintenance burden, with features that don’t offer value to the common path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/hold for we discuss the need and motivations ^

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 19, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 4, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants