From 93e3cafa2cbcaf65e17cf06b154ca3919e00c90c Mon Sep 17 00:00:00 2001 From: Craig Ingram Date: Wed, 21 Apr 2021 20:44:33 -0400 Subject: [PATCH] Log VCL discard error instead of returning (#36) --- pkg/varnishcontroller/controller/controller_varnish.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/varnishcontroller/controller/controller_varnish.go b/pkg/varnishcontroller/controller/controller_varnish.go index 29ed5095..7b0ecca2 100644 --- a/pkg/varnishcontroller/controller/controller_varnish.go +++ b/pkg/varnishcontroller/controller/controller_varnish.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/ibm/varnish-operator/api/v1alpha1" "github.com/ibm/varnish-operator/pkg/logger" "github.com/ibm/varnish-operator/pkg/varnishcontroller/events" @@ -58,11 +60,11 @@ func (r *ReconcileVarnish) reconcileVarnish(ctx context.Context, vc *v1alpha1.Va // cleanup unused VCLs. It cleans up only VCLs created by varnish controller (those that start with our prefix) for _, vclConfig := range configsList { if vclConfig.Status == varnishadm.VCLStatusAvailable && strings.HasPrefix(vclConfig.Name, VCLVersionPrefix) { - err := r.varnish.Discard(vclConfig.Name) - if err != nil { - return errors.Wrapf(err, "Can't delete VCL config %q", vclConfig.Name) + if err := r.varnish.Discard(vclConfig.Name); err != nil { + logr.Error(fmt.Sprintf("Can't delete VCL config %q", vclConfig.Name), zap.Error(err)) + } else { + cleanedUpVCLs++ } - cleanedUpVCLs++ } }