Skip to content

Continuos loop in KubeServiceState when Kubernetes api server returns error #19

@ecejnj42

Description

@ecejnj42

Version

5.0.0

Context

KubeServiceState is using a WebSocket to connect to k8s api server to watch for change on "endpoints" from an specific version (resourceVersion)
This mechanism is working correctly until there is an error reported from k8s api server similar to this one:

{\"type\":\"ERROR\",\"object\":{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"too old resource version: 320409672 (320435551)\",\"reason\":\"Expired\",\"code\":410}}

No clear when this happens but probably when there are many changes and subscribed version gets too old.
In such situations the WebSocket is closed (probably by k8 api server) but current code in KubeServiceState just re-opens and subscribe with same old version.
This causes a continuos loop of closing because of error and re-opening with old version.

I guess that in such situation communications should be reinitiated again by the http client in KubeResolverImpl to force a fresh new version (resourceVersion)

Steps to reproduce

Best way to reproduce the error (although not always happens) is just to scalate-in the instances (increase PODs for related service) and later scalate-out (decrease PODs for related service).
Note during this whole process of scalate-in and scalate-out some "traffic" should be sent to the service (other way the WebSocket is disposed and the problem dissapears)

Do you have a reproducer?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions