Spring Framework based Service which is mirroring requests with the option to delay requests and alter http response codes
At least: Java 11 and Maven 3.5
mvn package -DskipTests=true
mvn spring-boot:run
java -jar target\mirrorservice-0.3.1-SNAPSHOT.jar
./target/mirrorservice-0.3.1-SNAPSHOT.jar start
docker build -t mirrorservice:latest . --build-arg JAR_FILE=./target/mirrorservice-0.3.1-SNAPSHOT.jar
- docker tag mirrorservice:latest docker.pkg.github.com/wlanboy/mirrorservice/mirrorservice:latest
- docker push docker.pkg.github.com/wlanboy/mirrorservice/mirrorservice:latest
##Docker Hub
- docker run --name mirrorservice -m 256M -d -p 8003:8003 -v /tmp:/tmp mirrorservice:latest
cd ~
git clone https://github.com/wlanboy/MirrorService.git
kubectl cluster-info
kubectl get pods --all-namespaces
cd ~/MirrorService
kubectl create namespace mirror
kubectl apply -f mirrorservice-deployment.yaml
kubectl apply -f mirrorservice-service.yaml
kubectl get pods -n mirror -o wide
kubectl describe deployments -n mirror mirrorservice
kubectl describe services -n mirror mirrorservice-service
kubectl expose deployment -n mirror mirrorservice --type=NodePort --name=mirrorservice-serviceexternal --port 8003
kubectl describe services -n mirror mirrorservice-serviceexternal
Result:
Name: mirrorservice-serviceexternal
Namespace: mirror
Labels: app=mirrorservice
Annotations: <none>
Selector: app=mirrorservice
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.108.40.139
IPs: 10.108.40.139
Port: <unset> 8003/TCP
TargetPort: 8002/TCP
NodePort: <unset> 30412/TCP <--- THIS IS THE PORT WE NEED
Endpoints: 10.10.0.7:8003
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
- curl http://192.168.56.100:30412/actuator/health
- Result
{"status":"UP","groups":["liveness","readiness"]}
http://localhost:8003/mirror?statuscode=201&wait=1000 (1000ms)
returns http status code 201 and waits for 10 ms / mirrors body and headers
sdk install java 21.0.5-tem
sdk install maven 3.9.9