mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
Do not generate preconditions not met warning for audit policies (#3487)
* Do not generate preconditions not met warning for audit policies Signed-off-by: abhi-kapoor <43758739+abhi-kapoor@users.noreply.github.com> * Update PR template to reeference the closing keyword Signed-off-by: abhi-kapoor <43758739+abhi-kapoor@users.noreply.github.com> * Update pkg/engine/validation.go Co-authored-by: Prateek Pandey <prateekpandey14@gmail.com> * Update pkg/engine/validation.go Co-authored-by: Prateek Pandey <prateekpandey14@gmail.com> Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com> Co-authored-by: shuting <shutting06@gmail.com> Co-authored-by: Prateek Pandey <prateekpandey14@gmail.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
f77220ad66
commit
18d4dadab6
2 changed files with 3 additions and 3 deletions
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -1,7 +1,7 @@
|
|||
## Related issue
|
||||
|
||||
<!--
|
||||
Please link the GitHub issue this pull request resolves in the format of `#1234`. If you discussed this change
|
||||
Please link the GitHub issue this pull request resolves in the format of `Closes #1234`. If you discussed this change
|
||||
with a maintainer, please mention her/him using the `@` syntax (e.g. `@JimBugwadia`).
|
||||
|
||||
If this change neither resolves an existing issue nor has sign-off from one of the maintainers, there is a
|
||||
|
|
|
@ -206,7 +206,7 @@ func (v *validator) validate() *response.RuleResponse {
|
|||
return ruleError(v.rule, utils.Validation, "failed to evaluate preconditions", err)
|
||||
}
|
||||
|
||||
if !preconditionsPassed {
|
||||
if !preconditionsPassed && v.ctx.Policy.GetSpec().ValidationFailureAction != kyverno.Audit {
|
||||
return ruleResponse(v.rule, utils.Validation, "preconditions not met", response.RuleStatusSkip)
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ func (v *validator) validateForEach() *response.RuleResponse {
|
|||
preconditionsPassed, err := checkPreconditions(v.log, v.ctx, v.anyAllConditions)
|
||||
if err != nil {
|
||||
return ruleError(v.rule, utils.Validation, "failed to evaluate preconditions", err)
|
||||
} else if !preconditionsPassed {
|
||||
} else if !preconditionsPassed && v.ctx.Policy.GetSpec().ValidationFailureAction != kyverno.Audit {
|
||||
return ruleResponse(v.rule, utils.Validation, "preconditions not met", response.RuleStatusSkip)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue