From 3a29f3af480646378e2d740c3933a6354d2bfb03 Mon Sep 17 00:00:00 2001 From: NoSkillGirl Date: Thu, 26 Nov 2020 10:34:22 +0530 Subject: [PATCH 1/2] added log level --- pkg/kyverno/apply/command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/kyverno/apply/command.go b/pkg/kyverno/apply/command.go index d0495b7db3..055443e910 100644 --- a/pkg/kyverno/apply/command.go +++ b/pkg/kyverno/apply/command.go @@ -213,7 +213,7 @@ To apply policy with variables: err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController) if err != nil { rc.skip += len(resources) - fmt.Printf("\nskipping policy %v as it is not valid: %v\n", policy.Name, err) + log.Log.V(3).Info(fmt.Sprintf("skipping policy %v as it is not valid: %v\n", policy.Name), "error", err) continue } @@ -221,6 +221,7 @@ To apply policy with variables: variable := removeDuplicatevariables(matches) if len(matches) > 0 && variablesString == "" && valuesFile == "" { + rc.skip++ skipPolicy := SkippedPolicy{ Name: policy.GetName(), Rules: policy.Spec.Rules, From 48118de5bbc0878b12a821b13dae0ad8eff459fe Mon Sep 17 00:00:00 2001 From: NoSkillGirl Date: Thu, 26 Nov 2020 10:54:02 +0530 Subject: [PATCH 2/2] small fix --- pkg/kyverno/apply/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kyverno/apply/command.go b/pkg/kyverno/apply/command.go index 055443e910..547367798a 100644 --- a/pkg/kyverno/apply/command.go +++ b/pkg/kyverno/apply/command.go @@ -213,7 +213,7 @@ To apply policy with variables: err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController) if err != nil { rc.skip += len(resources) - log.Log.V(3).Info(fmt.Sprintf("skipping policy %v as it is not valid: %v\n", policy.Name), "error", err) + log.Log.V(3).Info(fmt.Sprintf("skipping policy %v as it is not valid", policy.Name), "error", err) continue }