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

Migrate existing KB project to v1 CRDs and Webhooks with minimal user effort #1065

Closed
erictune opened this issue Oct 2, 2019 · 23 comments · Fixed by #1644
Closed

Migrate existing KB project to v1 CRDs and Webhooks with minimal user effort #1065

erictune opened this issue Oct 2, 2019 · 23 comments · Fixed by #1644
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@erictune
Copy link

erictune commented Oct 2, 2019

Facts:

  • 1.16 introduced CRD and Webhooks v1 APIs.
  • CRD and Webhooks v1beta1 are deprecated and scheduled for removal in v1.19.
  • Kubernetes users use wide range of Kubernetes minor versions.

Consequences:

  • In about 12 months, expect clusters running versions 1.15 through 1.19.
  • If KB only generates v1beta1 or only generates v1 CRDs/WHs, then my controller can't be installed on that range of clusters.

Request for KubeBuilder:

  • Develop CRD and Webhook generation that can emit both v1beta1 and v1 CRDs/WHs.
  • Document how a developer can have a single project and a single release artifact and have it work on v1beta1-only, both, and v1-only clusters.
  • Don't decide that KubeBuilder v2.x.0 (or likewise for controller-tools, etc) is going to do a hard switch to generating v1 CRDs/WHs. I want to get new features and fixes for KB while still releasing controllers work with 1.15 and earlier Kubernetes versions.

Related issues:

  • CRD GA support #903 is about using the new features of v1 CRDs and webhooks. This one is about expressing existing KB projects using v1 types.
  • API deprecations on 1.16 #944 is about APIs being deprecated in 1.16. This one is about APIs being deprecated in 1.1

Additional Data about Versions:

  • From this slide of the Kubernetes Apps Survey, it appears that most (~95%) of users are running a cluster from one of the 4 most recent minor versions.
  • From the detailed data of the same survey in column AN, many users have 3 or even 4 minor versions in use concurrently.
  • I'd expect this distribution to broaden over time, so having users spread across 5 versions in 2020 seems likely.

/kind feature

@erictune erictune added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 2, 2019
@DirectXMan12
Copy link
Contributor

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Oct 4, 2019
@DirectXMan12
Copy link
Contributor

Don't decide that KubeBuilder v2.x.0 (or likewise for controller-tools, etc) is going to do a hard switch to generating v1 CRDs/WHs. I want to get new features and fixes for KB while still releasing controllers work with 1.15 and earlier Kubernetes versions.

Agreed, that seems untenable. We'll want to continue to generate v1beta1 CRDs in new versions of CT fo quite some time.

@erictune
Copy link
Author

erictune commented Nov 6, 2019 via email

@DirectXMan12
Copy link
Contributor

Yep, that's what we're doing in CT now

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 4, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 3, 2020
@liggitt
Copy link

liggitt commented Apr 20, 2020

/remove-lifecycle rotten
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Apr 20, 2020
@liggitt
Copy link

liggitt commented Apr 20, 2020

Is there a plan/timeframe in place for this?

@DirectXMan12
Copy link
Contributor

@liggitt can you clarify what, specifically, you're looking for here?

@DirectXMan12
Copy link
Contributor

AFAIK, all the pieces are in place. There's a couple of switches that need to be flipped manually atm to use GA vs beta, but otherwise this is pretty much done

@liggitt
Copy link

liggitt commented Apr 20, 2020

I couldn't tell whether kubebuilder could generate new v1 CRDs, or regenerate existing APIs as v1 CRDs. If that's mostly done, that's good news.

@DirectXMan12
Copy link
Contributor

yep -- controller-tools crd:crdVersion=v1 will do it for you :-)

@DirectXMan12
Copy link
Contributor

IIRC, we don't generate it by default because most folks still support (or supported at the time) kubernetes versions that didn't have v1 yet.

@liggitt
Copy link

liggitt commented Apr 21, 2020

makes sense. is there a plan to default to v1, once 1.15 is out of support?

@camilamacedo86
Copy link
Member

camilamacedo86 commented Apr 23, 2020

@DirectXMan12 in SDK we solve it by adding a flag in order to allow to keep the backwards compatibility. So, it means that by default the resources are scaffold using the latest version but users still able to use the flag in the commands to choose the old one. Do you think that it would be required here? Also, I think this would be a good one to get done now in the V3. WDYT?

c/c @joelanford @estroz

@estroz
Copy link
Contributor

estroz commented Apr 23, 2020

The SDK needs a flag because it calls controller-gen libraries directly, i.e. you cannot set crdVersion=<version> manually. Since controller-gen is being called via make recipe in kubebuilder, docs should be sufficient. I didn't see anything discussing CRD API versions in the docs, so I can take this on if we agree it's just a docs issue.

@camilamacedo86
Copy link
Member

camilamacedo86 commented Apr 23, 2020

Hi @estroz,

IHMO we need to address here:

  • Change the project to the scaffold CRD's and Webhooks using the V1 by default
  • update the docs and etc

Then, we will have to address the backwards compatibility scenario:

a) if possible, we could doc the steps to manually gen the CRDs and Webhooks in the old version. (I am not sure if it is 100% possible get done just by changing the makefile since the resources are also scaffolded by the tool)

OR

b) solve it as SDK by creating a flag which allows users to choose if would like to still gen in the old version.

@DirectXMan12
Copy link
Contributor

This is totally something we could do in a new layout version in v3, and then switch that to the default once 1.15 is out of support.

@estroz
Copy link
Contributor

estroz commented Aug 11, 2020

v1 CRDs and webhooks generated by default in controller-gen, respectively: kubernetes-sigs/controller-tools#468, kubernetes-sigs/controller-tools#469

@erictune
Copy link
Author

As the OP, I'm not sure this original issue is closed yet.

Users may be running a wide range of clusters. From what I gather, 1.14, 1.15, 1.16, 1.17, 1.18 and 1.19 are all moderately widespread at present. How should a KubeBuilder user produce an release that runs on that range of cluster version?

@estroz
Copy link
Contributor

estroz commented Nov 17, 2020

@erictune given the list of 3 things you wanted out of kubebuilder, the only one that doesn't appear to be resolved is

Document how a developer can have a single project and a single release artifact and have it work on v1beta1-only, both, and v1-only clusters.

Is that correct? Was there something else that needs doing?

To that effect: you can target the v1.14-v1.19 cluster range if you use v1beta1 CRDs/webhooks:

kubebuilder init --plugins go/v3-alpha
kubebuilder create api --crd-version v1beta1 ...
kubebuilder create webhook --webhook-version v1beta1 ...

For v1.14 clusters, you need to remove crd:preserveUnknownFields=false from your Makefile.

To target v1.16+ clusters, use defaults:

kubebuilder init --plugins go/v3-alpha
kubebuilder create api ...
kubebuilder create webhook ...

@erictune
Copy link
Author

Awesome. Can the text of your last comment, starting after To that effect:, go into the docs somewhere?

I searched but could not find something like it.

@estroz
Copy link
Contributor

estroz commented Nov 17, 2020

Definitely! I'll whip something up now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants