Commit 9691f888 authored by Geoff Simmons's avatar Geoff Simmons

Generate a Warn event when a VCL update fails after ConfigMap update.

parent 74fb1ce3
...@@ -44,9 +44,7 @@ import ( ...@@ -44,9 +44,7 @@ import (
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
) )
const ( const vclSpecErr = "VCLspecError"
vclSpecErr = "VCLspecError"
)
// SpecUpdaterConfig represents the user configuration for k8s // SpecUpdaterConfig represents the user configuration for k8s
// resources that are considered for a VCL update. // resources that are considered for a VCL update.
...@@ -435,8 +433,8 @@ func (updater *SpecUpdater) Update() error { ...@@ -435,8 +433,8 @@ func (updater *SpecUpdater) Update() error {
return err return err
} }
if err = updater.vc.Update(&spec); err != nil { if err = updater.vc.Update(&spec); err != nil {
// XXX generate Warn event, inc counter updater.vc.ErrorEvt(varnish.UpdateErr, "VCL update failed: %s",
updater.log.Errorf("Update failed: %s", err) err)
return err return err
} }
// XXX generate Info event, inc counter(?) // XXX generate Info event, inc counter(?)
......
...@@ -36,6 +36,8 @@ import ( ...@@ -36,6 +36,8 @@ import (
) )
const ( const (
// UpdateErr is the Event reason name when a VCL update fails
UpdateErr = "UpdateFailure"
connectErr = "ConnectFailure" connectErr = "ConnectFailure"
vsmErr = "SharedMemoryFailure" vsmErr = "SharedMemoryFailure"
pingErr = "PingFailure" pingErr = "PingFailure"
...@@ -47,7 +49,6 @@ const ( ...@@ -47,7 +49,6 @@ const (
panic = "Panic" panic = "Panic"
vclListErr = "VCLListFailure" vclListErr = "VCLListFailure"
discardErr = "VCLDiscardFailure" discardErr = "VCLDiscardFailure"
updateErr = "UpdateFailure"
monitorGood = "MonitorGood" monitorGood = "MonitorGood"
) )
...@@ -169,11 +170,11 @@ func (vc *Controller) monitor(monitorIntvl time.Duration) { ...@@ -169,11 +170,11 @@ func (vc *Controller) monitor(monitorIntvl time.Duration) {
} }
if vc.updater == nil { if vc.updater == nil {
vc.ErrorEvt(updateErr, "Updater not initialized") vc.ErrorEvt(UpdateErr, "Updater not initialized")
metrics.updateErrs.Inc() metrics.updateErrs.Inc()
good = false good = false
} else if err := vc.updater.Update(); err != nil { } else if err := vc.updater.Update(); err != nil {
vc.ErrorEvt(updateErr, "Errors updating Varnish: %+v", vc.ErrorEvt(UpdateErr, "Errors updating Varnish: %+v",
err) err)
metrics.updateErrs.Inc() metrics.updateErrs.Inc()
good = false good = false
......
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