mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
feat: add/improve error logs (#11657)
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
This commit is contained in:
parent
9070334df0
commit
cf5a5b12ae
1 changed files with 2 additions and 1 deletions
|
@ -90,13 +90,14 @@ func (e *engine) filterRule(
|
|||
gvk, subresource := policyContext.ResourceKind()
|
||||
|
||||
if err := engineutils.MatchesResourceDescription(newResource, rule, admissionInfo, namespaceLabels, policy.GetNamespace(), gvk, subresource, policyContext.Operation()); err != nil {
|
||||
logger.V(4).Info("new resource does not match...", "reason", err.Error())
|
||||
if ruleType == engineapi.Generation {
|
||||
// if the oldResource matched, return "false" to delete GR for it
|
||||
if err = engineutils.MatchesResourceDescription(oldResource, rule, admissionInfo, namespaceLabels, policy.GetNamespace(), gvk, subresource, policyContext.Operation()); err == nil {
|
||||
return engineapi.RuleFail(rule.Name, ruleType, "", rule.ReportProperties)
|
||||
}
|
||||
}
|
||||
logger.V(4).Info("rule not matched", "reason", err.Error())
|
||||
logger.V(4).Info("old resource does not match...", "reason", err.Error())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue