haveachin / infrared

An ultra lightweight minecraft reverse proxy and idle placeholder
https://infrared.dev
GNU Affero General Public License v3.0
722 stars 60 forks source link

Use Kubernetes Informer instead of simple Watch #186

Closed marratj closed 5 months ago

marratj commented 11 months ago

This PR improves upon my last one that included the Kubernetes service discovery mechanism.

Originally, I used a simple Watch, but this can lead to changes not being tracked anymore after a while, because the watcher has no builtin mechanism to recover stalled or lost connections to the Kubernetes API server and just silently receives no more updates.

The Kubernetes Informer factory instead is built on top of the Watch mechanism with exactly those issues in mind in that it does an automatic re-list and re-watch to recover from any closed connections (due to network errors or the Kubernetes API server being restarted, etc...).

(See also https://github.com/kubernetes-client/javascript/issues/377 - this is about the JavaScript SDK, but the underlying mechanisms are the same in the Go Client SDK).

haveachin commented 5 months ago

Will circle back to that when the rewrite is ready.