vladimirvivien / k8s-client-examples

Building stuff with the Kubernetes API
MIT License
118 stars 62 forks source link

watch timeout #2

Open genericgithubuser opened 5 years ago

genericgithubuser commented 5 years ago

This isn't really an issue, but I was hoping to see thoughts on the best way of addressing this. Eventually k8s will timout the watch and close it. Currently it seems this will cause the program to exit. What's the right way to have it so once the timeout happens, this can detect the close, and just re-establish a watch, so that way there is really a continual watch that could run for weeks?

kartik-moolya commented 4 years ago

I have a similar issue where in im watching a object forever, but the cluster times out the oldest connection when required which eventually is my stream watcher. I'm tackling this by running the for loop inside another loop continuously. however the problem with this is, it just replays all the stream (since the start of cluster) back in to the watcher object

vladimirvivien commented 4 years ago

@genericgithubuser @kartik-tavisca which version of the code (Go, Java, etc) are you asking about. I did think the Go client timed out a watcher since the watcher periodically asks for watched resources. But I may be wrong. Let me know exactly in the location of the code this is about.