## kyverno.io/v2beta1

Resource Types:

- ClusterPolicy
- Policy

### ClusterPolicy

ClusterPolicy declares validation, mutation, and generation behaviors for matching resources.

Field | Description
--- | ---
`apiVersion` string | `kyverno.io/v2beta1`
`kind` string | `ClusterPolicy`
`metadata` Kubernetes meta/v1.ObjectMeta | Refer to the Kubernetes API documentation for the fields of the `metadata` field.
`spec` Spec | Spec declares policy behaviors.
`rules` []Rule | Rules is a list of Rule instances. A Policy contains multiple rules and each rule can validate, mutate, or generate resources.
`applyRules` github.com/kyverno/kyverno/api/kyverno/v1.ApplyRulesType | (Optional) ApplyRules controls how rules in a policy are applied. Rule are processed in the order of declaration. When set to `One` processing stops after a rule has been applied i.e. the rule matches and results in a pass, fail, or error. When set to `All` all rules in the policy are processed. The default is `All`.
`failurePolicy` github.com/kyverno/kyverno/api/kyverno/v1.FailurePolicyType | (Optional) FailurePolicy defines how unexpected policy errors and webhook response timeout errors are handled. Rules within the same policy share the same failure behavior. Allowed values are Ignore or Fail. Defaults to Fail.
`validationFailureAction` github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureAction | (Optional) ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is “audit”.
`validationFailureActionOverrides` []github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureActionOverride | (Optional) ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
`background` bool | (Optional) Background controls if rules are applied to existing resources during a background scan. Optional. Default value is “true”. The value must be set to “false” if the policy rule uses variables that are only available in the admission review request (e.g. user name).
`schemaValidation` bool | (Optional) SchemaValidation skips policy validation checks. Optional. The default value is set to “true”, it must be set to “false” to disable the validation checks.
`webhookTimeoutSeconds` int32 | WebhookTimeoutSeconds specifies the maximum time in seconds allowed to apply this policy. After the configured time expires, the admission request may fail, or may simply ignore the policy results, based on the failure policy. The default timeout is 10s, the value must be between 1 and 30 seconds.
`mutateExistingOnPolicyUpdate` bool | (Optional) MutateExistingOnPolicyUpdate controls if a mutateExisting policy is applied on policy events. Default value is “false”.
`generateExistingOnPolicyUpdate` bool | (Optional) GenerateExistingOnPolicyUpdate controls whether to trigger generate rule in existing resources If is set to “true” generate rule will be triggered and applied to existing matched resources. Defaults to “false” if not specified.
`status` github.com/kyverno/kyverno/api/kyverno/v1.PolicyStatus | (Optional) Status contains policy runtime data.

### Policy

Policy declares validation, mutation, and generation behaviors for matching resources. See: https://kyverno.io/docs/writing-policies/ for more information.

