-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
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. |
Welcome @liusy182! |
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 Once the patch is verified, the new status will be reflected by the 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liusy182 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 |
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? |
/ok-to-test |
There was a problem hiding this 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.
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. |
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? |
sure i can give a try on that. |
There was a problem hiding this 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.
/hold cancel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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. |
@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?
What still be required to get done? (can be done here or in a follow up)
|
On second thought, do we still want to support v1beta1 CRDs for those targeting older clusters? If so we should parameterize CRD version like /hold |
This PR is superseded by #1644 |
@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. |
/close |
@estroz: Closed this PR. In response to this:
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. |
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:
spec.preserveUnknownFields
defaults totrue
forv1beta
.CustomResourceConversion
requires the value ofspec.preserveUnknownFields
to befalse
when thestrategy
isWebhook
.This PR provides a fix by setting
spec.preserveUnknownFields
tofalse
.Tested with examples provided by kubebook.