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 (cryostatio#1615)
  • Loading branch information
andrewazores authored Aug 23, 2023
1 parent 6ba6053 commit 8023d71
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 @@ -252,10 +252,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 @@ -266,13 +271,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 @@ -286,6 +295,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 @@ -296,10 +307,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 8023d71

Please sign in to comment.