mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-30 03:15:05 +00:00
753 practical test fixes
This commit is contained in:
parent
dd0f3d140e
commit
d4baf44fd9
1 changed files with 9 additions and 1 deletions
|
@ -56,7 +56,7 @@ func Validate(policyRaw []byte, client *dclient.Client, mock bool, openAPIContro
|
|||
}
|
||||
|
||||
if doesMatchAndExcludeConflict(rule) {
|
||||
return fmt.Errorf("path: spec.rules[%d]: rule is matching an empty set", i)
|
||||
return fmt.Errorf("path: spec.rules[%v]: rule is matching an empty set", rule.Name)
|
||||
}
|
||||
|
||||
// validate rule actions
|
||||
|
@ -94,6 +94,14 @@ func Validate(policyRaw []byte, client *dclient.Client, mock bool, openAPIContro
|
|||
// of match and exclude block is not an empty set
|
||||
func doesMatchAndExcludeConflict(rule kyverno.Rule) bool {
|
||||
|
||||
if reflect.DeepEqual(rule.MatchResources, kyverno.MatchResources{}) {
|
||||
return true
|
||||
}
|
||||
|
||||
if reflect.DeepEqual(rule.ExcludeResources, kyverno.ExcludeResources{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
excludeRoles := make(map[string]bool)
|
||||
for _, role := range rule.ExcludeResources.UserInfo.Roles {
|
||||
excludeRoles[role] = true
|
||||
|
|
Loading…
Add table
Reference in a new issue