jlevesy / prometheus-elector

Leader election for prometheus
25 stars 2 forks source link

Add healthcheck for the local container #37

Closed jlevesy closed 1 year ago

jlevesy commented 1 year ago

What Does This PR do?

This PR builds on the changes introduced in #36 and adds an health checker that periodically polls the Prometheus's health endpoint.

It also introduces a timeout for every HTTP calls being made (notifier, and readiness).

Closes #35

How to Test This PR?

It turns our that the quit endpoint allows us to simulate a container failure, yay.

make run
# port forward to one of the elector pod.
k port-forward prometheus-elector-dev-1 9090:9090

# politely ask prometheus to stop.
curl -XPUT localhost:9090/-/quit

# monitor the logs of this pod

The expected behavior is the following:

Good PR Checklist

Additional notes

Review commit by commit is encouraged!