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

🐛 Make kubebuilder go install-able #4481

Merged

Conversation

migueleliasweb
Copy link
Contributor

Closes #4079

This PR makes kubebuilder go installable.

Changes:

  • Renamed main package originally from cmd/ to cmd
  • Renamed main function previously inside cmd/cmg.go to Run - following Go Cobra's pattern
  • Created new main file at the root of the project
  • Renamed package on doc.go to main
  • Fixed building make build target
  • Fixed GoReleaser config

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

Welcome @migueleliasweb!

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
Copy link
Contributor

Hi @migueleliasweb. 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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 10, 2025
doc.go Outdated Show resolved Hide resolved
@migueleliasweb migueleliasweb changed the title (:bug:) Make kubebuilder go install-able 🐛 Make kubebuilder go install-able Jan 10, 2025
@camilamacedo86
Copy link
Member

/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 12, 2025
@camilamacedo86
Copy link
Member

Hi @migueleliasweb

You can see that the changes made broke the e2e tests.
The [pull-kubebuilder-e2e-k8s-1-32-0](https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_kubebuilder/4481/pull-kubebuilder-e2e-k8s-1-32-0/1878418648549298176) you can ignore because it is a bug with prow and the 1.32 is not working yet.

But all other failures would be required be solved

@migueleliasweb
Copy link
Contributor Author

I'll have a look at the failing tests tomorrow 🫡

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.

Hi @migueleliasweb

I think to get this one merged we just need:

a) address this comment https://github.com/kubernetes-sigs/kubebuilder/pull/4481/files#r1920699959.

b) can you please squash the commits? we have the policy of 1 commit per PR

c) we should get this one merged #4504 and then this one here rebased with so you will add the main.go in the root. If we need to revert for any reason that will be helpful, thank you a lot 🥇

Than you a lot for your help here.

cmd/version.go Outdated Show resolved Hide resolved
@camilamacedo86
Copy link
Member

Hi @migueleliasweb

Can you please squash the commits so we can get this one merged?

@migueleliasweb
Copy link
Contributor Author

Hi @migueleliasweb

Can you please squash the commits so we can get this one merged?

Will do!

Do you think, maybe after this PR is merged, small changes to the docs should be done to mention the new installation method?

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 19, 2025
Closes 4079 (Make kubebuilder go install-able)

Signed-off-by: Miguel Elias dos Santos <[email protected]>
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 20, 2025
@camilamacedo86
Copy link
Member

Hi @migueleliasweb you can ignore the fail on 1.32 :
The issue is in the prown: https://kubernetes.slack.com/archives/C09QZ4DQB/p1737373079194649

@camilamacedo86
Copy link
Member

Hi @migueleliasweb

I am thinking about how we can test this one.
So, could you please let us know how you check that after those changes would be able to go install the project?

@migueleliasweb
Copy link
Contributor Author

migueleliasweb commented Jan 21, 2025

Hi @migueleliasweb

I am thinking about how we can test this one. So, could you please let us know how you check that after those changes would be able to go install the project?

Hi @camilamacedo86 . I reckon the quickest option here would be to merge and then get the hash of the commit so we can then issue a: go install -v sigs.k8s.io/kubebuilder/v4@<hash>. We can then quickly check if the binary is installed and named correctly.

The slightly more safe option would be to merge this onto a separate branch within kubebuilder. This would be enough for us to test it with: go install -v sigs.k8s.io/kubebuilder/v4@<branch-name>. Note that we can do this today with: go install -v sigs.k8s.io/kubebuilder/v4/[email protected] but the outcode is a cmd binary instead of kubebuilder 😬 .

Given the current setup we have in cmd/version.go some build info might not be set correctly.

I've made a POC in https://github.com/migueleliasweb/go-installable/ so you can see how we would get as much information as possible from the build info during a go install.

The TL;DR is that we have a few ways to run kubebuilder:

  • With go run locally after cloning the repo
  • With go build -o kubebuilder and then ./kubebuilder
  • With go install sigs.k8s.io/kubebuilder/v4@<commit-hash-ref> (should generate a bin named kubebuilder)
  • With go install sigs.k8s.io/kubebuilder/v4@<release-ref> (should generate a bin named kubebuilder)

Give it a go with my POC and see how the behaviour is.

Try running:

  • go install -v github.com/migueleliasweb/[email protected]
  • go install -v github.com/migueleliasweb/go-installable@d91d9ebe30f987e0b9cc2690fd99c7f92ac1807a (this is the same commit hash as the tag v1.0.5)
  • go build -o go-installable and then go-installable
  • go run main.go

The same logic can be ported to kubebuilder if you think it's worth it.

@camilamacedo86
Copy link
Member

/override pull-kubebuilder-e2e-k8s-1-32-0

@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: Overrode contexts on behalf of camilamacedo86: pull-kubebuilder-e2e-k8s-1-32-0

In response to this:

/override pull-kubebuilder-e2e-k8s-1-32-0

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.

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

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, migueleliasweb

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 Jan 21, 2025
@camilamacedo86
Copy link
Member

/override pull-kubebuilder-e2e-k8s-1-32-0

@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: Overrode contexts on behalf of camilamacedo86: pull-kubebuilder-e2e-k8s-1-32-0

In response to this:

/override pull-kubebuilder-e2e-k8s-1-32-0

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.

@k8s-ci-robot k8s-ci-robot merged commit 7ee23df into kubernetes-sigs:master Jan 21, 2025
7 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/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.

Make Kubebuilder go install-able
4 participants