Field | Description
--- | ---
`apiVersion` string | `kyverno.io/v2beta1`
`kind` string | `Policy`
`metadata` Kubernetes meta/v1.ObjectMeta | Refer to the Kubernetes API documentation for the fields of the `metadata` field.
`spec` Spec | Spec defines policy behaviors and contains one or more rules.
`rules` []Rule | Rules is a list of Rule instances. A Policy contains multiple rules and each rule can validate, mutate, or generate resources.
`applyRules` github.com/kyverno/kyverno/api/kyverno/v1.ApplyRulesType | (Optional) ApplyRules controls how rules in a policy are applied. Rule are processed in the order of declaration. When set to `One` processing stops after a rule has been applied i.e. the rule matches and results in a pass, fail, or error. When set to `All` all rules in the policy are processed. The default is `All`.
`failurePolicy` github.com/kyverno/kyverno/api/kyverno/v1.FailurePolicyType | (Optional) FailurePolicy defines how unexpected policy errors and webhook response timeout errors are handled. Rules within the same policy share the same failure behavior. Allowed values are Ignore or Fail. Defaults to Fail.
`validationFailureAction` github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureAction | (Optional) ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is “audit”.
`validationFailureActionOverrides` []github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureActionOverride | (Optional) ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
`background` bool | (Optional) Background controls if rules are applied to existing resources during a background scan. Optional. Default value is “true”. The value must be set to “false” if the policy rule uses variables that are only available in the admission review request (e.g. user name).
`schemaValidation` bool | (Optional) SchemaValidation skips policy validation checks. Optional. The default value is set to “true”, it must be set to “false” to disable the validation checks.
`webhookTimeoutSeconds` int32 | WebhookTimeoutSeconds specifies the maximum time in seconds allowed to apply this policy. After the configured time expires, the admission request may fail, or may simply ignore the policy results, based on the failure policy. The default timeout is 10s, the value must be between 1 and 30 seconds.
`mutateExistingOnPolicyUpdate` bool | (Optional) MutateExistingOnPolicyUpdate controls if a mutateExisting policy is applied on policy events. Default value is “false”.
`generateExistingOnPolicyUpdate` bool | (Optional) GenerateExistingOnPolicyUpdate controls whether to trigger generate rule in existing resources If is set to “true” generate rule will be triggered and applied to existing matched resources. Defaults to “false” if not specified.
`status` github.com/kyverno/kyverno/api/kyverno/v1.PolicyStatus | (Optional) Status contains policy runtime data.

### AnyAllConditions

(Appears on: Deny, Rule)

Field | Description
--- | ---
`any` []Condition | (Optional) AnyConditions enable variable-based conditional rule execution. This is useful for finer control of when an rule is applied. A condition can reference object data using JMESPath notation. Here, at least one of the conditions need to pass
`all` []Condition | (Optional) AllConditions enable variable-based conditional rule execution. This is useful for finer control of when an rule is applied. A condition can reference object data using JMESPath notation. Here, all of the conditions need to pass

### Condition

(Appears on: AnyAllConditions)

Field | Description
--- | ---
`key` Kubernetes apiextensions/v1.JSON | Key is the context entry (using JMESPath) for conditional rule evaluation.
`operator` ConditionOperator | Operator is the conditional operation to perform. Valid operators are: Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals, GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan, DurationLessThanOrEquals, DurationLessThan
`value` Kubernetes apiextensions/v1.JSON | (Optional) Value is the conditional value, or set of values. The values can be fixed set or can be variables declared using JMESPath.

### ConditionOperator (`string` alias)

(Appears on: Condition)

ConditionOperator is the operation performed on condition key and value.

### Deny

(Appears on: Validation)

Deny specifies a list of conditions used to pass or fail a validation rule.

Field | Description
--- | ---
`conditions` AnyAllConditions | Multiple conditions can be declared under an `any` or `all` statement. A direct list of conditions (without `any` or `all` statements) is also supported for backwards compatibility See: https://kyverno.io/docs/writing-policies/validate/#deny-rules

### ImageVerification

(Appears on: Rule)

ImageVerification validates that images that match the specified pattern are signed with the supplied public key. Once the image is verified it is mutated to include the SHA digest retrieved during the registration.

Field | Description
--- | ---
`imageReferences` []string | ImageReferences is a list of matching image reference patterns. At least one pattern in the list must match the image for the rule to apply. Each image reference consists of a registry address (defaults to docker.io), repository, image, and tag (defaults to latest). Wildcards (‘*’ and ‘?’) are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
`attestors` []github.com/kyverno/kyverno/api/kyverno/v1.AttestorSet | Attestors specified the required attestors (i.e. authorities)
`attestations` []github.com/kyverno/kyverno/api/kyverno/v1.Attestation | Attestations are optional checks for signed in-toto Statements used to verify the image. See https://github.com/in-toto/attestation. Kyverno fetches signed attestations from the OCI registry and decodes them into a list of Statement declarations.
`repository` string | Repository is an optional alternate OCI repository to use for image signatures and attestations that match this rule. If specified Repository will override the default OCI image repository configured for the installation. The repository can also be overridden per Attestor or Attestation.
`mutateDigest` bool | MutateDigest enables replacement of image tags with digests. Defaults to true.
`verifyDigest` bool | VerifyDigest validates that images have a digest.
`required` bool | Required validates that images are verified i.e. have matched passed a signature or attestation check.

