The sos-endpoint accepts JSON as simple text and puts it on a topic.
src/main/java
- the service source codesrc/main/kubernetes
-Kubernetes
artifacts
This is a Spring Boot
application which is deployed in Kubernetes
. The container is built using the jib
plugin
for Maven
.
The application configuration is handled through a Kubernetes
ConfigMap
which is automatically read in by Spring Boot
at deployment time. The following properties are supported:
- [required]
mil.afdcgs.merlin.sos.kafka.bootstrap-server
: theDNS
name of theKafka
bootstrap server to connect to. - [default 1]
mil.afdcgs.merlin.sos.kafka.partition-count
: the number of partitions for each created topic. - [default 1]
mil.afdcgs.merlin.sos.kafka.replica-count
: the number of partition replicas to create across the cluster. This number can't exceed the number of nodes in the cluster.
The project uses these modules:
spring-boot-starter-actuator
- This module allows us to monitor the service health and metrics throughHTTP
.spring-kafka
- a Spring library for connecting toKafka
and using it in a Spring-like fashion.spring-boot-starter-websocket
- a Spring library for handing websockets.
To build the project:
mvn clean install
This will create a Docker
container image and upload it to the local Docker
repository.
To send data to the endpoint using curl
:
curl -v merlin.localdev.me/sos/sensor -H 'Content-Type:application/json' -d '{"name": "Elrond", "role": "Elf Lord"}'
For local development and testing, the process for making the built images available to the kubernetes
cluster is
dependent upon the Kubernetes
Note: If you're running on Docker Desktop then this step is not required.
$ docker push registry.localdev.me/sos-endpoint:latest
$ docker save --output target/sos-endpoint-latest.tar registry.localdev.me/sos-endpoint:latest
$ sudo k3s ctr images import target/sos-endpoint-latest.tar
$ kubectl apply -f src/main/kubernetes/sos-endpoint.yaml
It can be removed with:
$ kubectl delete -f src/main/kubernetes/sos-endpoint.yaml