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

✨ Remove 'default' fields from v1beta1 CRDs #481

Merged

Conversation

munnerz
Copy link
Member

@munnerz munnerz commented Aug 26, 2020

It is not valid to specify default field values in v1beta1 CRDs.

This pull request strips the generated openapi schema of all instances of default being specified.

My only issue with this implementation is that it is non-obvious to users that this has happened, which could cause unexpected behaviour.

Fixes #445

related #480

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 26, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 26, 2020
@munnerz
Copy link
Member Author

munnerz commented Aug 27, 2020

I'm looking into ways we can write a unit/integration test for this, similar to parser_integration_test.go. The issue is that the parser tests do not call Generator.Generate (defined in gen.go), so I'll need to write a new gen_test.go file which brings up a Generator and compares the output of the generated content to ensure that the defaults field is stripped when writing v1beta1.

@pwittrock
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: munnerz, pwittrock

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit 4f077b9 into kubernetes-sigs:master Sep 1, 2020
@munnerz munnerz deleted the remove-defaults-v1beta1 branch September 1, 2020 16:27
@DirectXMan12
Copy link
Contributor

In the future, let's not merge things like this w/o tests :-/.
See also: #446 (review)

@DirectXMan12
Copy link
Contributor

@munnerz can you do a follow up with a) a warning, and b) tests?
They can be separate PR if the warning is quicker.

@kevindelgado
Copy link
Contributor

Hey @munnerz I'm gonna try adding the warning/test mentioned by Solly above if you're not already working on it. Just wanted to check and make sure I'm not stepping on your toes.

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strip default values from v1beta1 CRD yaml
5 participants