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 preserveUnknownFields to false in the CRD conversion webhook patch #933

Closed
mengqiy opened this issue Aug 12, 2019 · 18 comments · Fixed by #1644
Closed

Set preserveUnknownFields to false in the CRD conversion webhook patch #933

mengqiy opened this issue Aug 12, 2019 · 18 comments · Fixed by #1644
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.
Milestone

Comments

@mengqiy
Copy link
Member

mengqiy commented Aug 12, 2019

kube-apiserver requires spec.preserveUnknownFields to be false when conversion.strategy is Webhook.
Ref: https://github.com/kubernetes/kubernetes/blob/1d812991b63f42485d5f2aa8c883f142445fd09a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go#L265

CustomResourcesDefinition conversion via Web Hooks is promoted to beta. Note that you must set spec.preserveUnknownFields to false.

See release note in kubernetes/kubernetes#78426

/kind bug

@mengqiy mengqiy added the kind/bug Categorizes issue or PR as related to a bug. label Aug 12, 2019
@mengqiy
Copy link
Member Author

mengqiy commented Aug 12, 2019

cc: @droot

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 10, 2019
@mengqiy mengqiy removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 15, 2019
@pires
Copy link
Contributor

pires commented Nov 18, 2019

This seems to also affect clusters that enable CustomResourceDefaulting feature-gate when using +kubebuilder:default marker.

See https://github.com/kubernetes/apiextensions-apiserver/blob/release-1.15/pkg/apis/apiextensions/validation/validation.go#L154-L159.

@DirectXMan12
Copy link
Contributor

yes, defaulting requires the v1 CRD and a structural schema. We could document this better in the defaulting marker docs and the book

@camilamacedo86
Copy link
Member

/remove-lifecycle stale

the-redback added a commit to the-redback/kubebuilder-demo that referenced this issue Mar 26, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 2020
@camilamacedo86
Copy link
Member

camilamacedo86 commented May 8, 2020

c/c @estroz

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 8, 2020
@DirectXMan12
Copy link
Contributor

/remove-lifecycle stale

we should do this by default for go.kubebuilder.io/v3 scaffolding, so that we can turn on conversion without changes in semantics

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/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.

@camilamacedo86
Copy link
Member

/re-open

@camilamacedo86
Copy link
Member

/reopen

@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: Reopened this issue.

In response to this:

/reopen

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 reopened this Jul 11, 2020
@camilamacedo86
Copy link
Member

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jul 11, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 9, 2020
@camilamacedo86
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 3, 2020
@camilamacedo86 camilamacedo86 added this to the next milestone Nov 3, 2020
@camilamacedo86 camilamacedo86 added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Nov 3, 2020
@camilamacedo86 camilamacedo86 self-assigned this Nov 3, 2020
@ttlv
Copy link

ttlv commented Mar 23, 2021

# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: nodedeployments.edge.harmonycloud.cn
spec:
  preserveUnknownFields: false
  conversion:
    strategy: Webhook
    webhookClientConfig:
      # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
      # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
      caBundle: Cg==
      service:
        namespace: system
        name: webhook-service
        path: /convert

I think it's better to add preserveUnknownFields: false when use kubebuilder to generate and I met the same problem when I type make install command.My kubernetes version is 1.20,It's not friendly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants