-
Notifications
You must be signed in to change notification settings - Fork 423
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
🐛 WIP: Force preserveUnknownFields=false for v1 CRDs #590
🐛 WIP: Force preserveUnknownFields=false for v1 CRDs #590
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kevindelgado 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 |
cc @munnerz based on your convo at https://kubernetes.slack.com/archives/CAR30FCJZ/p1611919182225100 |
@kevindelgado: 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. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: 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 a proof-of-concept of how to force controller-gen to explicitly set "preserveUnknownFields=false" for v1 CRDs. We should always be setting this field, because the default value has flipped from true to false between CRD api version v1beta1 and v1.
Fixes #476
Related: https://kubernetes.slack.com/archives/CAR30FCJZ/p1611919182225100
The way this works is by creating a new type that is identical to
apiext.CustomResourceDefinition
with the one exception being that the json tag forSpec.PreserveUnknownFields
does not contain omitempty.It feels pretty hacky to have to create a separate type that duplicates most of the CRD type, so I am definitely open to alternative ways of doing this.
Some other approaches could be:
apiext.CustomResourceDefinition
Both of these options have their own drawbacks and I went with this one because it seemed like the quickest way to get a working POC so that I could get a discussion started at least.