mirror of
https://github.com/coredns/coredns.git
synced 2025-10-30 17:53:21 -04:00
mw/kubernetes: rewrite parseRequest
Stop looking at the qtype in parseRequest and make k.Namespace a map. Fallout from this is that pkg/strings as it is not used anymore. Also add a few helper functions to make unexposed namespaces easier to see in the code. Add wildcard tests to the middleware tests.
This commit is contained in:
@@ -62,13 +62,9 @@ func setup(c *caddy.Controller) error {
|
||||
}
|
||||
|
||||
func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) {
|
||||
k8s := &Kubernetes{
|
||||
ResyncPeriod: defaultResyncPeriod,
|
||||
interfaceAddrsFunc: localPodIP,
|
||||
PodMode: PodModeDisabled,
|
||||
Proxy: proxy.Proxy{},
|
||||
autoPathSearch: searchFromResolvConf(),
|
||||
}
|
||||
k8s := New([]string{""})
|
||||
k8s.interfaceAddrsFunc = localPodIP
|
||||
k8s.autoPathSearch = searchFromResolvConf()
|
||||
|
||||
for c.Next() {
|
||||
zones := c.RemainingArgs()
|
||||
@@ -115,7 +111,9 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) {
|
||||
case "namespaces":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) > 0 {
|
||||
k8s.Namespaces = append(k8s.Namespaces, args...)
|
||||
for _, a := range args {
|
||||
k8s.Namespaces[a] = true
|
||||
}
|
||||
continue
|
||||
}
|
||||
return nil, c.ArgErr()
|
||||
|
||||
Reference in New Issue
Block a user