mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* Changes to correctly run delete operation in kyverno11beta4 Co-authored-by: Anushka Mittal <anushka@nirmata.com> Co-authored-by: Julian-Chu <yulang.chu@gmail.com> Signed-off-by: Anushka Mittal <anushka@nirmata.com> * Update test/cli/test/deny-pod-deletion/deny-pod-deletion.yaml Co-authored-by: Chip Zoller <chipzoller@gmail.com> Signed-off-by: shuting <shutting06@gmail.com> * Update test/cli/test/deny-pod-deletion/deny-pod-deletion.yaml Co-authored-by: Chip Zoller <chipzoller@gmail.com> Signed-off-by: shuting <shutting06@gmail.com> * Add README.md for new test Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Correct policy.yaml Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Add new lines in test files Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Correct kyverno-test file Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Correct values.yaml Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Correct test files Signed-off-by: anushkamittal2001 <anushka@nirmata.com> * Add new test Signed-off-by: anushkamittal2001 <anushka@nirmata.com> --------- Signed-off-by: Anushka Mittal <anushka@nirmata.com> Signed-off-by: shuting <shutting06@gmail.com> Signed-off-by: anushkamittal2001 <anushka@nirmata.com> Signed-off-by: Anushka Mittal <138426011+anushkamittal2001@users.noreply.github.com> Co-authored-by: shuting <shutting06@gmail.com> Co-authored-by: Chip Zoller <chipzoller@gmail.com> Co-authored-by: shuting <shuting@nirmata.com>
42 lines
913 B
Go
42 lines
913 B
Go
package processor
|
|
|
|
import (
|
|
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
)
|
|
|
|
func policyHasGenerate(policy kyvernov1.PolicyInterface) bool {
|
|
for _, rule := range policy.GetSpec().Rules {
|
|
if rule.HasGenerate() {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func policyHasMutate(policy kyvernov1.PolicyInterface) bool {
|
|
for _, rule := range policy.GetSpec().Rules {
|
|
if rule.HasMutate() {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func policyHasValidateOrVerifyImageChecks(policy kyvernov1.PolicyInterface) bool {
|
|
for _, rule := range policy.GetSpec().Rules {
|
|
// engine.validate handles both validate and verifyImageChecks atm
|
|
if rule.HasValidate() || rule.HasVerifyImageChecks() {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func policyHasVerifyImages(policy kyvernov1.PolicyInterface) bool {
|
|
for _, rule := range policy.GetSpec().Rules {
|
|
if rule.HasVerifyImages() {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|