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

Proposal: kn API version support #462

Closed
rhuss opened this issue Oct 29, 2019 · 11 comments
Closed

Proposal: kn API version support #462

rhuss opened this issue Oct 29, 2019 · 11 comments
Labels
kind/proposal Issues or PRs related to proposals. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@rhuss
Copy link
Contributor

rhuss commented Oct 29, 2019

kn depends on Knative serving and eventing and supports different versions of Knative installed on the server-side. For the sake of this discussion, let stick to Knative serving first as the Knative eventing dependency can be tackled the same.

There are essentially two scenarios when the Knative serving version that is used as a compile-time dependency for kn and the actual serving version running on a cluster differs:

  • kn is used for a newer cluster side version of Knative serving which is not yet known to the time when this version of kn has been released.
  • kn is used for an older version of Knative Serving which does not support the latest API version of the Serving dependency kn is compiled with.

Both those scenarios should be possible to some extent, much a bit like kubectl works with older and newer Kubernetes clusters.

As a single Knative serving release supports multiple API version endpoints (which are converted on the fly, e.g. Serving 0.10.0 supports v1alpha1, v1beta1 and v1), there are two general strategies to maximize the overlap of support for newer and older versions of Knative serving:

Defensive Strategy

kn use the latest available Serving release as a compile dependency (e.g. knative-serving v0.10.0), but uses the oldest supported API version for the types used in the KnServingClient interface and as endpoint when calling a cluster. I.e. for a compile dependency to knative-serving v0.10.0 this would be v1alpha1. Ideally kn queries the Knative Serving CRD from the cluster during runtime and verifies that the selected API version (v1alpha1 in this example) is supported. If not, stop with an error that the Knative serving it too new and not supported for this version of kn, so that the user has to upgrade kn to a newer version of kn.

Pro

  • Simpler to implement (no API object conversions needed in the implementation of KnServingClient)

Con

  • A given kn can be easily outdated by newer versions of Knative Serving. E.g. when Knative serving v0.11.0 (or v1.0.0) decides to drop v1alpha1 support, kn 0.9.0 can't be used anymore and the newest kn version, aligned with the latest serving version as compile dependency needs to be used.

Optimistic Strategy

kn uses the latest available Serving release as a compile dependency but uses the newest supported API version. E.g. for knative-serving v0.10.0 this would be v1. Again, kn should query the server-side for the Serving CRD and check if this newest API version is supported. If this is not the case, the next-newest version (e.g. v1beta1) should be checked and so on. kn's KnServingClient interface should use the newest API objects (v1) but its implementation transparently converts to older versions (v1beta1, v1alpha) depending on the maximally supported API version on the server-side (and then used different API endpoints when talking to the server). This goes down up to the minimal version supported by the selected compile-time dependency.

Pro

  • Much longer support for newer, not-yet-released, versions of Knative serving (as it's supposed that the newest API version (v1) is supported much longer than the oldest (v1alpha1))
  • Support for older API versions like in the "Defensive Approach"

Con

  • More complex to implement as there needs to be added conversion code for the supported API versions (v1, v1beta1, v1alpha1), much like the Serving operators need to convert different API version objects to the CR's storage version. Actually, one could even 'borrow' code from the server-side (at least to find out what needs to be converted). However, the conversion is very likely the other way round (from newer to older).

For short term (e.g. kn version 0.9.0 and 0.10.0) I think the "Defensive Strategy" is more suitable as it does not need any code changes on the client-side (except maybe the server-side API version detection by querying the serving CRD). However long-term (post 0.10.0), the "Optimistic Strategy" seems to be more suitable as it allows for a larger version overlap between client and server.

Notes:

  • This proposal assumes that API versions are stable. This is not necessarily the case for alpha versions (and indeed, v1alpha1 has been changed itself between different releases of serving), but as this proposal is more about a long-term strategy and the hope is, that v1alpha1 is not touched anymore anyway (and v1beta1 and v1 are indeed stable), this aspect is omitted in this discussion (which also would make it much more difficult as there is no way to query from a CRD "which" alpha version actually is meant and one would have to over the knative-serving release version, but this is not easily exposed to the client from a given cluster)
  • Knative eventing has a different API version release cycles, so KnEventingClients could adopt a different strategy than for serving.
@rhuss rhuss added the kind/proposal Issues or PRs related to proposals. label Oct 29, 2019
@duglin
Copy link
Contributor

duglin commented Oct 29, 2019

Since 0.10 is almost here, I think that plan seems reasonable.

@sixolet
Copy link
Contributor

sixolet commented Oct 29, 2019 via email

@rhuss
Copy link
Contributor Author

rhuss commented Oct 29, 2019

When we do support multiple versions, it should be settable in the config, and the client should not error if the crd is a 404 — that'll keep it working for non-k8s knative.

I think that kn itself should expose only a single version in its client interface (KnServingClient) which grows together with kn (i.e. only one selected API is supported). Any other version which is needed to communicate with the cluster is transparently converted by the client behind the interface. It's like the k8s CR "storage version" but on the other side.

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 15, 2020
@rhuss
Copy link
Contributor Author

rhuss commented Nov 26, 2020

Reopen it as I think this issue contains still some good content that we might convert into a document.

@rhuss rhuss reopened this Nov 26, 2020
@rhuss
Copy link
Contributor Author

rhuss commented Dec 15, 2020

/remove-lifecycle stale

@knative-prow-robot knative-prow-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 15, 2020
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 16, 2021
@rhuss
Copy link
Contributor Author

rhuss commented Mar 17, 2021

/remove-lifecycle stale

@knative-prow-robot knative-prow-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2021
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 16, 2021
@rhuss
Copy link
Contributor Author

rhuss commented Jul 5, 2021

/remove-lifecycle stale

@knative-prow-robot knative-prow-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 5, 2021
@github-actions
Copy link

github-actions bot commented Oct 4, 2021

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 4, 2021
@github-actions github-actions bot closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/proposal Issues or PRs related to proposals. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants