expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec
expression must return an array of JSONPatch values.
For example, this CEL expression returns a JSON patch to conditionally modify a value:
[
JSONPatch{op: "test", path: "/spec/example", value: "Red"},
JSONPatch{op: "replace", path: "/spec/example", value: "Green"}
]
To define an object for the patch value, use Object types. For example:
[
JSONPatch{
op: "add",
path: "/spec/selector",
value: Object.spec.selector{matchLabels: {"environment": "test"}}
}
]
To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example:
[
JSONPatch{
op: "add",
path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"),
value: "test"
},
]
CEL expressions have access to the types needed to create JSON patches and objects:
CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:
CEL expressions have access to Kubernetes CEL function libraries as well as:
Only property names of the form [a-zA-Z_.-/][a-zA-Z0-9_.-/]*
are accessible. Required.
Generated using TypeDoc
JSONPatch defines a JSON Patch.
IoK8sApiAdmissionregistrationV1alpha1JSONPatch