mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Instead of hardcoding plugin lists in autopath/health, use interfaces. (#1306)
Switched health and autopath plugin to allow any plugins to be used instead of a hardcoded list. I did not switch federation over since it wasn't obvious that anything other than kubernetes could be used with it. Fixes #1291
This commit is contained in:
committed by
Miek Gieben
parent
99e163c375
commit
a469a17cdf
@@ -18,10 +18,7 @@ supports health checks has a section "Health" in their README.
|
||||
|
||||
## Plugins
|
||||
|
||||
The following plugins report health to the health plugin:
|
||||
|
||||
* erratic
|
||||
* kubernetes
|
||||
Any plugin that implements the Healther interface will be used to report health.
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@@ -36,9 +36,3 @@ func (h *health) poll() {
|
||||
}
|
||||
h.SetOk(true)
|
||||
}
|
||||
|
||||
// Plugins that implements the Healther interface.
|
||||
var healthers = map[string]bool{
|
||||
"erratic": true,
|
||||
"kubernetes": true,
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ func setup(c *caddy.Controller) error {
|
||||
h := &health{Addr: addr}
|
||||
|
||||
c.OnStartup(func() error {
|
||||
for he := range healthers {
|
||||
m := dnsserver.GetConfig(c).Handler(he)
|
||||
if x, ok := m.(Healther); ok {
|
||||
plugins := dnsserver.GetConfig(c).Handlers()
|
||||
for _, p := range plugins {
|
||||
if x, ok := p.(Healther); ok {
|
||||
h.h = append(h.h, x)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user