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

Generate Contour CRDs with V1 CustomResourceDefinition. #2678

Closed
jpeach opened this issue Jul 9, 2020 · 3 comments · Fixed by #2916
Closed

Generate Contour CRDs with V1 CustomResourceDefinition. #2678

jpeach opened this issue Jul 9, 2020 · 3 comments · Fixed by #2916
Assignees
Labels
area/deployment Issues or PRs related to deployment tooling or infrastructure.

Comments

@jpeach
Copy link
Contributor

jpeach commented Jul 9, 2020

Generating CRDs as v1 CustomResourceDefinition resources enables better CRD validation and defaulting, as well as the ability to use kubectl explain.

This requires Kubernetes 1.16 or later. We can do this as the default YAML, but we can also generate different sets of YAML (as demonstrated in #2474).

This issue tracks the decision for adding this, and we can also use it to collect other issues that are blocked on the CRD support.

@skriss
Copy link
Member

skriss commented Sep 16, 2020

A few notes here:

  • personally, I don't think we need to generate both v1 and v1beta1 CRD YAML -- Kubernetes 1.16 (where CRDs moved to GA) has been out for a year, and folks can always pull an older release of Contour if they really need pre-1.16 support. Moving to generating just v1 CRDs is a lot simpler. Would like to get agreement from other maintainers on this, though.
  • currently, our CRDs have spec.preserveUnknownFields set to true, because they're created as v1beta1 CRDs and that's the default value for that field in that version. We need to set that to false (which is the v1 default) because (a) we want the behavior of pruning unknown fields, and (b) it needs to be false to make kubectl explain work, apparently. Unfortunately, controller-gen doesn't seem to allow you to explicitly set it to false when generating v1 CRD YAML, so we'll need users to manually run a kubectl patch command to remove that field as part of the upgrade process. It won't be an issue on a fresh install of Contour using v1 CRD YAML, though, since false is the default.

Otherwise, this looks to be a pretty simple change that will add a lot of value going forward.

skriss added a commit to skriss/contour that referenced this issue Sep 16, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
@youngnick
Copy link
Member

youngnick commented Sep 17, 2020

I'm fine with only outputting the CRD v1 objects, as you say, I think 1.16 has been out long enough, and this functionality will save all our users a lot of headaches with simple formatting and validation errors.

I think having a kubectl patch command that will ensure that the preserveUnknownFields is set to false on everything is acceptable, we'll need to have that in the upgrade instructions for a release or two though.

skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss
Copy link
Member

skriss commented Sep 17, 2020

As an update, I was able to add logic to our wrapper CRD generation script to add spec.preserveUnknownFields: false to our CRD YAML, so users won't have to do the manual patch.

skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 18, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 21, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit that referenced this issue Sep 21, 2020
examples: generate v1 CustomResourceDefinitions

Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1 with preserveUnknownFields
set to false. Also adds a check on `contour serve` for non-upgraded 
CRDs, and logs a warning if found.

Closes #2678
Closes #1723
Closes #1978
Closes #2903
Closes #2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deployment Issues or PRs related to deployment tooling or infrastructure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants