Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(custom_targets): handle embedded credentials, enable tests #188

Merged
merged 27 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
edc9db4
tmp
andrewazores Nov 23, 2023
d76dae3
don't hardcode target ID 1
andrewazores Nov 23, 2023
7bdd580
use MediaType enum for @Produces/@Consumes
andrewazores Nov 23, 2023
6053789
turn off JDP in unit tests
andrewazores Nov 23, 2023
360d81d
custom target creation should include target in response body
andrewazores Nov 23, 2023
cf6f752
handle custom target credentials passed along with request form body
andrewazores Nov 23, 2023
d85fb10
check for stored credentials when opening target connections
andrewazores Nov 23, 2023
833bb7b
refactor to use redirect-handling webClient extensions, ensure selfte…
andrewazores Nov 23, 2023
86dc577
fixup test class
andrewazores Nov 23, 2023
07c5a57
fix(messaging): handle writing to websockets on dedicated worker thread
andrewazores Nov 27, 2023
b9088c5
enhance websocket expectation logging and closure handling
andrewazores Nov 27, 2023
ed33b94
correct custom target notification expectations for 3.0 event emissio…
andrewazores Nov 27, 2023
d5425e8
don't try to create credentials if none specified
andrewazores Nov 28, 2023
5ad43d2
refactor to handle ".data.reason" format of API V2 JSON responses in …
andrewazores Nov 28, 2023
10e8c01
deploy 3 vertx-fib-demo samples, one with auth, one with auth+ssl
andrewazores Nov 28, 2023
74cddfb
bust connection cache entries if matching credentials change
andrewazores Nov 29, 2023
3a030dd
refactor, extract method
andrewazores Nov 29, 2023
5d667af
handle uncaught JMX ConnectionException as a 502 BAD GATEWAY
andrewazores Nov 29, 2023
62d416f
better error message formatting
andrewazores Nov 29, 2023
b7e7a4a
fixup! bust connection cache entries if matching credentials change
andrewazores Nov 29, 2023
1122499
permit null JVM IDs, target may not have been connectable yet if we n…
andrewazores Nov 29, 2023
c1676d4
formatting
andrewazores Nov 29, 2023
2686b9e
clean up handling of connection testing and credentials
andrewazores Nov 29, 2023
948c45b
handle JMX auth failure as HTTP 403 Forbidden
andrewazores Nov 29, 2023
e5354d6
fix concurrent modification exception
andrewazores Nov 29, 2023
d086116
drop gson dependency
andrewazores Nov 30, 2023
cea1f36
append, not override, sample app java opts
andrewazores Dec 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount>
<failsafe-plugin.version>3.2.3</failsafe-plugin.version>
<failsafe.rerunFailingTestsCount>${surefire.rerunFailingTestsCount}</failsafe.rerunFailingTestsCount>
<com.google.code.gson.version>2.10.1</com.google.code.gson.version><!-- TODO drop this -->
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -230,12 +229,6 @@
<version>${com.github.spotbugs.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${com.google.code.gson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand Down
67 changes: 62 additions & 5 deletions smoketest/compose/sample-apps.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3"
services:
sample-app:
sample-app-1:
depends_on:
cryostat:
condition: service_healthy
Expand All @@ -12,17 +12,17 @@ services:
CRYOSTAT_AGENT_APP_NAME: "vertx-fib-demo-1"
CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL: "true"
CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME: "false"
CRYOSTAT_AGENT_WEBSERVER_HOST: "sample-app"
CRYOSTAT_AGENT_WEBSERVER_HOST: "sample-app-1"
CRYOSTAT_AGENT_WEBSERVER_PORT: "8910"
CRYOSTAT_AGENT_CALLBACK: "http://sample-app:8910/"
CRYOSTAT_AGENT_CALLBACK: "http://sample-app-1:8910/"
CRYOSTAT_AGENT_BASEURI: "http://cryostat:8181/"
CRYOSTAT_AGENT_TRUST_ALL: "true"
CRYOSTAT_AGENT_AUTHORIZATION: "Basic dXNlcjpwYXNz"
ports:
- "8081:8081"
labels:
io.cryostat.discovery: "true"
io.cryostat.jmxHost: "sample-app"
io.cryostat.jmxHost: "sample-app-1"
io.cryostat.jmxPort: "9093"
restart: always
healthcheck:
Expand All @@ -31,6 +31,63 @@ services:
retries: 3
start_period: 10s
timeout: 5s
sample-app-2:
depends_on:
cryostat:
condition: service_healthy
image: quay.io/andrewazores/vertx-fib-demo:0.13.0
hostname: vertx-fib-demo-2
environment:
HTTP_PORT: 8082
JMX_PORT: 9094
USE_AUTH: "true"
CRYOSTAT_AGENT_APP_NAME: "vertx-fib-demo-2"
CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL: "true"
CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME: "false"
CRYOSTAT_AGENT_WEBSERVER_HOST: "sample-app-2"
CRYOSTAT_AGENT_WEBSERVER_PORT: "8911"
CRYOSTAT_AGENT_CALLBACK: "http://sample-app-2:8911/"
CRYOSTAT_AGENT_BASEURI: "http://cryostat:8181/"
CRYOSTAT_AGENT_TRUST_ALL: "true"
CRYOSTAT_AGENT_AUTHORIZATION: "Basic dXNlcjpwYXNz"
ports:
- "8082:8082"
restart: always
healthcheck:
test: curl --fail http://localhost:8081 || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s
sample-app-3:
depends_on:
cryostat:
condition: service_healthy
image: quay.io/andrewazores/vertx-fib-demo:0.13.0
hostname: vertx-fib-demo-3
environment:
HTTP_PORT: 8083
JMX_PORT: 9095
USE_AUTH: "true"
USE_SSL: "true"
CRYOSTAT_AGENT_APP_NAME: "vertx-fib-demo-3"
CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL: "true"
CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME: "false"
CRYOSTAT_AGENT_WEBSERVER_HOST: "sample-app-3"
CRYOSTAT_AGENT_WEBSERVER_PORT: "8910"
CRYOSTAT_AGENT_CALLBACK: "http://sample-app-3:8912/"
CRYOSTAT_AGENT_BASEURI: "http://cryostat:8181/"
CRYOSTAT_AGENT_TRUST_ALL: "true"
CRYOSTAT_AGENT_AUTHORIZATION: "Basic dXNlcjpwYXNz"
ports:
- "8083:8083"
restart: always
healthcheck:
test: curl --fail http://localhost:8081 || exit 1
interval: 10s
retries: 3
start_period: 10s
timeout: 5s
quarkus-test-agent:
image: quay.io/andrewazores/quarkus-test:latest
# do not add a depends_on:cryostat here, so that we can test that the agent is tolerant of that state
Expand All @@ -40,7 +97,7 @@ services:
expose:
- "9977"
environment:
JAVA_OPTS: "-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/deployments/app/cryostat-agent.jar"
JAVA_OPTS_APPEND: "-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/deployments/app/cryostat-agent.jar"
QUARKUS_HTTP_PORT: 10010
ORG_ACME_CRYOSTATSERVICE_ENABLED: "false"
CRYOSTAT_AGENT_APP_NAME: quarkus-test-agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ kind: Deployment
metadata:
annotations:
io.cryostat.discovery: "true"
io.cryostat.jmxHost: sample-app
io.cryostat.jmxHost: sample-app-1
io.cryostat.jmxPort: "9093"
creationTimestamp: null
labels:
io.kompose.service: sample-app
name: sample-app
io.kompose.service: sample-app-1
name: sample-app-1
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: sample-app
io.kompose.service: sample-app-1
strategy: {}
template:
metadata:
annotations:
io.cryostat.discovery: "true"
io.cryostat.jmxHost: sample-app
io.cryostat.jmxHost: sample-app-1
io.cryostat.jmxPort: "9093"
creationTimestamp: null
labels:
io.kompose.network/compose-default: "true"
io.kompose.service: sample-app
io.kompose.service: sample-app-1
spec:
containers:
- env:
Expand All @@ -35,15 +35,15 @@ spec:
- name: CRYOSTAT_AGENT_BASEURI
value: http://cryostat:8181/
- name: CRYOSTAT_AGENT_CALLBACK
value: http://sample-app:8910/
value: http://sample-app-1:8910/
- name: CRYOSTAT_AGENT_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME
value: "false"
- name: CRYOSTAT_AGENT_WEBSERVER_HOST
value: sample-app
value: sample-app-1
- name: CRYOSTAT_AGENT_WEBSERVER_PORT
value: "8910"
- name: HTTP_PORT
Expand All @@ -59,7 +59,7 @@ spec:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
name: sample-app
name: sample-app-1
ports:
- containerPort: 8081
hostPort: 8081
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ kind: Service
metadata:
annotations:
io.cryostat.discovery: "true"
io.cryostat.jmxHost: sample-app
io.cryostat.jmxHost: sample-app-1
io.cryostat.jmxPort: "9093"
creationTimestamp: null
labels:
io.kompose.service: sample-app
name: sample-app
io.kompose.service: sample-app-1
name: sample-app-1
spec:
ports:
- name: "8081"
port: 8081
targetPort: 8081
selector:
io.kompose.service: sample-app
io.kompose.service: sample-app-1
status:
loadBalancer: {}
64 changes: 64 additions & 0 deletions smoketest/k8s/sample-app-2-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: sample-app-2
name: sample-app-2
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: sample-app-2
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.network/compose-default: "true"
io.kompose.service: sample-app-2
spec:
containers:
- env:
- name: CRYOSTAT_AGENT_APP_NAME
value: vertx-fib-demo-2
- name: CRYOSTAT_AGENT_AUTHORIZATION
value: Basic dXNlcjpwYXNz
- name: CRYOSTAT_AGENT_BASEURI
value: http://cryostat:8181/
- name: CRYOSTAT_AGENT_CALLBACK
value: http://sample-app-2:8911/
- name: CRYOSTAT_AGENT_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME
value: "false"
- name: CRYOSTAT_AGENT_WEBSERVER_HOST
value: sample-app-2
- name: CRYOSTAT_AGENT_WEBSERVER_PORT
value: "8911"
- name: HTTP_PORT
value: "8082"
- name: JMX_PORT
value: "9094"
- name: USE_AUTH
value: "true"
image: quay.io/andrewazores/vertx-fib-demo:0.13.0
livenessProbe:
exec:
command:
- curl --fail http://localhost:8081 || exit 1
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
name: sample-app-2
ports:
- containerPort: 8082
hostPort: 8082
protocol: TCP
resources: {}
hostname: vertx-fib-demo-2
restartPolicy: Always
status: {}
16 changes: 16 additions & 0 deletions smoketest/k8s/sample-app-2-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
io.kompose.service: sample-app-2
name: sample-app-2
spec:
ports:
- name: "8082"
port: 8082
targetPort: 8082
selector:
io.kompose.service: sample-app-2
status:
loadBalancer: {}
66 changes: 66 additions & 0 deletions smoketest/k8s/sample-app-3-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: sample-app-3
name: sample-app-3
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: sample-app-3
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.network/compose-default: "true"
io.kompose.service: sample-app-3
spec:
containers:
- env:
- name: CRYOSTAT_AGENT_APP_NAME
value: vertx-fib-demo-3
- name: CRYOSTAT_AGENT_AUTHORIZATION
value: Basic dXNlcjpwYXNz
- name: CRYOSTAT_AGENT_BASEURI
value: http://cryostat:8181/
- name: CRYOSTAT_AGENT_CALLBACK
value: http://sample-app-3:8912/
- name: CRYOSTAT_AGENT_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_TRUST_ALL
value: "true"
- name: CRYOSTAT_AGENT_WEBCLIENT_SSL_VERIFY_HOSTNAME
value: "false"
- name: CRYOSTAT_AGENT_WEBSERVER_HOST
value: sample-app-3
- name: CRYOSTAT_AGENT_WEBSERVER_PORT
value: "8910"
- name: HTTP_PORT
value: "8083"
- name: JMX_PORT
value: "9095"
- name: USE_AUTH
value: "true"
- name: USE_SSL
value: "true"
image: quay.io/andrewazores/vertx-fib-demo:0.13.0
livenessProbe:
exec:
command:
- curl --fail http://localhost:8081 || exit 1
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
name: sample-app-3
ports:
- containerPort: 8083
hostPort: 8083
protocol: TCP
resources: {}
hostname: vertx-fib-demo-3
restartPolicy: Always
status: {}
16 changes: 16 additions & 0 deletions smoketest/k8s/sample-app-3-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
io.kompose.service: sample-app-3
name: sample-app-3
spec:
ports:
- name: "8083"
port: 8083
targetPort: 8083
selector:
io.kompose.service: sample-app-3
status:
loadBalancer: {}
Loading
Loading