plugin/health: add lameduck mode (#1379)

* plugin/health: add lameduck mode

Add a way to configure lameduck more, i.e. set health to false, stop
polling plugins. Then wait for a duration before shutting down. As the
health middleware is configured early on in the plugin list, it will
hold up all other shutdown, meaning we still answer queries.

* Add New

* More tests

* golint

* remove confusing text
This commit is contained in:
Miek Gieben
2018-01-18 10:40:09 +00:00
committed by GitHub
parent 318bab7795
commit c39e5cd014
5 changed files with 112 additions and 14 deletions

View File

@@ -21,6 +21,17 @@ a 503. *health* periodically (1s) polls plugin that exports health information.
plugin signals that it is unhealthy, the server will go unhealthy too. Each plugin that
supports health checks has a section "Health" in their README.
More options can be set with this extended syntax:
~~~
health [ADDRESS] {
lameduck DURATION
}
~~~
* Where `lameduck` will make the process unhealthy then *wait* for **DURATION** before the process
shuts down.
## Plugins
Any plugin that implements the Healther interface will be used to report health.
@@ -42,3 +53,13 @@ Run another health endpoint on http://localhost:8091.
health localhost:8091
}
~~~
Set a lameduck duration of 1 second:
~~~ corefile
. {
health localhost:8091 {
lameduck 1s
}
}
~~~