Skip to content

Commit

Permalink
test(smoketest): apply resource constraints matching operator deploym…
Browse files Browse the repository at this point in the history
…ent defaults (#1615)
  • Loading branch information
andrewazores committed Sep 13, 2023
1 parent e38675a commit fb3650c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ fi
# run as root (uid 0) within the container - with rootless podman this means
# that the process will actually run with your own uid on the host machine,
# rather than the uid being remapped to something else
#
# limits set to match operator defaults:
# https://github.com/cryostatio/cryostat-operator/blob/2d386930dc96f0dcaf937987ec35874006c53b61/internal/controllers/common/resource_definitions/resource_definitions.go#L66
podman run \
--pod cryostat-pod \
--name cryostat \
Expand All @@ -125,7 +128,8 @@ podman run \
--label io.cryostat.jmxHost="localhost" \
--label io.cryostat.jmxPort="0" \
--label io.cryostat.jmxUrl="service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi" \
--memory 768M \
--cpus 0.1 \
--memory 384M \
--mount type=bind,source="$(dirname "$0")/archive",destination=/opt/cryostat.d/recordings.d,relabel=shared \
--mount type=bind,source="$(dirname "$0")/certs",destination=/certs,relabel=shared \
--mount type=bind,source="$(dirname "$0")/clientlib",destination=/clientlib,relabel=shared \
Expand Down
17 changes: 14 additions & 3 deletions smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,15 @@ runJfrDatasource() {
tag="$(getPomProperty cryostat.itest.jfr-datasource.version)"
DATASOURCE_IMAGE="${stream}:${tag}"
fi
# limits set to match operator defaults:
# https://github.com/cryostatio/cryostat-operator/blob/2d386930dc96f0dcaf937987ec35874006c53b61/internal/controllers/common/resource_definitions/resource_definitions.go#L66
local RJMX_PORT=11223
podman run \
--name jfr-datasource \
--pull "${PULL_IMAGES}" \
--pod cryostat-pod \
--cpus 0.1 \
--memory 512m \
--rm -d "${DATASOURCE_IMAGE}"
}

Expand All @@ -267,13 +272,17 @@ runGrafana() {
tag="$(getPomProperty cryostat.itest.grafana.version)"
GRAFANA_IMAGE="${stream}:${tag}"
fi
# limits set to match operator defaults:
# https://github.com/cryostatio/cryostat-operator/blob/2d386930dc96f0dcaf937987ec35874006c53b61/internal/controllers/common/resource_definitions/resource_definitions.go#L66
local host; local port;
host="$(getPomProperty cryostat.itest.webHost)"
port="$(getPomProperty cryostat.itest.jfr-datasource.port)"
podman run \
--name grafana \
--pull "${PULL_IMAGES}" \
--pod cryostat-pod \
--cpus 0.1 \
--memory 256M \
--env GF_INSTALL_PLUGINS=grafana-simple-json-datasource \
--env GF_AUTH_ANONYMOUS_ENABLED=true \
--env JFR_DATASOURCE_URL="http://${host}:${port}" \
Expand All @@ -287,6 +296,8 @@ runReportGenerator() {
tag="$(getPomProperty cryostat.itest.reports.version)"
REPORTS_IMAGE="${stream}:${tag}"
fi
# limits set to match operator defaults:
# https://github.com/cryostatio/cryostat-operator/blob/2d386930dc96f0dcaf937987ec35874006c53b61/internal/controllers/common/resource_definitions/resource_definitions.go#L66
local RJMX_PORT=10000
local port;
port="$(getPomProperty cryostat.itest.reports.port)"
Expand All @@ -297,10 +308,10 @@ runReportGenerator() {
--label io.cryostat.discovery="true" \
--label io.cryostat.jmxHost="localhost" \
--label io.cryostat.jmxPort="${RJMX_PORT}" \
--cpus 1 \
--memory 512M \
--cpus 0.128 \
--memory 256M \
--restart on-failure \
--env JAVA_OPTS="-XX:ActiveProcessorCount=1 -Dcom.sun.management.jmxremote.autodiscovery=true -Dcom.sun.management.jmxremote.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.rmi.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" \
--env JAVA_OPTS="-Dcom.sun.management.jmxremote.autodiscovery=true -Dcom.sun.management.jmxremote.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.rmi.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" \
--env QUARKUS_HTTP_PORT="${port}" \
--rm -d "${REPORTS_IMAGE}"
}
Expand Down

0 comments on commit fb3650c

Please sign in to comment.