1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00

fix: error handling and reduce log clutter (#11979)

* fix: error handling and reduce log clutter

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* fixed lint test

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

---------

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>
This commit is contained in:
abhashsolanki18 2025-01-30 15:17:09 +05:30 committed by GitHub
parent 3b798c8958
commit 5c9adf9fb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -217,6 +217,10 @@ func (v *validator) validateForEach(ctx context.Context) *engineapi.RuleResponse
for _, foreach := range v.forEach {
elements, err := engineutils.EvaluateList(foreach.List, v.policyContext.JSONContext())
if err != nil {
if strings.Contains(err.Error(), "Unknown key") {
v.log.V(4).Info("optional field not found, skipping", "list", foreach.List)
continue
}
v.log.V(2).Info("failed to evaluate list", "list", foreach.List, "error", err.Error())
continue
}