This is used for watching Kubernetes deployments and emitting a web hook event. This uses the Kubernetes java client.
To initiate listening to the cluster - hit the end point /k8s/watch/start
. Example - curl http://localhost:9999/k8s/watch/start
To add a webhook - hit the end point /k8s/watch/add
. Two params need to be passed name
and url
. Example: curl -v -X POST http://localhost:9999/k8s/watch/add\?name\=Foo\&url\=http://127.0.0.1:5000/
Initiate a change in Kubernetes - add/change/delete and you will see the webhooks being triggered
If you want to deploy to Kubernetes. JSONNET is required for generating the files. To install jsonnet look at here -> https://github.com/google/jsonnet
Sample kuberentes files are in the directory kuberbetes
.
Run git submodule update --init --recursive
to set up the kubernetes template directory.
Either minikube (https://kubernetes.io/docs/tasks/tools/install-minikube/) or Docker for Desktop (https://www.docker.com/products/docker-desktop)
- Clone the repo
- Run
mvn spring-boot:run
See section how to use this
- Clone the repo
- Run
mvn clean package docker:build
- Run
kubectl apply -f kubernetes/readpods.yml
. This create a service accaunt calledjava-watch-sv
. The service account is used toget, watch and list
pods and namesapces. - If you do not have jsonnet - run
kubectl apply -f values.yml
. If you do have jsonnet - runjsonnet javakwatch.jsonnet | kubectl apply -f -
- If you haven't run this -> Run
git submodule update --init --recursive
- Run
k8s-template/createTemplates.sh -f kubernetes/javakwatch.jsonnet -k
.