This guide explains how to set up your environment for developing on admission-webhook-datree.
This guide was written for macOS and Linux machines.
use the following command to get all the webhook internal logs from the past 72 hours
curl https://raw.githubusercontent.com/datreeio/admission-webhook-datree/main/scripts/export-logs.sh | /bin/bash
- Go version 1.19
- Git
- optional: gow (go file watcher)
- optional: VS Code + Thunder Client
make start
make start-watch
- GET /health
- POST /validate (webhook-demo.yaml)
- Run Docker daemon by opening Docker desktop
- Run
minikube start --extra-config=apiserver.enable-admission-plugins=ValidatingAdmissionWebhook
- Run
make deploy-in-minikube
- this will build a docker image and deploy it to minikube - check the webhook is deployed:
kubectl get pods -n datree
- try to apply a demo file to the deployment:
kubectl apply -f ./internal/fixtures/webhook-demo.yaml
./scripts/uninstall.sh
make run-in-minikube
this will apply the webhook-demo.yaml file to minikube and compare the output to ./internal/fixtures/webhook-demo-expected-output.txt
make test-in-minikube
./scripts/build-docker-image.sh
Important things to keep in mind when releasing to production:
When uploading a new version you should run the github action and wait until a new build is uploaded to dockerhub.
The release will fail in the following scenarios:
- Release is performed and then immediately a new commit is pushed to main - will release a production tag with commit hash (instead of semantic version)
- Release is performed right after merging to main - will release a staging tag with semantic version (instead of commit hash)
- Release is performed twice in a row (without pushing a new commit) - will try to release the same docker tag again (and fail)
When releasing a new version to production notice if cloudfront invalidation failed - if so re-run the failed release workflow