A mutating admission controller for Kubernetes that will enforce certain fields in resources belonging to the Aiven Operator.
Things we mutate
- projectVpcId
- terminationProtection: true
- cloudName: google-{{ .Values.location }}
- tags: (environment, tenant, team)
Mutilator can use earthly for building.
If you don't have earthly installed, you can use the wrapper at ./earthlyw
, which downloads the latest version for you.
earthly ls
to list targetsearthly +docker
to build primary target
- Use
nix build .#docker
to build docker image - Load docker image into Docker Daemon w/
docker load < result
Mutilator is a mutating webhook, which means the requests can be difficult to handcraft when testing. For that reason, there is a Tiltfile that installs the webhook into a local kind cluster and configures mutilator. Optionally, tilt can create a service that points out of the cluster to your locally running instance. This way you can run mutilator in a debugger, and trigger mutation by applying resources in the kind cluster.
To use this, you need to have Tilt installed. It is also recommended to use ctlptl to manage your local cluster.
- Start the cluster:
ctlptl create cluster kind --registry=ctlptl-registry
- Start tilt:
- mutilator running in cluster:
tilt up
, or - mutilator running locally:
tilt up -- --debugger
- mutilator running in cluster:
- Either
-
Watch logs in cluster
kubectl logs -lapp.kubernetes.io/name=mutilator
, or -
Run mutilator in your debugger, with these environment variables:
Variable Value MUTILATOR__PROJECT_VPC_ID
00000000-0000-0000-0000-000000000000
MUTILATOR__WEB__CERTIFICATE_PATH
tls.crt
MUTILATOR__WEB__PRIVATE_KEY_PATH
tls.key
-
- Apply suitable resources to trigger mutations:
kubectl apply -f develop/