Commit 6217f87e authored by Geoff Simmons's avatar Geoff Simmons

Monitor discards cold VCL configs for previous Ingresses.

parent c53813d1
...@@ -26,15 +26,10 @@ ...@@ -26,15 +26,10 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*
* VCL housekeeping
* either discard the previously active VCL immediately on new vcl.use
* or periodically clean up
*/
package varnish package varnish
import ( import (
"strings"
"time" "time"
"code.uplex.de/uplex-varnish/varnishapi/pkg/admin" "code.uplex.de/uplex-varnish/varnishapi/pkg/admin"
...@@ -81,7 +76,23 @@ func (vc *VarnishController) checkInst(inst *varnishSvc) { ...@@ -81,7 +76,23 @@ func (vc *VarnishController) checkInst(inst *varnishSvc) {
// XXX clear the panic? Should be configurable // XXX clear the panic? Should be configurable
} }
// XXX discard cold & unlabelled ingress configs vcls, err := adm.VCLList()
if err != nil {
vc.log.Error("Error getting VCL list at %s: %v", inst.addr, err)
return
}
for _, vcl := range vcls {
if strings.HasPrefix(vcl.Name, ingressPrefix) &&
vcl.State == admin.ColdState {
if err = adm.VCLDiscard(vcl.Name); err != nil {
vc.log.Errorf("Error discarding VCL %s at %s: "+
"%v", vcl.Name, inst.addr, err)
return
}
vc.log.Infof("Discarded VCL %s at %s", vcl.Name,
inst.addr)
}
}
} }
func (vc *VarnishController) monitor() { func (vc *VarnishController) monitor() {
......
...@@ -26,16 +26,6 @@ ...@@ -26,16 +26,6 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*
// TODO
* VCL housekeeping
* either discard the previously active VCL immediately on new vcl.use
* or periodically clean up
* monitoring
* periodically call ping, status, panic.show when otherwise idle
*/
package varnish package varnish
import ( import (
......
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