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:
parent
3b798c8958
commit
5c9adf9fb5
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue