package kubecaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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

type t
val to_yojson : t -> Yojson.Safe.t

Client_config defines how to communicate with the hook. Required

val failure_policy : t -> string option

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

val name : t -> 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.

Namespace_selector 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: "namespace_selector": { "match_expressions": [ { "key": "runlevel", "operator": "not_in", "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: "namespace_selector": { "match_expressions": [ { "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 Label_selector, which matches everything.

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 Validating_admission_webhooks and Mutating_admission_webhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, Validating_admission_webhooks and Mutating_admission_webhooks are never called on admission requests for Validating_webhook_configuration and Mutating_webhook_configuration objects.

module Object : Object.S with type value := t
OCaml

Innovation. Community. Security.