Commit 29f33b0e authored by Geoff Simmons's avatar Geoff Simmons

Service/Endpoints syncs are Noop if no Ingress update is necessary.

That is, if they are neither viking services, nor an IngressBackend
for any Ingress with the viking Ingress class.

This reduces the Event noise for Services that have nothing to do
with viking.
parent 904c7987
......@@ -69,6 +69,7 @@ func (worker *NamespaceWorker) syncEndp(key string) update.Status {
}
worker.log.Tracef("Update ingresses for endpoints %s", key)
requeued := make([]string, 0, len(ings))
for _, ing := range ings {
if !worker.isVarnishIngress(ing) {
worker.log.Tracef("Ingress %s/%s: not Varnish",
......@@ -78,8 +79,16 @@ func (worker *NamespaceWorker) syncEndp(key string) update.Status {
if status = worker.addOrUpdateIng(ing); status.IsError() {
return status
}
requeued = append(requeued, ing.Namespace+"/"+ing.Name)
}
return update.MakeSuccess("")
if len(requeued) == 0 {
return update.MakeNoop(
"Endpoints %s/%s: not an IngressBackend for any "+
"viking Ingress", svc.Namespace, svc.Name)
}
return update.MakeSuccess(
"Endpoints %s/%s: re-synced Ingresses for IngressBackend: %s",
svc.Namespace, svc.Name, requeued)
}
func (worker *NamespaceWorker) addEndp(key string) update.Status {
......
......@@ -125,15 +125,22 @@ func (worker *NamespaceWorker) enqueueIngressForService(
if status.Type != update.Success {
return status
}
requeued := make([]string, 0, len(ings))
for _, ing := range ings {
if !worker.isVarnishIngress(ing) {
continue
}
worker.queue.Add(&SyncObj{Type: Update, Obj: ing})
requeued = append(requeued, ing.Namespace+"/"+ing.Name)
}
if len(requeued) == 0 {
return update.MakeNoop(
"Service %s/%s: not an IngressBackend for any "+
"viking Ingress", svc.Namespace, svc.Name)
}
return update.MakeSuccess(
"Service %s/%s: re-syncing Ingresses for IngressBackend",
svc.Namespace, svc.Name)
"Service %s/%s: re-syncing Ingresses for IngressBackend: %s",
svc.Namespace, svc.Name, requeued)
}
// Return true if changes in Varnish services may lead to changes in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment