flashbots / rpc-endpoint

Flashbots RPC endpoint, to be used with wallets (eg. MetaMask)
https://rpc.flashbots.net
MIT License
184 stars 48 forks source link

[fix] Implement pod draining #115

Closed 0x416e746f6e closed 1 year ago

0x416e746f6e commented 1 year ago

This PR implements separate HTTP server listening on DRAIN_ADDR. When it receives HTTP GET, it will flag server as un-healthy. From that moment on /health endpoint of the main HTTP server will start reporting HTTP 500.

If we use this in conjunction with k8s pre-stop hook, we can make sure that on updates/restarts the pod lives long enough to serve whatever requests the load-balancer would still forward to it until it detects that the server is not healthy.

For example:

          lifecycle:
            preStop:
              httpGet:
                port: 8081
          env:
            - name: DRAIN_ADDR
              value: :8081
metachris commented 1 year ago

Interesting! This PR does a lot and I don't have the resources to review the nuances of these changes right now. Will defer to @dvush and @Ruteri

0x416e746f6e commented 1 year ago

oh, there's also https://github.com/flashbots/rpc-endpoint/pull/114 that somewhat overlaps. sorry @dvush, I didn't see it before. please let me know if I should refactor this PR to build on top of yours.

dvush commented 1 year ago

@0x416e746f6e , yes adapt please. It already handles graceful shutdown except health endpoint part

0x416e746f6e commented 1 year ago

yes adapt please. It already handles graceful shutdown except health endpoint part

@dvush: updated! please have a look.