mw/authpath: hook in kubernetees (#860)

Call out to kubernetes to get the search path - this still needs
to return something sensible, but all infrastructure has landed
to make it work.
This commit is contained in:
Miek Gieben 2017-08-09 04:06:48 -07:00 committed by GitHub
parent b46b9880bd
commit b8e2c476a5
3 changed files with 35 additions and 14 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/middleware"
"github.com/coredns/coredns/middleware/kubernetes"
"github.com/mholt/caddy"
"github.com/miekg/dns"
@ -25,14 +26,14 @@ func setup(c *caddy.Controller) error {
}
c.OnStartup(func() error {
// So we know for sure the mw is initialized.
// Do this in OnStartup, so all middleware has been initialized.
// TODO(miek): fabricate test to proof this is not thread safe.
m := dnsserver.GetMiddleware(c, mw)
switch mw {
case "kubernetes":
m = m
//if k, ok := m.(kubernetes.Kubernetes); ok {
//&ap.searchFunc = k.AutoPath
//}
if k, ok := m.(kubernetes.Kubernetes); ok {
ap.searchFunc = k.AutoPath
}
}
return nil
})