|
| 1 | +--- |
| 2 | +reviewers: |
| 3 | +- deads2k |
| 4 | +- sttts |
| 5 | +- cici37 |
| 6 | +title: Mutating Admission Policy |
| 7 | +content_type: concept |
| 8 | +--- |
| 9 | + |
| 10 | +<!-- overview --> |
| 11 | + |
| 12 | +{{< feature-state state="alpha" for_k8s_version="v1.32" >}} |
| 13 | + |
| 14 | +This page provides an overview of Mutating Admission Policy. |
| 15 | + |
| 16 | +<!-- body --> |
| 17 | + |
| 18 | +## What is Mutating Admission Policy? |
| 19 | + |
| 20 | +Mutating admission policies offer a declarative, in-process alternative to mutating admission webhooks. |
| 21 | + |
| 22 | +Mutating admission policies use the Common Expression Language (CEL) to declare mutations to resources. |
| 23 | +Mutations can be defined either with an *apply configuration* that is merged using the |
| 24 | +[server side apply merge strategy](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy) |
| 25 | +or a [JSON patch](https://jsonpatch.com/). |
| 26 | + |
| 27 | +Mutating admission policies are highly configurable, enabling policy authors to define policies |
| 28 | +that can be parameterized and scoped to resources as needed by cluster administrators. |
| 29 | + |
| 30 | +## What Resources Make a Policy |
| 31 | + |
| 32 | +A policy is generally made up of three resources: |
| 33 | + |
| 34 | +- The `MutatingAdmissionPolicy` describes the abstract logic of a policy |
| 35 | + (think: "this policy sets a particular label to a particular value"). |
| 36 | + |
| 37 | +- A `MutatingAdmissionPolicyBinding` links the above resources together and provides scoping. |
| 38 | + If you only want to set an `owner` label for `Pods`, the binding is where you would |
| 39 | + specify this mutation. |
| 40 | + |
| 41 | +- A parameter resource provides information to a `MutatingAdmissionPolicy` to make it a concrete |
| 42 | + statement (think "set the `owner` label to something that ends in `.company.com`"). |
| 43 | + A native type such as ConfigMap or a CRD defines the schema of a parameter resource. |
| 44 | + `MutatingAdmissionPolicy` objects specify what Kind they are expecting for their parameter resource. |
| 45 | + |
| 46 | +At least a `MutatingAdmissionPolicy` and a corresponding `MutatingAdmissionPolicyBinding` |
| 47 | +must be defined for a policy to have an effect. |
| 48 | + |
| 49 | +If a `MutatingAdmissionPolicy` does not need to be configured via parameters, simply leave |
| 50 | +`spec.paramKind` in `MutatingAdmissionPolicy` not specified. |
| 51 | + |
| 52 | +## Getting Started with Mutating Admission Policy |
| 53 | + |
| 54 | +TODO |
0 commit comments