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

✨ add comments for the exported methods in generated controllers (only v3+) #1690

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Conversation

bvwells
Copy link
Contributor

@bvwells bvwells commented Sep 22, 2020

Description
Add comments for exported methods in generated controllers in order to provide help for users.

Motivation
Closes #1606.

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

Welcome @bvwells!

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 @bvwells. 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/test-infra repository.

@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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 22, 2020
@bvwells
Copy link
Contributor Author

bvwells commented Sep 22, 2020

Need to sort out issues running make generate...

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 22, 2020
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.

I am all in to make the code better and more intuitive by providing an aditional info/doc. However, note that we need to be conscious with its definitions and aligned with the controller-runtime where it is implemented and also would be nice to make it easier to keep maintained. I mean, avoid the doc/text be easily outdated.

So, shows that a good option would add a very generic and small text to point users check its docs in the controller-runtime. Then, the best approach here would we need to use the tag as well to ensure that the users would get the docs according to the controller-runtime dep used. E.g;

https://github.com/kubernetes-sigs/controller-runtime/blob/v0.6.3/pkg/reconcile/reconcile.go

The tag above is v0.6.3. Note that the controller-runtime version used by the projects is defined in:

ControllerRuntimeVersion = "v0.6.2"
// ControllerToolsVersion is the kubernetes-sigs/controller-tools version to be used in the project
. And then, to pass the var to the Boilerplate we can do as it is done for the Go.mod. See:
&templates.GoMod{ControllerRuntimeVersion: ControllerRuntimeVersion},

WDYT?

@bvwells
Copy link
Contributor Author

bvwells commented Sep 24, 2020

Thanks for the review @camilamacedo86. The comment was copied across from operator-framework/operator-sdk prior it aligned with kubebuilder.

I'll see if I can reword the comment as per your suggestions.

@camilamacedo86
Copy link
Member

Hi @bvwells,

The comment was copied across from operator-framework/operator-sdk prior it aligned with kubebuilder.

You might be looking at some code that was describing the code/example scaffolded in the old versions. However, in POV SDK and Kube regards the controller/reconcile should be aligned controller-runtime where its implementation came from. I am looking for your improvements. Really thank you for your contribution 🥇

@bvwells
Copy link
Contributor Author

bvwells commented Sep 25, 2020

Hi @camilamacedo86, yes in operator-sdk there was documentation describing the reconcile loop. See here

https://github.com/operator-framework/operator-sdk/blob/53b00d125fb12515cd74fb169149913b401c8995/internal/scaffold/controller_kind.go#L208

I noticed that this documentation disappeared when operator-sdk aligned with kubebuilder in v0.0.19. This is why I submitted the issue.

@bvwells
Copy link
Contributor Author

bvwells commented Sep 25, 2020

I'll try to sketch something out this weekend.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 28, 2020
@bvwells
Copy link
Contributor Author

bvwells commented Sep 28, 2020

Hi @camilamacedo86, hope you had a good weekend! Made a few changes to the Reconcile documentation. Let me know what you think. I'm more than happy to iterate on it.

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.

Really thank you for your contribution.
It shows great for me. 👍 Could you just rebase it with the master and re-gen the testdata with make generate to update this PR?

c/c @gab-satchi @estroz WDYT?

@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 Oct 16, 2020
@camilamacedo86
Copy link
Member

/approve

However, note it will not pass in the CI before you update it with the master branch.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 16, 2020
@bvwells
Copy link
Contributor Author

bvwells commented Oct 16, 2020

Thanks for the reviews @camilamacedo86! All rebased to master.

@camilamacedo86 camilamacedo86 changed the title Add comments for exported methods in generated controllers ✨ add comments for exported methods in generated controllers (only v3+) Oct 26, 2020
@camilamacedo86 camilamacedo86 changed the title ✨ add comments for exported methods in generated controllers (only v3+) ✨ add comments for the exported methods in generated controllers (only v3+) Oct 26, 2020
Copy link
Contributor

@Adirio Adirio left a comment

Choose a reason for hiding this comment

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

LGTM
I'm not setting the lgtm flag to let @camilamacedo86 have the last word as she already set the approved flag and if I set the lgtm one it will get merged.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio, bvwells, 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

@camilamacedo86
Copy link
Member

I'm not setting the lgtm flag to let @camilamacedo86 have the last word as she already set the approved flag and if I set the lgtm one it will get merged.

Hi @Adirio,

Thank you for your review on that. It shows fine for me as well. I think it might be helpful to end-users in order to address common questions. So,

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2020
@k8s-ci-robot k8s-ci-robot merged commit 999d4ee into kubernetes-sigs:master Oct 27, 2020
@bvwells
Copy link
Contributor Author

bvwells commented Oct 27, 2020

Thanks @camilamacedo86 and @Adirio for your help getting this over the line!

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.

Add comments for exported methods in generated controllers
4 participants