skuber icon indicating copy to clipboard operation
skuber copied to clipboard

Watch events of type error can't be parsed

Open jroper opened this issue 5 years ago • 3 comments

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.

jroper avatar May 01 '19 02:05 jroper

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.

doriordan avatar May 13 '19 16:05 doriordan

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)

monktastic avatar Jun 24 '21 18:06 monktastic

I fixed it in the fork https://github.com/hagay3/skuber/commit/45dfdc736ed14de42139edeb57548b66947321af

chessman avatar Jun 25 '21 10:06 chessman