### MatchResources

(Appears on: Rule)

MatchResources is used to specify resource and admission review request data for which a policy rule is applicable.

Field | Description
--- | ---
`any` github.com/kyverno/kyverno/api/kyverno/v1.ResourceFilters | (Optional) Any allows specifying resources which will be ORed
`all` github.com/kyverno/kyverno/api/kyverno/v1.ResourceFilters | (Optional) All allows specifying resources which will be ANDed

### ResourceDescription

(Appears on: ResourceFilter)

ResourceDescription contains criteria used to match resources.

Field | Description
--- | ---
`kinds` []string | (Optional) Kinds is a list of resource kinds.
`names` []string | (Optional) Names are the names of the resources. Each name supports wildcard characters “*” (matches zero or many characters) and “?” (at least one character).
`namespaces` []string | (Optional) Namespaces is a list of namespaces names. Each name supports wildcard characters “*” (matches zero or many characters) and “?” (at least one character).
`annotations` map[string]string | (Optional) Annotations is a map of annotations (key-value pairs of type string). Annotation keys and values support the wildcard characters “*” (matches zero or many characters) and “?” (matches at least one character).
`selector` Kubernetes meta/v1.LabelSelector | (Optional) Selector is a label selector. Label keys and values in `matchLabels` support the wildcard characters `*` (matches zero or many characters) and `?` (matches one character). Wildcards allows writing label selectors like [“storage.k8s.io/”: “”]. Note that using [”” : “”] matches any key and value but does not match an empty label set.
`namespaceSelector` Kubernetes meta/v1.LabelSelector | (Optional) NamespaceSelector is a label selector for the resource namespace. Label keys and values in `matchLabels` support the wildcard characters `*` (matches zero or many characters) and `?` (matches one character).Wildcards allows writing label selectors like [“storage.k8s.io/”: “”]. Note that using [”” : “”] matches any key and value but does not match an empty label set.

### ResourceFilter

ResourceFilter allow users to “AND” or “OR” between resources

Field | Description
--- | ---
`UserInfo` github.com/kyverno/kyverno/api/kyverno/v1.UserInfo | (Optional) UserInfo contains information about the user performing the operation.
`resources` ResourceDescription | ResourceDescription contains information about the resource being created or modified.

### ResourceFilters (`[]./api/kyverno/v2beta1.ResourceFilter` alias)

ResourceFilters is a slice of ResourceFilter

### Rule

(Appears on: Spec)

Rule defines a validation, mutation, or generation control for matching resources. Each rules contains a match declaration to select resources, and an optional exclude declaration to specify which resources to exclude.

