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

🐛 For go/v3 plugin: Avoid to add duplicated code fragments #2619

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

mrkm4ntr
Copy link
Contributor

@mrkm4ntr mrkm4ntr commented Apr 14, 2022

Every time we create webhook for existing project, the following duplicated code are injected.

err = admissionv1beta1.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())

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

Hi @mrkm4ntr. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 14, 2022
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.

Thank you for your contribution 🥇

Following some questions:
a) Is your goal here to begin to use "k8s.io/api/admission/v1" instead of "k8s.io/api/admission/v1beta1"?

b) Why it is a bug? Could you please clarifies? what are the problems faced because of this? Could please raise an issue for that? Then, we can properly check it. WDYT?

Additionally, see that: when we change any scaffold we need to use the command make generate to update the samples under the testdata dir.

@mrkm4ntr
Copy link
Contributor Author

a) Is your goal here to begin to use "k8s.io/api/admission/v1" instead of "k8s.io/api/admission/v1beta1"?

Sorry, my main goal is deduplicate following code. This is added again and again per every kubebuilder create webhook.

err = admissionv1beta1.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())

I will change the PR title and commit message.

I also addressed this TODO message, but I will split this PR from this.

// TODO: admission webhook versions should be based on the input of the user. For More Info #1664

@mrkm4ntr
Copy link
Contributor Author

Additionally, see that: when we change any scaffold we need to use the command make generate to update the samples under the testdata dir.

Of course, I already executed make generate.

@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 Apr 14, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 14, 2022
@mrkm4ntr
Copy link
Contributor Author

@camilamacedo86 Thank you for your comments. I changed the goal of this PR. PTAL.

@mrkm4ntr mrkm4ntr changed the title 🐛 For go/v3 plugin: Use appropriate webhook version for test 🐛 For go/v3 plugin: Avoid to add duplicated code fragments Apr 14, 2022
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.

Thank you for the contribution and for work on the review of this PR 🥇
It makes sense for me 👍

/approved
/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 Apr 21, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Apr 21, 2022
@camilamacedo86
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2022
@camilamacedo86
Copy link
Member

/test pull-kubebuilder-e2e-k8s-1-18-8

@camilamacedo86
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit 0976383 into kubernetes-sigs:master Apr 29, 2022
@mrkm4ntr mrkm4ntr deleted the webhook-version branch May 9, 2022 01:38
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants