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 (
)
const (
ingressClassKey = "kubernetes.io/ingress.class"
annotationPrefix = "ingress.varnish-cache.org/"
selfShardKey = "self-sharding"
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"
ingressClassKey = "kubernetes.io/ingress.class"
annotationPrefix = "ingress.varnish-cache.org/"
varnishSvcKey = annotationPrefix + "varnish-svc"
)
func (worker *NamespaceWorker) getVarnishSvcForIng(
......
......@@ -105,9 +105,19 @@ func (worker *NamespaceWorker) enqueueIngressForService(
// Return true if changes in Varnish services may lead to changes in
// the VCL config generated for the Ingress.
func isVarnishInVCLSpec(ing *extensions.Ingress) bool {
_, selfShard := ing.Annotations[selfShardKey]
return selfShard
func (worker *NamespaceWorker) isVarnishInVCLSpec(ing *extensions.Ingress) bool {
vcfgs, err := worker.vcfg.List(labels.Everything())
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 {
......@@ -143,7 +153,7 @@ func (worker *NamespaceWorker) syncSvc(key string) error {
ingSvc.Name != svc.Name {
continue
}
if !isVarnishInVCLSpec(ing) {
if !worker.isVarnishInVCLSpec(ing) {
continue
}
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