Commit 7ea10bfc authored by Geoff Simmons's avatar Geoff Simmons

Bugfix determining whether a Varnish Service sync requires VCL reload.

And remove some dead code while we're at it.
parent d733fb1d
...@@ -45,16 +45,9 @@ import ( ...@@ -45,16 +45,9 @@ import (
) )
const ( const (
ingressClassKey = "kubernetes.io/ingress.class" ingressClassKey = "kubernetes.io/ingress.class"
annotationPrefix = "ingress.varnish-cache.org/" annotationPrefix = "ingress.varnish-cache.org/"
selfShardKey = "self-sharding" varnishSvcKey = annotationPrefix + "varnish-svc"
shardProbeTimeoutKey = "self-sharding-probe-timeout"
shardProbeIntervalKey = "self-sharding-probe-interval"
shardProbeInitialKey = "self-sharding-probe-initial"
shardProbeWindowKey = "self-sharding-probe-window"
shardProbeThresholdKey = "self-sharding-probe-threshold"
shardMax2ndTTL = "self-sharding-max-secondary-ttl"
varnishSvcKey = annotationPrefix + "varnish-svc"
) )
func (worker *NamespaceWorker) getVarnishSvcForIng( func (worker *NamespaceWorker) getVarnishSvcForIng(
......
...@@ -105,9 +105,19 @@ func (worker *NamespaceWorker) enqueueIngressForService( ...@@ -105,9 +105,19 @@ func (worker *NamespaceWorker) enqueueIngressForService(
// Return true if changes in Varnish services may lead to changes in // Return true if changes in Varnish services may lead to changes in
// the VCL config generated for the Ingress. // the VCL config generated for the Ingress.
func isVarnishInVCLSpec(ing *extensions.Ingress) bool { func (worker *NamespaceWorker) isVarnishInVCLSpec(ing *extensions.Ingress) bool {
_, selfShard := ing.Annotations[selfShardKey] vcfgs, err := worker.vcfg.List(labels.Everything())
return selfShard if err != nil {
worker.log.Warnf("Error retrieving VarnishConfigs in "+
"namespace %s: %v", worker.namespace, err)
return false
}
for _, vcfg := range vcfgs {
if vcfg.Spec.SelfSharding != nil {
return true
}
}
return false
} }
func (worker *NamespaceWorker) syncSvc(key string) error { func (worker *NamespaceWorker) syncSvc(key string) error {
...@@ -143,7 +153,7 @@ func (worker *NamespaceWorker) syncSvc(key string) error { ...@@ -143,7 +153,7 @@ func (worker *NamespaceWorker) syncSvc(key string) error {
ingSvc.Name != svc.Name { ingSvc.Name != svc.Name {
continue continue
} }
if !isVarnishInVCLSpec(ing) { if !worker.isVarnishInVCLSpec(ing) {
continue continue
} }
updateVCL = true updateVCL = true
......
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