Skip to content
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

🐛 (go/v4): e2e test: Removed Prometheus dependency #4529

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

anshuman-agarwala
Copy link
Contributor

Fixes #4527

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 27, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @anshuman-agarwala!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 27, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @anshuman-agarwala. 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.

@@ -30,14 +30,10 @@ import (

var (
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

The change need to be done here:

# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
# Prometheus and CertManager are installed by default; skip with:
# - PROMETHEUS_INSTALL_SKIP=true
# - CERT_MANAGER_INSTALL_SKIP=true

Also, can you please ensure that we have all squashed in the same commit so we can merge this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

You need change the template kubebuilder/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go

And then run make install && make generate
It will re-generate all samples and docs with this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@anshuman-agarwala anshuman-agarwala force-pushed the e2e-cleanup branch 2 times, most recently from beb5185 to bf51b38 Compare January 27, 2025 13:08
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 28, 2025
@camilamacedo86 camilamacedo86 changed the title 🌱 Removed Prometheus dependency from e2e scaffolds 🐛 (go/v4): e2e test: Removed Prometheus dependency Jan 28, 2025
@camilamacedo86
Copy link
Member

Hi @anshuman-agarwala

Thank you a lot 🎉
In this case, we are changing the e2e tests of the projects, which are scaffolded for end users
So, the emoji 🌱 cannot be used, since it is for changes that does not impact the end users
I update the title since we use it for our release notes I hope that you do not mind.

@anshuman-agarwala
Copy link
Contributor Author

Hi @anshuman-agarwala

Thank you a lot 🎉 In this case, we are changing the e2e tests of the projects, which are scaffolded for end users So, the emoji 🌱 cannot be used, since it is for changes that does not impact the end users I update the title since we use it for our release notes I hope that you do not mind.

No Problems!
I see that e2e test is failing, the logs are as follows

running: make deploy IMG=example.com/project:v0.0.1
  [FAILED] in [BeforeAll] - /home/runner/work/kubebuilder/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/test/e2e/e2e_test.go:71

Could you help me with how I can fix this?

@camilamacedo86
Copy link
Member

Hi @anshuman-agarwala,

The tutorials in the documentation are built from the sample projects under book/../testdata, such as:
🔗 https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial/testdata/project

To ensure consistency, we update these samples based on PR changes and verify them using e2e tests. The additional code and modifications on top of the scaffolded content are implemented in:
🔗 https://github.com/kubernetes-sigs/kubebuilder/tree/master/hack/docs

The Issue:

The error occurs because Prometheus integration is enabled in the Kustomize files, but Prometheus itself is not installed.

Possible Solutions:

Option A:
Update hack/docs to ensure that the removed code from the default scaffold is explicitly added to the sample used in the Multiversion Tutorial. This means adding the necessary code under:
🔗 https://github.com/kubernetes-sigs/kubebuilder/tree/master/hack/docs/internal/multiversion-tutorial

With this approach, when we run make generate-docs (triggered by make generate), we will maintain the current e2e tests at:
🔗 https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial/testdata/project/test/e2e

Option B:
Modify the code so that it no longer uncomments the Kustomize files to enable Prometheus by default.

Personally, Option A seems preferable since it keeps this scenario as a documented example for end users.

WDYT? 🚀

@anshuman-agarwala
Copy link
Contributor Author

Hi @camilamacedo86
Option A sounds good but I looked at the other E2E book samples runs, they have failed in the same way, is it due to the same problem? In that case we may need to look at Option B, right?

@camilamacedo86
Copy link
Member

Hi @anshuman-agarwala,

Option A sounds good, but I noticed that other E2E book sample runs have failed in the same way. Could this be due to the same underlying issue? If so, should we consider Option B instead?

Good catch! 🥇

Getting Started Sample

For the getting-started sample, we should not simply uncomment the line in the kustomization.yaml file to enable the integration with prometheus:
🔗 kustomization.yaml#L26-L27

Why?

  • This is a basic example, and we don’t need to extend it further.

How?

CronJob and MultiVersion Samples

The CronJob and MultiVersion samples share a similar generation process. The MultiVersion sample builds on the CronJob implementation. See in the hack/docs that we re-use it.

So, to add E2E test we can:

Where?

We should create a new file to store constants for e2e_implementation.go under:
🔗 cronjob-tutorial directory
(similar to the existing structure).

In this way, we cover more cases in the tests and provide more examples for end users. WDYT?

@camilamacedo86 camilamacedo86 self-requested a review January 30, 2025 08:25
@anshuman-agarwala anshuman-agarwala force-pushed the e2e-cleanup branch 2 times, most recently from d12da83 to 3fc26d5 Compare February 1, 2025 13:33
@camilamacedo86
Copy link
Member

HI @anshuman-agarwala

Great work 🥇
It seems missing only a nit for we are able to get this one merged.
See the lint issues. You can run make lint locally to check them out.
Can you please send a fix?

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 1, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anshuman-agarwala, camilamacedo86

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 1, 2025
@k8s-ci-robot k8s-ci-robot merged commit 543b4a1 into kubernetes-sigs:master Feb 1, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Prometheus Dependency from e2e Test Scaffolds in Kubebuilder
3 participants