-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
get
with Api::all()
response can't be 404
#1276
Comments
This is expected and documented behavior, see the You can only use the all client to get cluster wide resources or to list namespaced resources across all (multiple) namespaces. To retrieve a specific namespaced resource you need a namespaced api for that resource. Your first example, what if a resource with this name existed in multiple namespaces, which one should it return? |
Thank you for your reply. I have a better understanding now of why The 404 error is indeed confusing as it might give the impression that 'get' is unable to retrieve named resources, rather than indicating the absence of a specified namespace.Perhaps when using |
get
with Api::all()
response can't be 404
We could improve the docs here, they are clear to me, but I am also quite experienced with the API. We can't give a different error because the client doesn't know that there is no such cluster wide resource and we do not differentiate in the There may be a future with another higher level client on top of API which is aware of this (maybe a trait with the scope as a associated type or a different type all together). |
I am wondering if we should try to lean more on resource scopes in Just like we limit
The trick lies in distinguishing:
We could probably introduce an Other than that, maybe if we split (I did originally hope to iron out more of these issues with the on-client request method in #1032, but progress is slow and need more thought on the more difficult subresource cases - also i'm like 3 prs deep in there so need a new strategy) |
I don't think we should do this in the |
Current and expected behavior
I have an HttpRoute with the name "httproute_name" in the "default" namespace. When attempting to retrieve the API using the following code snippet:The result ofapi
is always a 404 error, indicating that the resource is not found. However, when I use the following code instead:Theapi
retrieval works as expected and returns the resource.I'm puzzled by this behavior. My understanding was that theApi::all
function should work across namespaces, and interestingly, when usingApi::all
, the list operation seems to return the correct results. It seems inconsistent that theget
operation fails with a 404 when usingApi::all
, but works withApi::namespaced
.Could you please help me understand why this is happening? Is theall
function not meant to be cross-namespace, and if so, why is the list operation returning expected results?Update:
When utilizing the 'get' method with the 'all' API call, a 404 response should not be generated.
Possible solution
When using the 'get' function with the 'all' API call, instead of returning a 404 error, it would be more helpful to provide an error message that suggests using the namespaced API for more accurate results.
Additional context
No response
Environment
Configuration and features
Affected crates
No response
Would you like to work on fixing this bug?
None
The text was updated successfully, but these errors were encountered: