-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
api.delete can return a status object #32
Comments
Tempted to use the either crate to make the return types: pub fn delete(&self, name: &str, dp: &DeleteParams)
-> Result<Either<Object<P, U>, Status>>;
pub fn delete_collection(&self, lp: &ListParams)
-> Result<Either<ObjectList<Object<P, U>, Status>>; |
Hey @clux , I was looking at the api of delete, and I wonder why does it actually return either a resource or a status? Based on the API docs of kubernetes (https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#delete-cronjob-v1beta1-batch) it looks like it should only return a status and never the resource itself? |
Yeah, kubernetes isn't that great at documenting this. See kubernetes/kubernetes#59501 At any rate, this resource itself does appear out of the api, and it's consistent across all resources. k8s-openapi even has a uniform DeleteResponse type that codifies this behaviour. |
Thanks! Do you know if it is the case that whenever a status is returned rather than the deleted object, there was an error? |
No, that should not be true. Kube returns 4xx/5xx errors as Error so errors should not bubble up through Status in an Ok(Either::Right) but should come in as an Generally,
(that's from crd_api example). If you get an In the examples we have slept a bit to wait for k8s to catch up, but it's possible to call a watch on object explicitly if you need to wait for a delete to have occurred. This stuff probably needs better documentation. |
We had assumed that delete could be modelled as:
but turns out kube sends:
on a successful delete.
See #28 for more details. Fix client.request to fix this.
Edit: same is true for delete_collection (when it's not backgrounded).
The text was updated successfully, but these errors were encountered: