uber / kraken

P2P Docker registry capable of distributing TBs of data in seconds
Apache License 2.0
6.11k stars 416 forks source link

Add readiness endpoints for all services #371

Open Anton-Kalpakchiev opened 1 day ago

Anton-Kalpakchiev commented 1 day ago

Each service has a "health" endpoint that is used to check if the service is healthy, i.e. running. While this provides some information about the service's state, observability can be improved by implementing a "readiness" endpoint, which checks if the service is able to serve traffic.

In addition to a simple health check, the readiness endpoint verifies that all service dependencies are ready. For instance, the origin would check if the remote storage backends (e.g. S3) are reachable.

The endpoint has several uses:

  1. Provide a binary signal on a service's health during new version deployments - a failure from the endpoint could signal that a regression has been made, which could trigger a rollback.
  2. The agent's readiness endpoint signals whether Kraken is ready to serve images on a host. The endpoint can be called before scheduling a workload on the host.