Skip to content

Instantly share code, notes, and snippets.

@onelittlenightmusic
Last active March 22, 2020 20:43
Show Gist options
  • Save onelittlenightmusic/4efde74611d6ebe05e2e63a1ea03615e to your computer and use it in GitHub Desktop.
Save onelittlenightmusic/4efde74611d6ebe05e2e63a1ea03615e to your computer and use it in GitHub Desktop.
main = { #Start of value
"apiVersion": "admission.k8s.io/v1beta1",
"kind": "AdmissionReview",
"response": {
"allowed": true,
"patchType": "JSONPatch",
"patch": patch_bytes,
}
} #End of value
{ #Start of condition
is_create_or_update
input.request.object.metadata.annotations["test-mutation"]
patch = [
{"op": "add", "path": "/metadata/annotations/foo", "value": "bar"},
]
patch_json = json.marshal(patch)
patch_bytes = base64url.encode(patch_json)
} #End of condition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment