-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Client.resource(resource).get() does not return latest resource #4574
Comments
You need to use fromServer() to force the fetch for a get when using resource(foo). When the docs refer to the "current item" that does include the one passed into the resource method. |
Maybe I just don't understand the design here but I find it extremely odd that a call to a client with a get returns the exact object that you passed to it. I am sure many people will intuitively misunderstand this |
I have tried to migrate to the new Do you think it makes sense to change the default behaviour to help users? I think if they just want to get the same resource back they would not call the client. |
I'm not sure what the rationale was for having this naming / functioning. Feel free to capture something if want to propose different signatures.
Sure, feel free to open a pr for any missing javadocs. |
This behavior was already how the client functioned for the existing resource and resourceList methods, so it carried forward once the resource method was generalized - as such existing usage wouldn't change. I don't think it was spelled out in the release notes that you need to call fromServer when switching to the resource api from the other style - that was an over site. As for changing the default behavior of what a get means that can be expanded to @manusa @rohanKanojia and others. |
Considering #4533 this might be a problem, since users might actually want to use However, I do agree that the current default behavior is misleading and is error-prone. So I think it does make sense to change the default behavior (always fromServer), but as long as we provide a way to retrieve the current local item(s). Adding relevant documentation and breaking change notice would also be a must if we opt for this. |
It feels like if the user calls
and expect to get the deserialized value, then we are a little bit mixing two very different functionalities. One is a simple deserialization problem (why not just use the Jackson ObjectMapper?) and one is the kubernetes client getting the resource which as you point out should always get |
Yep, but the functionality is there (just like the As I said, I'm not against changing the default behavior, especially because the semantics of the |
@manusa to make sure the set of changes being proposed:
There will be some associated test and internal changes to align to this. Let me know if this sounds right and I can make the changes. |
This sounds good (sorry for the belated reply) |
Describe the bug
I have been trying to use the following code snippet to get the latest version of a given custom resource:
However it seems that this does not actually return the latest version but simply the resource I passed to the call...
On the contrary when I do:
it works and gives the latest resource.
This seems to be an inconsitency in the api.
Fabric8 Kubernetes Client version
6.2.0
Steps to reproduce
Compare the output of:
vs
Expected behavior
They should both return the latest version of the resource. But only the second works
Runtime
minikube
Kubernetes API Server version
1.25.3@latest
Environment
macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: