1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 10:28:36 +00:00

add check for validate rule

This commit is contained in:
Shuting Zhao 2019-08-21 14:06:06 -07:00
parent 97335270cd
commit 42b55ab9e0

View file

@ -65,6 +65,15 @@ func (ws *WebhookServer) validateOverlayPattern(policy *kyverno.Policy) *v1beta1
},
}
}
if rule.Validation.Pattern != nil && len(rule.Validation.AnyPattern) != 0 {
return &v1beta1.AdmissionResponse{
Allowed: false,
Result: &metav1.Status{
Message: fmt.Sprintf("Invalid policy, either pattern or anyPattern is allowed in validate rule %s", rule.Name),
},
}
}
}
return &v1beta1.AdmissionResponse{Allowed: true}