mirror of
https://github.com/coredns/coredns.git
synced 2025-12-19 00:25:11 -05:00
mw/kubernetes: Rewrite parseRequest and Readability improvements (#939)
* 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. * Fix tests Add a whole bunch of comments to document what we are trying to do. * This is now answered * up coverage * duh * Update testcase * Make it nodata
This commit is contained in:
@@ -59,13 +59,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()
|
||||
@@ -112,7 +108,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