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

Improve logging message #1232

Merged
merged 4 commits into from
Nov 4, 2020
Merged

Improve logging message #1232

merged 4 commits into from
Nov 4, 2020

Conversation

realshuting
Copy link
Member

Fixes #1192.
Fixes #1224.
Fixes #1225.

Copy link
Member

@JimBugwadia JimBugwadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see question - I am unsure of what the message is used for....

@@ -235,7 +235,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k
}

// creating final error
var errorMessage = "rule not matched:"
var errorMessage = fmt.Sprintf("rule %s not matched:", ruleRef.Name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "rule <%s> was not matched" mean?

Is this indicating that the admission request / resource did not match the rule, or that the rule resulted in an a policy failure (i.e. violation).

I think its the latter, in which case the message is misleading.

The message could be, "rule %s result = fail" or "rule %s failed".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually the former, this function MatchesResourceDescription evaluates if the given resource matches the rule.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then it seems fine. Thanks!

@JimBugwadia JimBugwadia merged commit 2cc0363 into kyverno:main Nov 4, 2020
@realshuting realshuting deleted the bug_fix branch November 4, 2020 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants