diff --git a/cmd/cleanup-controller/handlers/admission/resource/handlers.go b/cmd/cleanup-controller/handlers/admission/resource/handlers.go index f6e75811a4..4d15e2f3fa 100644 --- a/cmd/cleanup-controller/handlers/admission/resource/handlers.go +++ b/cmd/cleanup-controller/handlers/admission/resource/handlers.go @@ -2,6 +2,7 @@ package resource import ( "context" + "fmt" "time" "github.com/go-logr/logr" @@ -18,7 +19,7 @@ func Validate(ctx context.Context, logger logr.Logger, request handlers.Admissio } if err := validation.ValidateTtlLabel(ctx, metadata); err != nil { logger.Error(err, "metadatas validation errors") - return admissionutils.ResponseSuccess(request.UID, err.Error()) + return admissionutils.ResponseSuccess(request.UID, fmt.Sprintf("cleanup.kyverno.io/ttl label value cannot be parsed as any recognizable format (%s)", err.Error())) } return admissionutils.ResponseSuccess(request.UID) } diff --git a/pkg/controllers/ttl/controller.go b/pkg/controllers/ttl/controller.go index 0dd295d663..b89159a7f8 100644 --- a/pkg/controllers/ttl/controller.go +++ b/pkg/controllers/ttl/controller.go @@ -97,19 +97,19 @@ func (c *controller) handleUpdate(oldObj, newObj interface{}) { func (c *controller) Start(ctx context.Context, workers int) { for i := 0; i < workers; i++ { c.wg.StartWithContext(ctx, func(ctx context.Context) { - defer c.logger.Info("worker stopped") - c.logger.Info("worker starting ....") + defer c.logger.V(3).Info("worker stopped") + c.logger.V(3).Info("worker starting ....") wait.UntilWithContext(ctx, c.worker, 1*time.Second) }) } } func (c *controller) Stop() { - defer c.logger.Info("queue stopped") + defer c.logger.V(3).Info("queue stopped") defer c.wg.Wait() // Unregister the event handlers c.deregisterEventHandlers() - c.logger.Info("queue stopping ....") + c.logger.V(3).Info("queue stopping ....") c.queue.ShutDown() } @@ -129,7 +129,7 @@ func (c *controller) deregisterEventHandlers() { c.logger.Error(err, "failed to deregister event handlers") return } - c.logger.Info("deregistered event handlers") + c.logger.V(3).Info("deregistered event handlers") } func (c *controller) worker(ctx context.Context) { diff --git a/pkg/controllers/ttl/manager.go b/pkg/controllers/ttl/manager.go index 899e023974..fa76b2fa5b 100644 --- a/pkg/controllers/ttl/manager.go +++ b/pkg/controllers/ttl/manager.go @@ -130,7 +130,7 @@ func (m *manager) start(ctx context.Context, gvr schema.GroupVersionResource, wo cont, cancel := context.WithCancel(ctx) var wg wait.Group wg.StartWithContext(cont, func(ctx context.Context) { - logger.Info("informer starting...") + logger.V(3).Info("informer starting...") informer.Informer().Run(cont.Done()) }) stopInformer := func() { @@ -148,7 +148,7 @@ func (m *manager) start(ctx context.Context, gvr schema.GroupVersionResource, wo stopInformer() return err } - logger.Info("controller starting...") + logger.V(3).Info("controller starting...") controller.Start(cont, workers) m.resController[gvr] = func() { stopInformer() @@ -169,8 +169,8 @@ func (m *manager) filterPermissionsResource(resources []schema.GroupVersionResou } func (m *manager) reconcile(ctx context.Context, workers int) error { - defer m.logger.Info("manager reconciliation done") - m.logger.Info("start manager reconciliation") + defer m.logger.V(3).Info("manager reconciliation done") + m.logger.V(3).Info("beginning reconciliation", "interval", m.interval) desiredState, err := m.getDesiredState() if err != nil { return err