-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Policy Validations
After v1.3.0, Kyverno policies are validated through OpenAPISchema. In addition, Kyverno performs the following custom policy validation checks upon policy update (in webhook):
-
rule names are unique across a policy
-
allowed variables declaration with JMESPath
- JMESPath has to be wrapped in
{{ }} - JMESPath has to start with
request., otherwise it can only be specified with pre-defined variables:serviceAccountName,serviceAccountNamespace
- JMESPath has to be wrapped in
-
only variables referring to
request.objectare allowed in background mode -
only one type of rule is allowed per rule, i.e., both
mutateandvalidatecan not be defined within a single rule -
rolesinmatch/excludehas to have namespace: <namespace:rolename> -
namespace policies are only applied to namespaced resources, in other words, a cluster-wide resource cannot be selected by a namespace policy
-
the resultant of
matchandexcludeblock cannot be an empty set -
mutate rule
- supported anchors in mutation rules:
(),+()
- supported anchors in mutation rules:
-
validate rule
- supported anchors in validation rules:
(),^(),=(),X() - only one of operations
pattern,anyPattern,denyis allowed per rule
- supported anchors in validation rules:
-
generate rule
- only
dataorcloneis allowed per rule - Kyverno has to have permissions to operate (create/update/get/delete) generated resource
- only
THIS WIKI IS NO LONGER MAINTAINED
For developer guides please see the DEVELOPMENT.md file.
For user guides please see https://kyverno.io/docs/.
THIS WIKI IS NO LONGER MAINTAINED
For developer guides please see the DEVELOPMENT.md file.
For user guides please see https://kyverno.io/docs/.