Skip to content

Latest commit

 

History

History
104 lines (71 loc) · 2.35 KB

File metadata and controls

104 lines (71 loc) · 2.35 KB

JavaHttpClient

Spring based rest service to test http routes in kubernetes. Showing http status, response, timing and istio envy settings.

Web ui

web ui

Istio tab

istio tab

Swagger

istio tab

Build

mvn package

Docker build

docker build -t wlanboy/javahttpclient:latest . 

Docker build with jlink and without

docker build -f Dockerfile25 -t javahttpclient:jre .
docker build -f Dockerfile25Jlink -t javahttpclient:jlink .

docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" | grep "javahttpclient"
javahttpclient   jre       510MB
javahttpclient   jlink     295MB

Run container

docker run --rm --name httpclient --publish 8080:8080 javahttpclient:jre

docker run --rm --name httpclient --publish 8080:8080 javahttpclient:jlink

Docker hub

Test java http client

curl -L -X POST 'http://127.0.0.1:8080/client' -H 'Content-Type: application/json' \
-d '{"url" : "https://github.com", "copyHeaders": "false"}'

local dev

curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash

POD=$(kubectl get pod -n javahttpclient -l app=javahttpclient -o jsonpath='{.items[0].metadata.name}')

mirrord exec -n javahttpclient --target deployment/javahttpclient -- mvn spring-boot:run 

mirrord exec -n javahttpclient --target pod/$POD -- java -jar target/javahttpclient-0.0.1-SNAPSHOT.jar

mirrord exec -n javahttpclient --target deployment/javahttpclient -- java -jar target/javahttpclient-0.0.1-SNAPSHOT.jar

swagger uri

curl calls for mirrorservice

curl -X 'POST' \
  'http://localhost:8080/client' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "http://gmk:8003/resolve/google.com",
  "method": "GET",
  "body": "",
  "copyHeaders": false
}'

curl -X 'POST' \
  'http://localhost:8080/client' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "http://gmk:8003/mirror?request=HalloWelt&statuscode=200&wait=4",
  "method": "GET",
  "body": "",
  "copyHeaders": true
}'