aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2019-01-29 14:15:49 -0500
committerGravatar John Belamaric <jbelamaric@google.com> 2019-01-29 11:15:49 -0800
commit68e09f00a41af74234793b0b9a118438fb72969c (patch)
tree0f325f9808823bf6e41d73bf00777b70c7391a61 /plugin/kubernetes
parent0eff7f37979533d079528e3618e26a16bc33136e (diff)
downloadcoredns-68e09f00a41af74234793b0b9a118438fb72969c.tar.gz
coredns-68e09f00a41af74234793b0b9a118438fb72969c.tar.zst
coredns-68e09f00a41af74234793b0b9a118438fb72969c.zip
skip pushing watch updates when there are no watches (#2513)
Diffstat (limited to 'plugin/kubernetes')
-rw-r--r--plugin/kubernetes/watch.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugin/kubernetes/watch.go b/plugin/kubernetes/watch.go
index 5c52cc4f9..4db14ad3a 100644
--- a/plugin/kubernetes/watch.go
+++ b/plugin/kubernetes/watch.go
@@ -96,10 +96,16 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) {
switch ob := obj.(type) {
case *object.Service:
dns.updateModifed()
+ if len(dns.watched) == 0 {
+ return
+ }
dns.sendServiceUpdates(ob)
case *object.Endpoints:
if newObj == nil || oldObj == nil {
dns.updateModifed()
+ if len(dns.watched) == 0 {
+ return
+ }
dns.sendEndpointsUpdates(ob)
return
}
@@ -109,9 +115,15 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) {
return
}
dns.updateModifed()
+ if len(dns.watched) == 0 {
+ return
+ }
dns.sendEndpointsUpdates(endpointsSubsetDiffs(p, ob))
case *object.Pod:
dns.updateModifed()
+ if len(dns.watched) == 0 {
+ return
+ }
dns.sendPodUpdates(ob)
default:
log.Warningf("Updates for %T not supported.", ob)