Field | Description
--- | ---
`name` string | Name is a label to identify the rule, It must be unique within the policy.
`context` []github.com/kyverno/kyverno/api/kyverno/v1.ContextEntry | (Optional) Context defines variables and data sources that can be used during rule execution.
`match` MatchResources | MatchResources defines when this policy rule should be applied. The match criteria can include resource information (e.g. kind, name, namespace, labels) and admission review request information like the user name or role. At least one kind is required.
`exclude` MatchResources | (Optional) ExcludeResources defines when this policy rule should not be applied. The exclude criteria can include resource information (e.g. kind, name, namespace, labels) and admission review request information like the name or role.
`imageExtractors` github.com/kyverno/kyverno/api/kyverno/v1.ImageExtractorConfigs | (Optional) ImageExtractors defines a mapping from kinds to ImageExtractorConfigs. This config is only valid for verifyImages rules.
`preconditions` AnyAllConditions | (Optional) Preconditions are used to determine if a policy rule should be applied by evaluating a set of conditions. The declaration can contain nested `any` or `all` statements. A direct list of conditions (without `any` or `all` statements is supported for backwards compatibility but See: https://kyverno.io/docs/writing-policies/preconditions/
`mutate` github.com/kyverno/kyverno/api/kyverno/v1.Mutation | (Optional) Mutation is used to modify matching resources.
`validate` Validation | (Optional) Validation is used to validate matching resources.
`generate` github.com/kyverno/kyverno/api/kyverno/v1.Generation | (Optional) Generation is used to create new resources.
`verifyImages` []ImageVerification | (Optional) VerifyImages is used to verify image signatures and mutate them to add a digest

### Spec

(Appears on: ClusterPolicy, Policy)

Spec contains a list of Rule instances and other policy controls.

Field | Description
--- | ---
`rules` []Rule | Rules is a list of Rule instances. A Policy contains multiple rules and each rule can validate, mutate, or generate resources.
`applyRules` github.com/kyverno/kyverno/api/kyverno/v1.ApplyRulesType | (Optional) ApplyRules controls how rules in a policy are applied. Rule are processed in the order of declaration. When set to `One` processing stops after a rule has been applied i.e. the rule matches and results in a pass, fail, or error. When set to `All` all rules in the policy are processed. The default is `All`.
`failurePolicy` github.com/kyverno/kyverno/api/kyverno/v1.FailurePolicyType | (Optional) FailurePolicy defines how unexpected policy errors and webhook response timeout errors are handled. Rules within the same policy share the same failure behavior. Allowed values are Ignore or Fail. Defaults to Fail.
`validationFailureAction` github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureAction | (Optional) ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is “audit”.
`validationFailureActionOverrides` []github.com/kyverno/kyverno/api/kyverno/v1.ValidationFailureActionOverride | (Optional) ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
`background` bool | (Optional) Background controls if rules are applied to existing resources during a background scan. Optional. Default value is “true”. The value must be set to “false” if the policy rule uses variables that are only available in the admission review request (e.g. user name).
`schemaValidation` bool | (Optional) SchemaValidation skips policy validation checks. Optional. The default value is set to “true”, it must be set to “false” to disable the validation checks.
`webhookTimeoutSeconds` int32 | WebhookTimeoutSeconds specifies the maximum time in seconds allowed to apply this policy. After the configured time expires, the admission request may fail, or may simply ignore the policy results, based on the failure policy. The default timeout is 10s, the value must be between 1 and 30 seconds.
`mutateExistingOnPolicyUpdate` bool | (Optional) MutateExistingOnPolicyUpdate controls if a mutateExisting policy is applied on policy events. Default value is “false”.
`generateExistingOnPolicyUpdate` bool | (Optional) GenerateExistingOnPolicyUpdate controls whether to trigger generate rule in existing resources If is set to “true” generate rule will be triggered and applied to existing matched resources. Defaults to “false” if not specified.

### Validation

(Appears on: Rule)

Validation defines checks to be performed on matching resources.

Field | Description
--- | ---
`message` string | (Optional) Message specifies a custom message to be displayed on failure.
`manifests` github.com/kyverno/kyverno/api/kyverno/v1.Manifests | (Optional) Manifest specifies conditions for manifest verification
`foreach` []github.com/kyverno/kyverno/api/kyverno/v1.ForEachValidation | (Optional) ForEach applies validate rules to a list of sub-elements by creating a context for each entry in the list and looping over it to apply the specified logic.
`pattern` Kubernetes apiextensions/v1.JSON | (Optional) Pattern specifies an overlay-style pattern used to check resources.
`anyPattern` Kubernetes apiextensions/v1.JSON | (Optional) AnyPattern specifies list of validation patterns. At least one of the patterns must be satisfied for the validation rule to succeed.
`deny` Deny | (Optional) Deny defines conditions used to pass or fail a validation rule.
`podSecurity` github.com/kyverno/kyverno/api/kyverno/v1.PodSecurity | (Optional) PodSecurity applies exemptions for Kubernetes Pod Security admission by specifying exclusions for Pod Security Standards controls.