Skip to content

Commit

Permalink
Merge pull request kyverno#1305 from NoSkillGirl/bug/validation_error…
Browse files Browse the repository at this point in the history
…_empty_set

added annotations check in validation
  • Loading branch information
JimBugwadia authored Nov 25, 2020
2 parents 9399ade + 40b40fb commit d8062eb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/policy/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ func doMatchAndExcludeConflict(rule kyverno.Rule) bool {
return false
}

if rule.MatchResources.Annotations != nil && rule.ExcludeResources.Annotations != nil {
if !(reflect.DeepEqual(rule.MatchResources.Annotations, rule.ExcludeResources.Annotations)) {
return false
}
}

if (rule.MatchResources.Annotations == nil && rule.ExcludeResources.Annotations != nil) ||
(rule.MatchResources.Annotations != nil && rule.ExcludeResources.Annotations == nil) {
return false
}

return true
}

Expand Down

0 comments on commit d8062eb

Please sign in to comment.