Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added log level for skipped policy #1316

Merged
merged 2 commits into from
Nov 26, 2020

Conversation

NoSkillGirl
Copy link
Contributor

@NoSkillGirl NoSkillGirl commented Nov 26, 2020

Related issue

closes #1206

What type of PR is this?

/kind feature

Proposed changes

  • removed printing skipping statement for policy
  • added log level
  • error message in log gives the name of variables in the policy
    (changes done in - Cleanup/policyreport cli #1279)

Checklist

@NoSkillGirl
Copy link
Contributor Author

NoSkillGirl commented Nov 26, 2020

If the policy is skipped:

$ kyverno apply ../../../samples/best_practices/add_ns_quota.yaml -r ../../../../experiments/debugging/nginx1.yaml

applying 1 policy to 1 resource... 

pass: 0, fail: 0, warn: 0, error: 0, skip: 1 

To check the details need to run with log level:

$ kyverno apply ../../../samples/best_practices/add_ns_quota.yaml -r ../../../../experiments/debugging/nginx1.yaml -v=3
I1126 10:56:41.635111   55104 policymutation.go:202] apply "msg"="generated JSON Patch to set default"  "spec.validationFailureAction"="audit"
I1126 10:56:41.635266   55104 policymutation.go:173] apply "msg"="generated JSON Patch to set default"  "spec.background"=true
I1126 10:56:41.635345   55104 policymutation.go:240] apply "msg"="auto generating rule for pod controllers"  "controllers"="DaemonSet,Deployment,Job,StatefulSet,CronJob"
I1126 10:56:41.635409   55104 policymutation.go:375] apply/generateRuleForControllers "msg"="processing rule"  "rulename"="generate-resourcequota"
I1126 10:56:41.635439   55104 cronjob.go:21] apply/handleCronJob "msg"="generating rule for cronJob"  
I1126 10:56:41.635455   55104 policymutation.go:375] apply/handleCronJob/generateRuleForControllers "msg"="processing rule"  "rulename"="generate-resourcequota"
I1126 10:56:41.635475   55104 policymutation.go:375] apply/generateRuleForControllers "msg"="processing rule"  "rulename"="generate-limitrange"
I1126 10:56:41.635492   55104 cronjob.go:21] apply/handleCronJob "msg"="generating rule for cronJob"  
I1126 10:56:41.635508   55104 policymutation.go:375] apply/handleCronJob/generateRuleForControllers "msg"="processing rule"  "rulename"="generate-limitrange"

applying 1 policy to 1 resource... 
I1126 10:56:41.657909   55104 command.go:231]  "msg"="skipping policy add-ns-quota"  "error"="policy have variable -  {{request.object.metadata.name}}"

pass: 0, fail: 0, warn: 0, error: 0, skip: 1 

@JimBugwadia JimBugwadia merged commit d61e5bf into kyverno:main Nov 26, 2020
@NoSkillGirl NoSkillGirl added this to the Kyverno Release 1.3.0 milestone Dec 22, 2020
@realshuting realshuting removed this from the Kyverno Release 1.3.0 milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve CLI message for variables
3 participants