diff options
author | 2019-03-22 08:32:40 -0600 | |
---|---|---|
committer | 2019-03-22 14:32:40 +0000 | |
commit | a3dd8cdf8de1a9aacc36fe8cf0f268e69bd8a45d (patch) | |
tree | 4d0ca8491e0340e22aa8b3631040c92fbd071cc5 /plugin/kubernetes/controller.go | |
parent | 43c3e0ab68fc103967bfb9bec0363d42a5964dac (diff) | |
download | coredns-a3dd8cdf8de1a9aacc36fe8cf0f268e69bd8a45d.tar.gz coredns-a3dd8cdf8de1a9aacc36fe8cf0f268e69bd8a45d.tar.zst coredns-a3dd8cdf8de1a9aacc36fe8cf0f268e69bd8a45d.zip |
Add `namespace_labels` configuration for kubernetes plugin (#2707)
Diffstat (limited to 'plugin/kubernetes/controller.go')
-rw-r--r-- | plugin/kubernetes/controller.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugin/kubernetes/controller.go b/plugin/kubernetes/controller.go index 1c2b7d8ad..41416ae0a 100644 --- a/plugin/kubernetes/controller.go +++ b/plugin/kubernetes/controller.go @@ -54,6 +54,7 @@ type dnsControl struct { client kubernetes.Interface selector labels.Selector + namespaceSelector labels.Selector svcController cache.Controller podController cache.Controller @@ -81,9 +82,12 @@ type dnsControlOpts struct { initEndpointsCache bool resyncPeriod time.Duration ignoreEmptyService bool + // Label handling. labelSelector *meta.LabelSelector selector labels.Selector + namespaceLabelSelector *meta.LabelSelector + namespaceSelector labels.Selector zones []string endpointNameMode bool @@ -94,6 +98,7 @@ func newdnsController(kubeClient kubernetes.Interface, opts dnsControlOpts) *dns dns := dnsControl{ client: kubeClient, selector: opts.selector, + namespaceSelector: opts.namespaceSelector, stopCh: make(chan struct{}), zones: opts.zones, endpointNameMode: opts.endpointNameMode, @@ -140,10 +145,12 @@ func newdnsController(kubeClient kubernetes.Interface, opts dnsControlOpts) *dns dns.nsLister, dns.nsController = cache.NewInformer( &cache.ListWatch{ - ListFunc: namespaceListFunc(dns.client, dns.selector), - WatchFunc: namespaceWatchFunc(dns.client, dns.selector), + ListFunc: namespaceListFunc(dns.client, dns.namespaceSelector), + WatchFunc: namespaceWatchFunc(dns.client, dns.namespaceSelector), }, - &api.Namespace{}, opts.resyncPeriod, cache.ResourceEventHandlerFuncs{}) + &api.Namespace{}, + opts.resyncPeriod, + cache.ResourceEventHandlerFuncs{}) return &dns } |