Admission controllers affect what actions we let occur on our Kubernetes clusters, either by validating and approving or denying them, or by changing the actual API request objects itself. To alter these objects, we leverage a MutatingAdmissionsWebhook, which parses and updates the object before validation and deployment. In this lab, we’ll write one of these webhooks!
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Write Response
Within the
webhooks/label-add-webhook/
directory, update theapp/server.js
file to create a response object.- Create JSON Patch
Generate a file containing the label information in the appropriate format. Encode it and add it to the response object.
- Deploy and Test
If using your own image:
- Generate certs.
- Update
label-add-webhook-registration.yaml
with the Base64-encoded output ofapp/ca.crt
. - Log in to Docker; tag and push to repo.
- Update
label-add-webhook-deploy.yaml
with your user name instead oflinuxacademycontent
. - Deploy webhook and test as described in the instructions.
If using the provided test image: Deploy webhook as described in the instructions.