Skip to content

Commit

Permalink
fixed attotaions for empty set
Browse files Browse the repository at this point in the history
  • Loading branch information
NoSkillGirl committed Nov 25, 2020
1 parent 9399ade commit 40b40fb
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 40b40fb

Please sign in to comment.