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 defaults from crd v1beta1 #446

Closed
wants to merge 1 commit into from

Conversation

tamalsaha
Copy link
Contributor

Fixes #445

Signed-off-by: Tamal Saha tamal@appscode.com

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 25, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tamalsaha
To complete the pull request process, please assign directxman12
You can assign the PR to them by writing /assign @directxman12 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 25, 2020
Signed-off-by: Tamal Saha <tamal@appscode.com>
@vincepri
Copy link
Member

It seems a little strange to me that we'd silently remove the defaults markers for an unsupported type, this could lead into confusion, thoughts @alvaroaleman @DirectXMan12 ?

Copy link
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

Testcase?

Copy link
Contributor

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

left comment, needs a test case, also we should probably warn about this, or maybe just error out.
I'd lean towards just erroring out, but I wouldn't be surprised if people have workarounds (deploying different controller versions or webhooks but same YAML), so a warning is probably better.

@@ -182,6 +189,59 @@ func toTrivialVersions(crd *apiextlegacy.CustomResourceDefinition) {
crd.Spec.AdditionalPrinterColumns = canonicalColumns
}

// removeDefaults removes defaults from apiextensions.k8s.io/v1beta1 CRD definition.
// To use defaulting, CustomResourceDefinitions must use API version apiextensions.k8s.io/v1
func removeDefaults(schema *apiextlegacy.JSONSchemaProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we've got a schema visitor for this purpose, so you shouldn't have to manually write a schema visitor.

@DirectXMan12
Copy link
Contributor

Closed by #481, but that'll need some fixups.

@tamalsaha tamalsaha closed this Sep 18, 2020
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. 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