diff options
author | 2017-11-13 09:52:40 +0000 | |
---|---|---|
committer | 2017-11-13 09:52:40 +0000 | |
commit | 52b49f483885def1a5b8dc2dfe8d35ffcc9afe83 (patch) | |
tree | e2ecbba7791c86def85f29c24941bc64b7fa1ce5 /plugin/erratic | |
parent | 46a187df8f055b255f205075e3a69ebeb18d209d (diff) | |
download | coredns-52b49f483885def1a5b8dc2dfe8d35ffcc9afe83.tar.gz coredns-52b49f483885def1a5b8dc2dfe8d35ffcc9afe83.tar.zst coredns-52b49f483885def1a5b8dc2dfe8d35ffcc9afe83.zip |
plugin/health: implement dyn health checks (#1214)
Implement health.Healther in erratic and kubernetes plugin. The
kubernetes' healtcheck is only performed on startup - i.e. turn
healthy after the initial loading.
Erratic follow the drop count: every query%drop turns the healthcheck
unhealthy.
Fixes: #985
Diffstat (limited to 'plugin/erratic')
-rw-r--r-- | plugin/erratic/README.md | 4 | ||||
-rw-r--r-- | plugin/erratic/health.go | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/plugin/erratic/README.md b/plugin/erratic/README.md index f606eef42..3f3f75d3d 100644 --- a/plugin/erratic/README.md +++ b/plugin/erratic/README.md @@ -25,6 +25,10 @@ erratic { * `delay`: delay 1 per **AMOUNT** of queries for **DURATION**, the default for **AMOUNT** is 2 and the default for **DURATION** is 100ms. +## Health + +This plugin implements dynamic health checking. For every dropped query it turns unhealthy. + ## Examples ~~~ corefile diff --git a/plugin/erratic/health.go b/plugin/erratic/health.go new file mode 100644 index 000000000..1d9625e16 --- /dev/null +++ b/plugin/erratic/health.go @@ -0,0 +1,14 @@ +package erratic + +import ( + "sync/atomic" +) + +// Health implements the health.Healther interface. +func (e *Erratic) Health() bool { + q := atomic.LoadUint64(&e.q) + if e.drop > 0 && q%e.drop == 0 { + return false + } + return true +} |