mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
fix: panic for nil rule response when processing old object (#11550)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
6b99fb0653
commit
a26f588b86
1 changed files with 2 additions and 1 deletions
|
@ -164,7 +164,8 @@ func (v *validator) validate(ctx context.Context) *engineapi.RuleResponse {
|
|||
}
|
||||
|
||||
// when an existing resource violates, and the updated resource also violates, then skip
|
||||
if ruleResponse.Status() == engineapi.RuleStatusFail && priorResp.Status() == engineapi.RuleStatusFail { //
|
||||
if ruleResponse.Status() == engineapi.RuleStatusFail &&
|
||||
(priorResp != nil && priorResp.Status() == engineapi.RuleStatusFail) { //
|
||||
v.log.V(2).Info("warning: skipping the rule evaluation as pre-existing violations are allowed", "ruleResponse", ruleResponse, "priorResp", priorResp)
|
||||
return engineapi.RuleSkip(v.rule.Name, engineapi.Validation, "skipping the rule evaluation as pre-existing violations are allowed", v.rule.ReportProperties)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue