I need to create a K8S proxy watcher api-server, it receives list
requests (for some k8s resources) with watch=true
from clients, and proxy requests to the real upstream K8S API-Server, then receives responses from upstream continuously and send them back.
This is what I did:
- For server side, original K8S api-server implements
watch
operation using a long-lived HTTP connection, plus chunked response. In code there is aWatchServer
struct to servewatch
requests
its first member Watching
needs an struct implements watch.Interface
interface. So I have to find a suitable obj to fill this field so that I can implement a similar K8S apiserver.
- For client side, I have to get real watch events from upstream server, so I used
SharedInformer
in K8S, use add/delete/update event handler to receive up-to-date event notification.
The problem is that SharedInformer
doesn’t implement watch.Interface
interface, cannot be used to create WatchServer
struct. So are there any ways to connect these two things together? Or is there any objs that can be used to implement my requirements?