skuber
skuber copied to clipboard
Watch events of type error can't be parsed
Skuber assumes that watch events will always contain the object that is being watched, but if the event type is error, this isn't true, here's an example payload for error events:
{
"type": "ERROR",
"object": {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "too old resource version: 2743975 (2744775)",
"reason": "Gone",
"code": 410
}
}
Now that error I need to fix of course, but skuber shouldn't fail with a parse error when getting it. The watch API perhaps needs to be updated to handle error events differently.
I agree that Skuber should support handling Error events properly. Perhaps adding a new, optional errors
sink parameter to the API watch calls could address this, the watch flow would basically partition its output so that errors go to the error sink (if present), while create/update/delete events with valid objects continue to be consumed from the WatchEvent source returned by the watch call.
Ugh, just got bitten by this. Spent many hours trying to debug this unhelpful error:
skuber.api.client.package$K8SException: Status(v1,Status,ListMeta(,,None),None,Some(Error parsing watched object),None,Some(List((/object/spec,List(JsonValidationError(List(error.path.missing),ArraySeq()))), (/object/status,List(JsonValidationError(List(error.expected.jsobject),ArraySeq()))))),None)
I fixed it in the fork https://github.com/hagay3/skuber/commit/45dfdc736ed14de42139edeb57548b66947321af