Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. ValidatingAdmissionPolicyBinding [admissionregistration.k8s.io/v1]
- Description
ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.
For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don’t use params, otherwise N is the number of parameters selected by the binding.
The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.
- Type
-
object
6.1. Specification
Property | Type | Description |
---|---|---|
|
| APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
|
| Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
| Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. | |
|
| ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. |
6.1.1. .spec
- Description
- ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.
- Type
-
object
Property | Type | Description |
---|---|---|
|
| MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) |
|
| ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. |
|
| PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required. |
|
| validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions. Failures defined by the ValidatingAdmissionPolicy’s FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy. validationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action. The supported actions values are: "Deny" specifies that a validation failure results in a denied request. "Warn" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.
"Audit" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a Clients should expect to handle additional values by ignoring any values not recognized. "Deny" and "Warn" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers. Required. |
6.1.2. .spec.matchResources
- Description
- MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
- Type
-
object
Property | Type | Description |
---|---|---|
|
| ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) |
|
| NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. |
|
| matchPolicy defines how the "MatchResources" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent".
- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included
- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included Defaults to "Equivalent"
Possible enum values: - |
| NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy. For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { "matchExpressions": [ { "key": "runlevel", "operator": "NotIn", "values": [ "0", "1" ] } ] } If instead you want to only run the policy on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { "matchExpressions": [ { "key": "environment", "operator": "In", "values": [ "prod", "staging" ] } ] } See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. Default to the empty LabelSelector, which matches everything. | |
| ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. | |
|
| ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches any Rule. |
|
| NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. |
6.1.3. .spec.matchResources.excludeResourceRules
- Description
- ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
- Type
-
array
6.1.4. .spec.matchResources.excludeResourceRules[]
- Description
- NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.
- Type
-
object
Property | Type | Description |
---|---|---|
|
| APIGroups is the API groups the resources belong to. '' is all groups. If '' is present, the length of the slice must be one. Required. |
|
| APIVersions is the API versions the resources belong to. '' is all versions. If '' is present, the length of the slice must be one. Required. |
|
| Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. |
|
| ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. |
|
| Resources is a list of resources this rule applies to. For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '' means all resources, but not subresources. 'pods/' means all subresources of pods. '/scale' means all scale subresources. '/*' means all resources and their subresources. If wildcard is present, the validation rule will ensure resources do not overlap with each other. Depending on the enclosing object, subresources might not be allowed. Required. |
|
| scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". |
6.1.5. .spec.matchResources.resourceRules
- Description
- ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches any Rule.
- Type
-
array
6.1.6. .spec.matchResources.resourceRules[]
- Description
- NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.
- Type
-
object
Property | Type | Description |
---|---|---|
|
| APIGroups is the API groups the resources belong to. '' is all groups. If '' is present, the length of the slice must be one. Required. |
|
| APIVersions is the API versions the resources belong to. '' is all versions. If '' is present, the length of the slice must be one. Required. |
|
| Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. |
|
| ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. |
|
| Resources is a list of resources this rule applies to. For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '' means all resources, but not subresources. 'pods/' means all subresources of pods. '/scale' means all scale subresources. '/*' means all resources and their subresources. If wildcard is present, the validation rule will ensure resources do not overlap with each other. Depending on the enclosing object, subresources might not be allowed. Required. |
|
| scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". |
6.1.7. .spec.paramRef
- Description
- ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding.
- Type
-
object
Property | Type | Description |
---|---|---|
|
| name is the name of the resource being referenced.
One of
A single parameter used for all admission requests can be configured by setting the |
|
|
namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both
A per-namespace parameter may be used by specifying a namespace-scoped
- If
- If |
|
|
Allowed values are Required |
| selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind. If multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.
One of |
6.2. API endpoints
The following API endpoints are available:
/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings
-
DELETE
: delete collection of ValidatingAdmissionPolicyBinding -
GET
: list or watch objects of kind ValidatingAdmissionPolicyBinding -
POST
: create a ValidatingAdmissionPolicyBinding
-
/apis/admissionregistration.k8s.io/v1/watch/validatingadmissionpolicybindings
-
GET
: watch individual changes to a list of ValidatingAdmissionPolicyBinding. deprecated: use the 'watch' parameter with a list operation instead.
-
/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}
-
DELETE
: delete a ValidatingAdmissionPolicyBinding -
GET
: read the specified ValidatingAdmissionPolicyBinding -
PATCH
: partially update the specified ValidatingAdmissionPolicyBinding -
PUT
: replace the specified ValidatingAdmissionPolicyBinding
-
/apis/admissionregistration.k8s.io/v1/watch/validatingadmissionpolicybindings/{name}
-
GET
: watch changes to an object of kind ValidatingAdmissionPolicyBinding. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.
-
6.2.1. /apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings
- HTTP method
-
DELETE
- Description
- delete collection of ValidatingAdmissionPolicyBinding
Parameter | Type | Description |
---|---|---|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
HTTP code | Reponse body |
---|---|
200 - OK |
|
401 - Unauthorized | Empty |
- HTTP method
-
GET
- Description
- list or watch objects of kind ValidatingAdmissionPolicyBinding
HTTP code | Reponse body |
---|---|
200 - OK | |
401 - Unauthorized | Empty |
- HTTP method
-
POST
- Description
- create a ValidatingAdmissionPolicyBinding
Parameter | Type | Description |
---|---|---|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
Parameter | Type | Description |
---|---|---|
|
HTTP code | Reponse body |
---|---|
200 - OK | |
201 - Created | |
202 - Accepted | |
401 - Unauthorized | Empty |
6.2.2. /apis/admissionregistration.k8s.io/v1/watch/validatingadmissionpolicybindings
- HTTP method
-
GET
- Description
- watch individual changes to a list of ValidatingAdmissionPolicyBinding. deprecated: use the 'watch' parameter with a list operation instead.
HTTP code | Reponse body |
---|---|
200 - OK |
|
401 - Unauthorized | Empty |
6.2.3. /apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}
Parameter | Type | Description |
---|---|---|
|
| name of the ValidatingAdmissionPolicyBinding |
- HTTP method
-
DELETE
- Description
- delete a ValidatingAdmissionPolicyBinding
Parameter | Type | Description |
---|---|---|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
HTTP code | Reponse body |
---|---|
200 - OK |
|
202 - Accepted |
|
401 - Unauthorized | Empty |
- HTTP method
-
GET
- Description
- read the specified ValidatingAdmissionPolicyBinding
HTTP code | Reponse body |
---|---|
200 - OK | |
401 - Unauthorized | Empty |
- HTTP method
-
PATCH
- Description
- partially update the specified ValidatingAdmissionPolicyBinding
Parameter | Type | Description |
---|---|---|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
HTTP code | Reponse body |
---|---|
200 - OK | |
201 - Created | |
401 - Unauthorized | Empty |
- HTTP method
-
PUT
- Description
- replace the specified ValidatingAdmissionPolicyBinding
Parameter | Type | Description |
---|---|---|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
Parameter | Type | Description |
---|---|---|
|
HTTP code | Reponse body |
---|---|
200 - OK | |
201 - Created | |
401 - Unauthorized | Empty |
6.2.4. /apis/admissionregistration.k8s.io/v1/watch/validatingadmissionpolicybindings/{name}
Parameter | Type | Description |
---|---|---|
|
| name of the ValidatingAdmissionPolicyBinding |
- HTTP method
-
GET
- Description
- watch changes to an object of kind ValidatingAdmissionPolicyBinding. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.
HTTP code | Reponse body |
---|---|
200 - OK |
|
401 - Unauthorized | Empty |