-
Notifications
You must be signed in to change notification settings - Fork 43
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
Resource trait to expose resource Scope #65
Comments
The spec doesn't directly contain the information about whether a particular resource is cluster- or namespace-scoped. The golang code has this information of course, via The only way I can see is to indirectly infer it by first seeing if the resource has an associated As far as adding
This way the constaint can be enforced at compile-time, via (You would think the latter would also work better with Rust's coherence rules, since you cannot impl This is also important bcause there are some impls of |
That sounds annoying. Maybe we request that exposed upstream?
Yeah, having messed around a bit (in the linked pr), your suggestions are a lot a more practical to implement than a new string. Even your first one gets us pretty much all the way there, except for having to do some of the safe-guarding at runtime rather than compile time due to the specialization snag you mentioned. It would be a big improvement over having opaque 405 errors regardless. The second example sounds even better (if we can indeed do the type of
This type of "tri-state" (cluster/namespaced/unscoped) is useful regardless because people might want to have a view of a namespaced resource for --all-namespaces (in which case we want to make sure they don't do a straight read/create on it). BTW: I thought the subresources like |
If this is possible, how do you feel about adding:
To the Resource trait?
This would allow us to guide users towards using the right scope for a resource. Currently, we have some level of hardcoding of cluster-level resources in
kube
(so users don't try to get namespacedClusterRoles
etc), but the error exists both ways.If the user chooses a cluster scope for a namespaced resource it leads to hard to decipher 405 errors. See kube-rs/kube#194
The text was updated successfully, but these errors were encountered: