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 version from ObjectRef? #327

Closed
nightkr opened this issue Oct 2, 2020 · 4 comments · Fixed by #385
Closed

Remove version from ObjectRef? #327

nightkr opened this issue Oct 2, 2020 · 4 comments · Fixed by #385
Labels
api Api abstraction related question Direction unclear; possibly a bug, possibly could be improved.

Comments

@nightkr
Copy link
Member

nightkr commented Oct 2, 2020

Pros:

  • The version is not counted for K8s object identity, Deployment.v1.apps/foo and Deployment.v1beta1.apps/foo refer to the same backend object

Downsides:

@clux
Copy link
Member

clux commented Oct 8, 2020

Yeah, the api still require the version field passed in the url, and AFAIK Deployment.v1.apps/foo and Deployment.v1beta1.apps/foo cannot coexist, so there must be some magic in this area.

How does kubectl deal with dynamic queries? I thought it would do it opportunistically by trying the latest versions first.
Have not actually dug into the source for this though.

@clux clux added api Api abstraction related question Direction unclear; possibly a bug, possibly could be improved. labels Oct 8, 2020
@nightkr
Copy link
Member Author

nightkr commented Oct 8, 2020

AFAIK kubectl downloads the entire API surface and then does its own sorting heurestics. It generally works fine.. until it goes hilariously wrong, like how it would prefer Deployment.v1beta1.extensions over Deployment.v1.apps, all the way until extensions/v1beta1 was finally dropped.

@nightkr
Copy link
Member Author

nightkr commented Oct 8, 2020

and AFAIK Deployment.v1.apps/foo and Deployment.v1beta1.apps/foo cannot coexist, so there must be some magic in this area.

Conceptually, K8s stores it internally as Deployment.apps/foo -> (v1, {obj}). The version in the URL is used to either convert it from the stored version to the requested version (on reads), or to convert it to the canonical version (on writes, usually the latest the K8s version knows about).

@clux
Copy link
Member

clux commented Feb 7, 2021

In light of recent PRs and thinking; if we are going to support the runtime features around dynamic objects (like out of the api-resources api), it's only necessary to do the lookup of version once, then fix it for any runtime usage (which will allow users to select how they pick versions in case of ambiguous Deployment versions say).

I think if we get in #385, it will solve the problems with dynamic queries.

@clux clux linked a pull request Feb 7, 2021 that will close this issue
@clux clux closed this as completed in #385 Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Api abstraction related question Direction unclear; possibly a bug, possibly could be improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants