Skip to content

🐛 promote version-specific CRD fields when only one version - #322

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
joelanford:merge-one-version
Sep 19, 2019
Merged

k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
joelanford:merge-one-version

Conversation

@joelanford

Copy link
Copy Markdown
Member

This fixes an issue where version-specific fields are not properly promoted to their top-level .spec equivalents when there is only one version defined in .spec.versions.

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @joelanford!

It looks like this is your first PR to kubernetes-sigs/controller-tools 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-tools has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 19, 2019
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 19, 2019
@DirectXMan12

Copy link
Copy Markdown
Contributor

This seems to check out with what we were seeing earlier on slack. Can you test against a couple different k8s versions to check that it's compatible with them?

@joelanford

joelanford commented Sep 19, 2019 •

Copy link
Copy Markdown
Member Author

@DirectXMan12 with controller-gen built from this branch, I confirmed that the CRD generated from an API with just a single API version with trivialVersions=false:

  1. Correctly promotes the version-specific subresources, schema, and additionalPrinterColumns to the respective top-level fields.
  2. Is correctly applied on Kubernetes clusters 1.13.9, 1.14.6, and 1.15.2

On all Kubernetes versions above, I can:

  1. See all of the top-level fields with kubectl describe crd apps.testgroup.my.domain
  2. See printer columns with kubectl get apps.testgroup.my.domain app-sample
  3. Get validation errors when applying invalid resources (and as expected with structural schemas, I noticed stricter validation in 1.15)

@prydonius

Copy link
Copy Markdown

Can confirm this works with my 1.15 and 1.14 clusters. Thanks @joelanford!

@DirectXMan12

Copy link
Copy Markdown
Contributor

Awesome, thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2019
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12, joelanford

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2019
@k8s-ci-robot
k8s-ci-robot merged commit 76a25b6 into kubernetes-sigs:master Sep 19, 2019
@joelanford
joelanford deleted the merge-one-version branch September 19, 2019 19:16
@pires

pires commented Nov 26, 2019

Copy link
Copy Markdown

This doesn't work if crdVersions=v1 is set even if trivialVersions=false.

@DirectXMan12

Copy link
Copy Markdown
Contributor

What issues are you seeing? v1 only has per-version schemata.

@pires

pires commented Dec 5, 2019

Copy link
Copy Markdown

Ah, if that's the case then additionalPrinterColumns will always show up per version, right? If that's the case, then I misunderstood and I have no issues.

@DirectXMan12

Copy link
Copy Markdown
Contributor

yes, it should always show up per version in v1

@pires

pires commented Dec 5, 2019

Copy link
Copy Markdown

Thank you!

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants