This will send a dummy admission review payload to the webhook server. This is useful for development of the webhook server
Start server with make start-docker
Send an example request located in ./examples/admission-review.example.json via make send-request
Destroy the docker environment with make stop-docker
Building Docker Image
make docker-image : this builds the docker image locally
make push-image : this will build and push the docker image.
Ensure you run docker login before running this command and change
the DOCKER_ACCOUNT makefile variable to match your dockerhub account username.
Testing in K8s
Assuming you have permissions to deploy pods, mutating webhook configurations, and create namespaces,
the following will deploy the webhook service and test it in a k8s environment
make k8s-deploy: This will deploy the webhook service and mutatingwebhookconfiguration
make k8s-test: This will apply the resource ./examples/pod-with-defaults.yaml which is just a busybox echo command.
In addition, the pod description in yaml format will be dumped.
You can observer the spec.volumes and spec.containers section for volume mounts and see emptyDirs there.
This confirms the original ./examples/pod-with-defaults.yaml was mutated to have emptyDirs
make k8s-destroy: This will destroy the environment previously created