×
Description

MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.

Type

object

Specification

Property Type Description

.apiVersion

string

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/api-conventions.md#resources

.kind

string

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/api-conventions.md#types-kinds

.metadata

ObjectMeta meta/v1

Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.

.webhooks

array

Webhooks is a list of webhooks and the affected resources and operations.

.webhooks[]

object

Webhook describes an admission webhook and the resources and operations it applies to.

.webhooks
Description

Webhooks is a list of webhooks and the affected resources and operations.

Type

array

.webhooks[]
Description

Webhook describes an admission webhook and the resources and operations it applies to.

Type

object

Required
  • name

  • clientConfig

Property Type Description

clientConfig

object

WebhookClientConfig contains the information to make a TLS connection with the webhook

failurePolicy

string

FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.

name

string

The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where "imagepolicy" is the name of the webhook, and kubernetes.io is the name of the organization. Required.

namespaceSelector

LabelSelector meta/v1

NamespaceSelector decides whether to run the webhook 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 webhook.

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 webhook 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.

rules

array

Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches any Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.

rules[]

object

RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid.

.webhooks[].clientConfig
Description

WebhookClientConfig contains the information to make a TLS connection with the webhook

Type

object

Required
  • caBundle

Property Type Description

caBundle

string

caBundle is a PEM encoded CA bundle which will be used to validate the webhook’s server certificate. Required.

service

object

ServiceReference holds a reference to Service.legacy.k8s.io

url

string

url gives the location of the webhook, in standard URL form ([scheme://]host:port/path). Exactly one of url or service must be specified.

The host should not refer to a service running in the cluster; use the service field instead. The host might be resolved via external DNS in some apiservers (e.g., kube-apiserver cannot resolve in-cluster DNS as that would be a layering violation). host may also be an IP address.

Please note that using localhost or 127.0.0.1 as a host is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.

The scheme must be "https"; the URL must begin with "https://".

A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.

Attempting to use a user or basic auth e.g. "user:password@" is not allowed. Fragments ("#…​") and query parameters ("?…​") are not allowed, either.

.webhooks[].clientConfig.service
Description

ServiceReference holds a reference to Service.legacy.k8s.io

Type

object

Required
  • namespace

  • name

Property Type Description

name

string

name is the name of the service. Required

namespace

string

namespace is the namespace of the service. Required

path

string

path is an optional URL path which will be sent in any request to this service.

.webhooks[].rules
Description

Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches any Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.

Type

array

.webhooks[].rules[]
Description

RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid.

Type

object

Property Type Description

apiGroups

array (string)

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

array (string)

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

array (string)

Operations is the operations the admission hook cares about - CREATE, UPDATE, or * for all operations. If '*' is present, the length of the slice must be one. Required.

resources

array (string)

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.

API endpoints

The following API endpoints are available:

  • /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations

    • DELETE: delete collection of MutatingWebhookConfiguration

    • GET: list or watch objects of kind MutatingWebhookConfiguration

    • POST: create a MutatingWebhookConfiguration

  • /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations/{name}

    • DELETE: delete a MutatingWebhookConfiguration

    • GET: read the specified MutatingWebhookConfiguration

    • PATCH: partially update the specified MutatingWebhookConfiguration

    • PUT: replace the specified MutatingWebhookConfiguration

/apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations

Table 1. Global guery parameters
Parameter Type Description

pretty

string

If 'true', then the output is pretty printed.

HTTP method

DELETE

Description

delete collection of MutatingWebhookConfiguration

Table 2. Query parameters
Parameter Type Description

continue

string

The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.

fieldSelector

string

A selector to restrict the list of returned objects by their fields. Defaults to everything.

includeUninitialized

boolean

If true, partially initialized resources are included in the response.

labelSelector

string

A selector to restrict the list of returned objects by their labels. Defaults to everything.

limit

integer

limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.

The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.

resourceVersion

string

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.

timeoutSeconds

integer

Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.

watch

boolean

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

Table 3. HTTP responses
HTTP code Reponse body

200 - OK

Status meta/v1

401 - Unauthorized

Empty

HTTP method

GET

Description

list or watch objects of kind MutatingWebhookConfiguration

Table 4. Query parameters
Parameter Type Description

continue

string

The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.

fieldSelector

string

A selector to restrict the list of returned objects by their fields. Defaults to everything.

includeUninitialized

boolean

If true, partially initialized resources are included in the response.

labelSelector

string

A selector to restrict the list of returned objects by their labels. Defaults to everything.

limit

integer

limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.

The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.

resourceVersion

string

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.

timeoutSeconds

integer

Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.

watch

boolean

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

Table 5. HTTP responses
HTTP code Reponse body

200 - OK

MutatingWebhookConfigurationList admissionregistration.k8s.io/v1beta1

401 - Unauthorized

Empty

HTTP method

POST

Description

create a MutatingWebhookConfiguration

Table 6. Body parameters
Parameter Type Description

body

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

Table 7. HTTP responses
HTTP code Reponse body

200 - OK

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

201 - Created

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

202 - Accepted

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

401 - Unauthorized

Empty

/apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations/{name}

Table 8. Global path parameters
Parameter Type Description

name

string

name of the MutatingWebhookConfiguration

Table 9. Global guery parameters
Parameter Type Description

pretty

string

If 'true', then the output is pretty printed.

HTTP method

DELETE

Description

delete a MutatingWebhookConfiguration

Table 10. Query parameters
Parameter Type Description

gracePeriodSeconds

integer

The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.

orphanDependents

boolean

Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.

propagationPolicy

string

Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.

Table 11. Body parameters
Parameter Type Description

body

DeleteOptions meta/v1

Table 12. HTTP responses
HTTP code Reponse body

200 - OK

Status meta/v1

401 - Unauthorized

Empty

HTTP method

GET

Description

read the specified MutatingWebhookConfiguration

Table 13. Query parameters
Parameter Type Description

exact

boolean

Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.

export

boolean

Should this value be exported. Export strips fields that a user can not specify.

Table 14. HTTP responses
HTTP code Reponse body

200 - OK

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

401 - Unauthorized

Empty

HTTP method

PATCH

Description

partially update the specified MutatingWebhookConfiguration

Table 15. Body parameters
Parameter Type Description

body

Patch meta/v1

Table 16. HTTP responses
HTTP code Reponse body

200 - OK

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

401 - Unauthorized

Empty

HTTP method

PUT

Description

replace the specified MutatingWebhookConfiguration

Table 17. Body parameters
Parameter Type Description

body

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

Table 18. HTTP responses
HTTP code Reponse body

200 - OK

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

201 - Created

MutatingWebhookConfiguration admissionregistration.k8s.io/v1beta1

401 - Unauthorized

Empty