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

set spec.preserveUnknownFields to false for Webhook conversion #1589

Closed

Conversation

liusy182
Copy link

@liusy182 liusy182 commented Jul 6, 2020

This is to fix error: "spec.conversion.strategy: Invalid value: "Webhook": must be None if spec.preserveUnknownFields is true". The error occurs while working on the webhook example in kubebook.

The same error was mentioned in #1006. Although this is a closed ticket, some people have encountered similar failure very recently in a different issue.

The root cause of the error is the 2 conflicting specs that are not properly specified, according to documentation:

This PR provides a fix by setting spec.preserveUnknownFields to false.

Tested with examples provided by kubebook.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 6, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @liusy182!

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 @liusy182. 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
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liusy182
To complete the pull request process, please assign droot
You can assign the PR to them by writing /assign @droot in a comment when ready.

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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 6, 2020
@k8s-ci-robot k8s-ci-robot requested review from estroz and joelanford July 6, 2020 05:06
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 6, 2020
@liusy182
Copy link
Author

liusy182 commented Jul 8, 2020

Hi! I realize that the samples in the docs folder might need update as well. Since this is somewhat unrelated to the code generation, is the preference to have them in the same PR or as a separate issue?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 8, 2020
@pwittrock
Copy link
Contributor

/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 Jul 14, 2020
Copy link
Contributor

@estroz estroz left a comment

Choose a reason for hiding this comment

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

This change should only be applied to the v3 plugin, since it changes behavior significantly and v2 is frozen.

@camilamacedo86
Copy link
Member

camilamacedo86 commented Jul 27, 2020

/hold

Really nice to see your contribution. However, we can just apply changes to v3 as @estroz described above.
Also, I am not sure if we should fix this by setting it. We might just need to migrate to v1 api as described in: #1065

Also, see : #933

@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 Jul 27, 2020
@liusy182
Copy link
Author

Thanks! please let me know if we want to apply this to V3 and I can update that. Otherwise feel free to close the PR if migration is the way to go.

@camilamacedo86
Copy link
Member

camilamacedo86 commented Jul 30, 2020

Hi @liusy182,

IMO: What we need to do is: update the v3 plugin only to scaffold by default CRD and Webhooks using the API v1. In this way, this field will no longer be required and as pre-requisites, the v3-alpha tutorials will require cluster version >= 0.16. Is it make sense? Would like to work on it?

@liusy182
Copy link
Author

liusy182 commented Aug 4, 2020

sure i can give a try on that.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 4, 2020
Copy link
Contributor

@estroz estroz left a comment

Choose a reason for hiding this comment

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

The switch to a v1 CRD webhook patch needs to be made alongside defaulting CRD version to v1 and changing all other scaffolded manifests related to CRDs to v1. It doesn't make sense to have some kustomize resources be v1beta1 while others are v1.

@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 Aug 11, 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.

@liusy182

It shows great now. Just a few nits are required for we get this one merge.

  • squash the commits
  • Also, we need here update the Makefile to generate the CRD's with v1 which is simple. here needs to be CRD_OPTIONS ?= "crd:crdVersions=v1"
  • update the pr title to reflect the change properly (it will be in the git log): E.g feat: upgrade webhooks and crds api to v1 (valid only for v3)
  • update the first comment and put that it closes: Closes: #1065

Then, if you wish, I think would be ok we have another pr to apply the field with false as bugfix: set spec.preserveUnknownFields to false for Webhook conversion (only v2) to close: #933 only for v2 plugin.

Please, let me know if you need a help with and feel free to ping me when you finish.

@estroz
Copy link
Contributor

estroz commented Aug 11, 2020

This PR either needs a changes to make all CRD patches v1, or a follow-up. I’m fine with the latter.

@camilamacedo86 kubernetes-sigs/controller-tools#468 has been merged so we can avoid explicitly setting default version to v1 in the Makefile.

@camilamacedo86
Copy link
Member

camilamacedo86 commented Aug 11, 2020

@estroz Great news kubernetes-sigs/controller-tools#468 👍

but we need to wait for it be released. So, just to sum up;

What is a blocker for we get this PR merged?

  • squash the commits
  • update the pr title to reflect the change properly (it will be in the git log): E.g feat: upgrade webhooks api to v1 (valid only for v3)

What still be required to get done? (can be done here or in a follow up)

@estroz
Copy link
Contributor

estroz commented Aug 11, 2020

On second thought, do we still want to support v1beta1 CRDs for those targeting older clusters? If so we should parameterize CRD version like init --webhook-version, create api --crd-version, as @camilamacedo86 has suggested previously.

/cc @DirectXMan12 @pwittrock

/hold

@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 Aug 11, 2020
@estroz
Copy link
Contributor

estroz commented Aug 19, 2020

This PR is superseded by #1644

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2020
@k8s-ci-robot
Copy link
Contributor

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

@estroz
Copy link
Contributor

estroz commented Aug 19, 2020

/close

@k8s-ci-robot
Copy link
Contributor

@estroz: Closed this PR.

In response to this:

/close

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.

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-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

5 participants