From dad2518910da812de1907e4818467a7d72d06b2c Mon Sep 17 00:00:00 2001 From: shravan Date: Sat, 15 Feb 2020 23:24:04 +0530 Subject: [PATCH] 702 prototype commit --- pkg/openapi/validation.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/openapi/validation.go b/pkg/openapi/validation.go index 7f49b91bef..2a29cb14f2 100644 --- a/pkg/openapi/validation.go +++ b/pkg/openapi/validation.go @@ -77,8 +77,14 @@ func ValidatePolicyMutation(policy v1.ClusterPolicy) error { var kindToRules = make(map[string][]v1.Rule) for _, rule := range policy.Spec.Rules { - rule.MatchResources.Selector = nil if rule.HasMutate() { + rule.MatchResources = v1.MatchResources{ + UserInfo: v1.UserInfo{}, + ResourceDescription: v1.ResourceDescription{ + Kinds: rule.MatchResources.Kinds, + }, + } + rule.ExcludeResources = v1.ExcludeResources{} for _, kind := range rule.MatchResources.Kinds { kindToRules[kind] = append(kindToRules[kind], rule) }