From 465e582657354a892c18396d738e7f1dc75a99de Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:30:30 +0000 Subject: [PATCH] fix(background-controller): reduce logging for URs (#11616) (#11617) Signed-off-by: Frederic Mereu Co-authored-by: Frederic M <43849398+fad3t@users.noreply.github.com> --- pkg/policy/generate.go | 8 ++++---- pkg/policy/mutate.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/policy/generate.go b/pkg/policy/generate.go index 76da4d4c8f..510258e866 100644 --- a/pkg/policy/generate.go +++ b/pkg/policy/generate.go @@ -22,7 +22,7 @@ import ( func (pc *policyController) handleGenerate(policyKey string, policy kyvernov1.PolicyInterface) error { logger := pc.log.WithName("handleGenerate").WithName(policyKey) - logger.Info("update URs on policy event") + logger.V(4).Info("update URs on policy event") if err := pc.syncDataPolicyChanges(policy, false); err != nil { logger.Error(err, "failed to create UR on policy event") @@ -65,7 +65,7 @@ func (pc *policyController) syncDataPolicyChanges(policy kyvernov1.PolicyInterfa if len(ur.Spec.RuleContext) == 0 { return multierr.Combine(errs...) } - pc.log.V(2).WithName("syncDataPolicyChanges").Info("creating new UR for generate") + pc.log.V(4).WithName("syncDataPolicyChanges").Info("creating new UR for generate") created, err := pc.urGenerator.Generate(context.TODO(), pc.kyvernoClient, ur, pc.log) if err != nil { errs = append(errs, err) @@ -124,7 +124,7 @@ func (pc *policyController) handleGenerateForExisting(policy kyvernov1.PolicyInt return multierr.Combine(errors...) } - logger.V(2).Info("creating new UR for generate") + logger.V(4).Info("creating new UR for generate") created, err := pc.urGenerator.Generate(context.TODO(), pc.kyvernoClient, ur, pc.log) if err != nil { errors = append(errors, err) @@ -181,7 +181,7 @@ func (pc *policyController) createURForDownstreamDeletion(policy kyvernov1.Polic return multierr.Combine(errs...) } - pc.log.V(2).WithName("createURForDownstreamDeletion").Info("creating new UR for generate") + pc.log.V(4).WithName("createURForDownstreamDeletion").Info("creating new UR for generate") created, err := pc.urGenerator.Generate(context.TODO(), pc.kyvernoClient, ur, pc.log) if err != nil { errs = append(errs, err) diff --git a/pkg/policy/mutate.go b/pkg/policy/mutate.go index 401031a47c..953ad35233 100644 --- a/pkg/policy/mutate.go +++ b/pkg/policy/mutate.go @@ -12,7 +12,7 @@ import ( func (pc *policyController) handleMutate(policyKey string, policy kyvernov1.PolicyInterface) error { logger := pc.log.WithName("handleMutate").WithName(policyKey) - logger.Info("update URs on policy event") + logger.V(4).Info("update URs on policy event") ruleType := kyvernov2.Mutate spec := policy.GetSpec() @@ -42,7 +42,7 @@ func (pc *policyController) handleMutate(policyKey string, policy kyvernov1.Poli continue } - logger.Info("creating new UR for mutate") + logger.V(4).Info("creating new UR for mutate") ur := newMutateUR(policy, backgroundcommon.ResourceSpecFromUnstructured(*trigger), rule.Name) skip, err := pc.handleUpdateRequest(ur, trigger, rule.Name, policyNew) if err != nil {