From 2af2ea376e552593f969e8a73d4df196f0776fda Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 13 Jan 2020 16:03:16 +0000 Subject: [PATCH 1/8] Add jolokia tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These were moved to the OpenJDK image sources but should be (closer) to the module they test. Ideally they'd be even closer (under jboss/container/jolokia…) but see https://github.com/cekit/cekit/issues/638 Signed-off-by: Jonathan Dowland --- tests/features/jolokia.feature | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/features/jolokia.feature diff --git a/tests/features/jolokia.feature b/tests/features/jolokia.feature new file mode 100644 index 00000000..44a00202 --- /dev/null +++ b/tests/features/jolokia.feature @@ -0,0 +1,10 @@ +# Tests for jboss/container/jolokia +@openjdk +@redhat-openjdk-18 +@openj9 +Feature: Openshift OpenJDK Jolokia tests + + Scenario: Check Environment variable is correct + Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Then run sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= + From 26231e5b572ef0b8ad5c4ca1ed3b6c3c85bd87ed Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 19:14:01 +0000 Subject: [PATCH 2/8] Remove legacy "jolokia" module Signed-off-by: Jonathan Dowland --- jolokia/added/standalone.conf | 14 -------------- jolokia/configure.sh | 13 ------------- jolokia/module.yaml | 7 ------- 3 files changed, 34 deletions(-) delete mode 100644 jolokia/added/standalone.conf delete mode 100755 jolokia/configure.sh delete mode 100644 jolokia/module.yaml diff --git a/jolokia/added/standalone.conf b/jolokia/added/standalone.conf deleted file mode 100644 index 17687190..00000000 --- a/jolokia/added/standalone.conf +++ /dev/null @@ -1,14 +0,0 @@ - -. $JBOSS_HOME/bin/launch/files.sh - -JBOSS_MODULES_JAR=$(getfiles jboss-modules) -JBOSS_LOGMANAGER_JAR=$(getfiles org/jboss/logmanager/main/jboss-logmanager) -JBOSS_LOGMANAGER_EXT_JAR=$(getfiles org/jboss/logmanager/ext/main/) - -AB_JOLOKIA_PORT=$((${AB_JOLOKIA_PORT:-8778} + ${PORT_OFFSET:-0})) -export AB_JOLOKIA_PORT - -# add jolokia options -JAVA_OPTS="${JAVA_OPTS} $(/opt/jolokia/jolokia-opts)" - -JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:${JBOSS_MODULES_JAR}:${JBOSS_LOGMANAGER_JAR}:${JBOSS_LOGMANAGER_EXT_JAR} -Djava.util.logging.manager=org.jboss.logmanager.LogManager" diff --git a/jolokia/configure.sh b/jolokia/configure.sh deleted file mode 100755 index f569a0b9..00000000 --- a/jolokia/configure.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -SCRIPT_DIR=$(dirname $0) -ADDED_DIR=${SCRIPT_DIR}/added -SOURCES_DIR="/tmp/artifacts" - -# for backward compatibility. jolokia is now located in /opt/jolokia. -# Add Jolokia (http://www.jolokia.org/) to expose all MBeans -ln -s /opt/jolokia/jolokia.jar $JBOSS_HOME/jolokia.jar - -# Start Jolokia agent on boot -cat ${ADDED_DIR}/standalone.conf >> $JBOSS_HOME/bin/standalone.conf diff --git a/jolokia/module.yaml b/jolokia/module.yaml deleted file mode 100644 index 80b96caa..00000000 --- a/jolokia/module.yaml +++ /dev/null @@ -1,7 +0,0 @@ -schema_version: 1 -name: jolokia -version: '1.0' -description: Legacy jolokia script package. -execute: -- script: configure.sh - user: '185' From b9342cb416f6aedbb986c6cf902386016908e3ff Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 16:02:34 +0000 Subject: [PATCH 3/8] Move Jolokia port check from general to jolokia.feature Signed-off-by: Jonathan Dowland --- tests/features/common.feature | 7 ------- tests/features/jolokia.feature | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/features/common.feature b/tests/features/common.feature index 5e4ff01f..ac95cb96 100644 --- a/tests/features/common.feature +++ b/tests/features/common.feature @@ -1,13 +1,6 @@ Feature: Openshift common tests - @jboss-decisionserver-6 @jboss-processserver-6 @jboss-webserver-3/webserver30-tomcat7-openshift @jboss-webserver-3/webserver31-tomcat7-openshift @jboss-webserver-3/webserver30-tomcat8-openshift @jboss-webserver-3/webserver31-tomcat8-openshift @jboss-amq-6 - Scenario: Check jolokia port is available - When container is ready - Then check that port 8778 is open - Then inspect container - | path | value | - | /Config/ExposedPorts | 8778/tcp | # CLOUD-1017: Option to enable script debugging @jboss-kieserver-6 @jboss-decisionserver-6 @jboss-processserver-6 @jboss-webserver-3/webserver30-tomcat7-openshift @jboss-webserver-3/webserver31-tomcat7-openshift @jboss-webserver-3/webserver30-tomcat8-openshift @jboss-webserver-3/webserver31-tomcat8-openshift @jboss-amq-6 @jboss-datavirt-6 @redhat-sso-7 diff --git a/tests/features/jolokia.feature b/tests/features/jolokia.feature index 44a00202..99f7e2fb 100644 --- a/tests/features/jolokia.feature +++ b/tests/features/jolokia.feature @@ -1,10 +1,23 @@ # Tests for jboss/container/jolokia -@openjdk -@redhat-openjdk-18 -@openj9 Feature: Openshift OpenJDK Jolokia tests + @openjdk + @redhat-openjdk-18 + @openj9 Scenario: Check Environment variable is correct Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet - Then run sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= + Then run sh -c 'unzip -q -p /opt/jboss/container/jolokia/jolokia.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= + @jboss-decisionserver-6 + @jboss-processserver-6 + @jboss-webserver-3/webserver30-tomcat7-openshift + @jboss-webserver-3/webserver31-tomcat7-openshift + @jboss-webserver-3/webserver30-tomcat8-openshift + @jboss-webserver-3/webserver31-tomcat8-openshift + @jboss-amq-6 + Scenario: Check jolokia port is available + When container is ready + Then check that port 8778 is open + Then inspect container + | path | value | + | /Config/ExposedPorts | 8778/tcp | From 0521a2d66f42bc07a2b1f02ec1e556a028ae2b1e Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 16:45:28 +0000 Subject: [PATCH 4/8] Delete obsolete/out-of-date module documentation Signed-off-by: Jonathan Dowland --- jboss/container/java/s2i/bash/README.adoc | 67 -------------------- jboss/container/jolokia/api/README.adoc | 68 -------------------- jboss/container/jolokia/bash/README.adoc | 75 ----------------------- 3 files changed, 210 deletions(-) delete mode 100644 jboss/container/java/s2i/bash/README.adoc delete mode 100644 jboss/container/jolokia/api/README.adoc delete mode 100644 jboss/container/jolokia/bash/README.adoc diff --git a/jboss/container/java/s2i/bash/README.adoc b/jboss/container/java/s2i/bash/README.adoc deleted file mode 100644 index 633f709f..00000000 --- a/jboss/container/java/s2i/bash/README.adoc +++ /dev/null @@ -1,67 +0,0 @@ -//// - AUTOGENERATED FILE - this file was generated via ./gen_template_docs.py. - Changes to .adoc or HTML files may be overwritten! Please change the - generator or the input template (./*.jinja) -//// - - - -= link:./module.yaml[jboss.container.java.s2i.bash] -:toc: -:toc-placement!: -:toclevels: 5 - -Customization of common Maven S2I for Java S2I image. - -toc::[] - -== Labels -No labels defined. - - -== Environment Variables - -The following environment variables are used to configure the functionality provided by this module: - -|======================================================================= -|Name |Description |Example -|======================================================================= - -The following environment variables will be configured on the image: -|======================================================================= -|Name |Value -|JBOSS_CONTAINER_JAVA_S2I_MODULE |/opt/jboss/container/java/s2i -|S2I_SOURCE_DEPLOYMENTS_FILTER |*.jar -|======================================================================= - -== Resources -No additional resources will be installed through this module. - -== RPM Packages - -=== Installed RPM Packages -No RPMs will be installed by this module. - -=== RPM Package Repositories -No additional RPM package repositories are required to install listed RPMs. - -== Modules - -=== Included Modules - -The following modules will be installed with this module: - -link:../../../../../jboss/container/hawkular/bash/README.adoc[jboss.container.hawkular.bash] - -link:../../../../../jboss/container/java/run/bash/README.adoc[jboss.container.java.run.bash] - -link:../../../../../jboss/container/jolokia/bash/README.adoc[jboss.container.jolokia.bash] - -link:../../../../../jboss/container/maven/s2i/bash/README.adoc[jboss.container.maven.s2i.bash] - -link:../../../../../jboss/container/prometheus/bash/README.adoc[jboss.container.prometheus.bash] - -link:../../../../../jboss/container/util/logging/bash/README.adoc[jboss.container.util.logging.bash] - -=== Module Repositories -No module repositories defined. diff --git a/jboss/container/jolokia/api/README.adoc b/jboss/container/jolokia/api/README.adoc deleted file mode 100644 index 851e07d1..00000000 --- a/jboss/container/jolokia/api/README.adoc +++ /dev/null @@ -1,68 +0,0 @@ -//// - AUTOGENERATED FILE - this file was generated via ./gen_template_docs.py. - Changes to .adoc or HTML files may be overwritten! Please change the - generator or the input template (./*.jinja) -//// - - - -= link:./module.yaml[jboss.container.jolokia.api] -:toc: -:toc-placement!: -:toclevels: 5 - -^ Defines environment variables used for configuring Jolokia. Modules providing support for configuring Jolokia should use the variables listed within this module to configure Jolokia appropriately. - -toc::[] - -== Labels -No labels defined. - - -== Environment Variables - -The following environment variables are used to configure the functionality provided by this module: - -|======================================================================= -|Name |Description |Example -|AB_JOLOKIA_AUTH_OPENSHIFT |Switch on client authentication for OpenShift TLS communication. The value of this parameter can be a relative distinguished name which must be contained in a presented client's certificate. Enabling this parameter will automatically switch Jolokia into https communication mode. The default CA cert is set to `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`. | -|AB_JOLOKIA_CONFIG |If set uses this file (including path) as Jolokia JVM agent properties (as described in Jolokia's link:https://www.jolokia.org/reference/html/agents.html#agents-jvm[reference manual]). If not set, the `/opt/jolokia/etc/jolokia.properties` will be created using the settings as defined in the manual. Otherwise the rest of the settings in this document are ignored. |/opt/jolokia/custom.properties -|AB_JOLOKIA_DISCOVERY_ENABLED |Enable Jolokia discovery. Defaults to **false**. |true -|AB_JOLOKIA_HOST |Host address to bind to. Defaults to **0.0.0.0**. |127.0.0.1 -|AB_JOLOKIA_HTTPS |Switch on secure communication with https. By default self signed server certificates are generated if no `serverCert` configuration is given in **AB_JOLOKIA_OPTS**. | -|AB_JOLOKIA_ID |Agent ID to use (`$HOSTNAME` by default, which is the container id). |openjdk-app-1-xqlsj -|AB_JOLOKIA_OFF |If set disables activation of Joloka (i.e. echos an empty value). By default, Jolokia is enabled. |true -|AB_JOLOKIA_OPTS |Additional options to be appended to the agent configuration. They should be given in the format `key=value,key=value,...`. |backlog=20 -|AB_JOLOKIA_PASSWORD |Password for basic authentication. By default authentication is switched off. |mypassword -|AB_JOLOKIA_PASSWORD_RANDOM |Determines if a random AB_JOLOKIA_PASSWORD be generated. Set to **true** to generate random password. Generated value will be written to `/opt/jolokia/etc/jolokia.pw`. | -|AB_JOLOKIA_PORT |Port to listen to. Defaults to **8778**. |5432 -|AB_JOLOKIA_USER |User for basic authentication. Defaults to **jolokia**. |myusername -|JOLOKIA_VERSION |Version of Jolokia being used. |1.5.0 -|======================================================================= - -The following environment variables will be configured on the image: -|======================================================================= -|Name |Value -|AB_JOLOKIA_AUTH_OPENSHIFT |true -|AB_JOLOKIA_HTTPS |true -|AB_JOLOKIA_PASSWORD_RANDOM |true -|======================================================================= - -== Resources -No additional resources will be installed through this module. - -== RPM Packages - -=== Installed RPM Packages -No RPMs will be installed by this module. - -=== RPM Package Repositories -No additional RPM package repositories are required to install listed RPMs. - -== Modules - -=== Included Modules -No additional modules will be installed through this module. - -=== Module Repositories -No module repositories defined. diff --git a/jboss/container/jolokia/bash/README.adoc b/jboss/container/jolokia/bash/README.adoc deleted file mode 100644 index e6e15c37..00000000 --- a/jboss/container/jolokia/bash/README.adoc +++ /dev/null @@ -1,75 +0,0 @@ -//// - AUTOGENERATED FILE - this file was generated via ./gen_template_docs.py. - Changes to .adoc or HTML files may be overwritten! Please change the - generator or the input template (./*.jinja) -//// - - - -= link:./module.yaml[jboss.container.jolokia.bash] -:toc: -:toc-placement!: -:toclevels: 5 - -^ Provides support for configuring Jolokia. Basic usage is opts="$JBOSS_CONTAINER_JOLOKIA_MODULE/jolokia-opts" - -toc::[] - -== Labels - -The following labels will be defined on the image: - -io.fabric8.s2i.version.jolokia:: 1.5.0-redhat-1 - -== Environment Variables - -The following environment variables are used to configure the functionality provided by this module: - -|======================================================================= -|Name |Description |Example -|======================================================================= - -The following environment variables will be configured on the image: -|======================================================================= -|Name |Value -|AB_JOLOKIA_AUTH_OPENSHIFT |true -|AB_JOLOKIA_HTTPS |true -|AB_JOLOKIA_PASSWORD_RANDOM |true -|JBOSS_CONTAINER_JOLOKIA_MODULE |/opt/jboss/container/jolokia -|JOLOKIA_VERSION |1.5.0 -|======================================================================= - -== Resources - -The following resources will be included through this module: -|======================================================================= -|Name |Location |Checksum -|jolokia-jvm-1.5.0.redhat-1-agent.jar -|https://maven.repository.redhat.com/ga/org/jolokia/jolokia-jvm/1.5.0.redhat-1/jolokia-jvm-1.5.0.redhat-1-agent.jar -a| -md5:: d31c6b1525e6d2d24062ef26a9f639a8 - -sha1:: - -sha256:: - -|======================================================================= - -== RPM Packages - -=== Installed RPM Packages -No RPMs will be installed by this module. - -=== RPM Package Repositories -No additional RPM package repositories are required to install listed RPMs. - -== Modules - -=== Included Modules - -The following modules will be installed with this module: - -link:../../../../jboss/container/jolokia/api/README.adoc[jboss.container.jolokia.api] - -=== Module Repositories -No module repositories defined. From a3fa780922e707042e074050ca4a670bf3817cd1 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 16:45:43 +0000 Subject: [PATCH 5/8] Consolidate and rename jolokia module from jboss.container.jolokia.{api,bash} to just jboss.container.jolokia. Also move into a '7' sub-directory and bump the Version in anticipation of a new version in a future commit. Signed-off-by: Jonathan Dowland --- jboss/container/java/s2i/bash/module.yaml | 2 +- .../opt/jboss/container/jolokia/jolokia-opts | 0 .../{bash => 7}/backward_compatibility.sh | 0 .../jolokia/{bash => 7}/configure.sh | 0 .../container/jolokia/{api => 7}/module.yaml | 28 ++++++++++--- jboss/container/jolokia/bash/module.yaml | 40 ------------------- 6 files changed, 23 insertions(+), 47 deletions(-) rename jboss/container/jolokia/{bash => 7}/artifacts/opt/jboss/container/jolokia/jolokia-opts (100%) rename jboss/container/jolokia/{bash => 7}/backward_compatibility.sh (100%) rename jboss/container/jolokia/{bash => 7}/configure.sh (100%) rename jboss/container/jolokia/{api => 7}/module.yaml (82%) delete mode 100644 jboss/container/jolokia/bash/module.yaml diff --git a/jboss/container/java/s2i/bash/module.yaml b/jboss/container/java/s2i/bash/module.yaml index 18896479..f2c67cc5 100644 --- a/jboss/container/java/s2i/bash/module.yaml +++ b/jboss/container/java/s2i/bash/module.yaml @@ -16,6 +16,6 @@ modules: install: - name: jboss.container.maven.s2i.bash - name: jboss.container.java.run.bash - - name: jboss.container.jolokia.bash + - name: jboss.container.jolokia - name: jboss.container.prometheus.bash - name: jboss.container.util.logging.bash diff --git a/jboss/container/jolokia/bash/artifacts/opt/jboss/container/jolokia/jolokia-opts b/jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts similarity index 100% rename from jboss/container/jolokia/bash/artifacts/opt/jboss/container/jolokia/jolokia-opts rename to jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts diff --git a/jboss/container/jolokia/bash/backward_compatibility.sh b/jboss/container/jolokia/7/backward_compatibility.sh similarity index 100% rename from jboss/container/jolokia/bash/backward_compatibility.sh rename to jboss/container/jolokia/7/backward_compatibility.sh diff --git a/jboss/container/jolokia/bash/configure.sh b/jboss/container/jolokia/7/configure.sh similarity index 100% rename from jboss/container/jolokia/bash/configure.sh rename to jboss/container/jolokia/7/configure.sh diff --git a/jboss/container/jolokia/api/module.yaml b/jboss/container/jolokia/7/module.yaml similarity index 82% rename from jboss/container/jolokia/api/module.yaml rename to jboss/container/jolokia/7/module.yaml index 17171ad6..f52bf92a 100644 --- a/jboss/container/jolokia/api/module.yaml +++ b/jboss/container/jolokia/7/module.yaml @@ -1,16 +1,19 @@ schema_version: 1 -name: jboss.container.jolokia.api -version: '1.0' +name: jboss.container.jolokia +version: '7' description: ^ - Defines environment variables used for configuring Jolokia. Modules - providing support for configuring Jolokia should use the variables listed - within this module to configure Jolokia appropriately. + Provides support for configuring Jolokia. Basic usage is + opts="$JBOSS_CONTAINER_JOLOKIA_MODULE/jolokia-opts" + +labels: +- name: io.fabric8.s2i.version.jolokia + value: "1.6.2-redhat-00002" envs: - name: JOLOKIA_VERSION description: Version of Jolokia being used. - example: "1.5.0" + value: "1.6.2" - name: AB_JOLOKIA_PASSWORD_RANDOM description: Determines if a random AB_JOLOKIA_PASSWORD be generated. Set to **true** to generate random password. Generated value will be written to `/opt/jolokia/etc/jolokia.pw`. value: "true" @@ -47,4 +50,17 @@ envs: - name: AB_JOLOKIA_OPTS description: Additional options to be appended to the agent configuration. They should be given in the format `key=value,key=value,...`. example: "backlog=20" +- name: JBOSS_CONTAINER_JOLOKIA_MODULE + value: /opt/jboss/container/jolokia + +ports: +- value: 8778 + +execute: +- script: configure.sh +- script: backward_compatibility.sh +artifacts: +- name: jolokia-jvm + target: jolokia-jvm-1.6.2.redhat-00002-agent.jar + md5: 760f2fbaf6b142192f3cee2c99bfcbf8 diff --git a/jboss/container/jolokia/bash/module.yaml b/jboss/container/jolokia/bash/module.yaml deleted file mode 100644 index 95f72804..00000000 --- a/jboss/container/jolokia/bash/module.yaml +++ /dev/null @@ -1,40 +0,0 @@ -schema_version: 1 - -name: jboss.container.jolokia.bash -version: '1.0' -description: ^ - Provides support for configuring Jolokia. Basic usage is - opts="$JBOSS_CONTAINER_JOLOKIA_MODULE/jolokia-opts" - -labels: -- name: io.fabric8.s2i.version.jolokia - value: "1.6.2-redhat-00002" - -envs: -- name: JBOSS_CONTAINER_JOLOKIA_MODULE - value: /opt/jboss/container/jolokia -# variable overrides/defaults -- name: JOLOKIA_VERSION - value: "1.6.2" -- name: AB_JOLOKIA_PASSWORD_RANDOM - value: "true" -- name: AB_JOLOKIA_AUTH_OPENSHIFT - value: "true" -- name: AB_JOLOKIA_HTTPS - value: "true" - -ports: -- value: 8778 - -execute: -- script: configure.sh -- script: backward_compatibility.sh - -artifacts: -- name: jolokia-jvm - target: jolokia-jvm-1.6.2.redhat-00002-agent.jar - md5: 760f2fbaf6b142192f3cee2c99bfcbf8 - -modules: - install: - - name: jboss.container.jolokia.api From 3bee8b7baf313142bf63472e6626a091818d9925 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 18:39:42 +0000 Subject: [PATCH 6/8] Adjust jolokia (7) module JAR path to match RPM Adjust where the jolokia module (version 7) installs the JAR to match where the RPM (in RHEL 8.2+) puts it. Remove old compatibility symlinks. Signed-off-by: Jonathan Dowland --- .../7/artifacts/opt/jboss/container/jolokia/jolokia-opts | 2 +- jboss/container/jolokia/7/configure.sh | 9 +++++---- tests/features/jolokia.feature | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts b/jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts index a27bfa97..f0a3e12d 100644 --- a/jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts +++ b/jboss/container/jolokia/7/artifacts/opt/jboss/container/jolokia/jolokia-opts @@ -88,5 +88,5 @@ if [ -z "${AB_JOLOKIA_OFF+x}" ]; then AB_JOLOKIA_CONFIG="${JBOSS_CONTAINER_JOLOKIA_MODULE}/etc/jolokia.properties" write_jolokia_properties "$AB_JOLOKIA_CONFIG" fi - echo "-javaagent:${JBOSS_CONTAINER_JOLOKIA_MODULE}/jolokia.jar=config=${AB_JOLOKIA_CONFIG}" + echo "-javaagent:/usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar=config=${AB_JOLOKIA_CONFIG}" fi diff --git a/jboss/container/jolokia/7/configure.sh b/jboss/container/jolokia/7/configure.sh index 32c2227c..9c4e3f37 100755 --- a/jboss/container/jolokia/7/configure.sh +++ b/jboss/container/jolokia/7/configure.sh @@ -5,7 +5,11 @@ set -e SCRIPT_DIR=$(dirname $0) ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts -mv /tmp/artifacts/jolokia-jvm-*-agent.jar ${ARTIFACTS_DIR}/opt/jboss/container/jolokia +mkdir -p /usr/share/java/jolokia-jvm-agent +mv /tmp/artifacts/jolokia-jvm-*-agent.jar \ + /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar +chown -h jboss:root \ + /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar chown -R jboss:root $SCRIPT_DIR chmod -R ug+rwX $SCRIPT_DIR @@ -18,6 +22,3 @@ popd mkdir -p /opt/jboss/container/jolokia/etc chmod 775 /opt/jboss/container/jolokia/etc chown -R jboss:root /opt/jboss/container/jolokia/etc - -ln -s /opt/jboss/container/jolokia/jolokia-jvm-*-agent.jar /opt/jboss/container/jolokia/jolokia.jar -chown -h jboss:root /opt/jboss/container/jolokia/jolokia.jar diff --git a/tests/features/jolokia.feature b/tests/features/jolokia.feature index 99f7e2fb..83d32693 100644 --- a/tests/features/jolokia.feature +++ b/tests/features/jolokia.feature @@ -6,7 +6,7 @@ Feature: Openshift OpenJDK Jolokia tests @openj9 Scenario: Check Environment variable is correct Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet - Then run sh -c 'unzip -q -p /opt/jboss/container/jolokia/jolokia.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= + Then run sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= @jboss-decisionserver-6 @jboss-processserver-6 From 9112af77f62c4b5bcf3a96064880ad7ce59a21ec Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 10 Mar 2020 18:40:49 +0000 Subject: [PATCH 7/8] Add Jolokia (version 8.2) module Installs via RPM. Signed-off-by: Jonathan Dowland --- .../opt/jboss/container/jolokia/jolokia-opts | 92 +++++++++++++++++++ jboss/container/jolokia/8.2/configure.sh | 18 ++++ jboss/container/jolokia/8.2/module.yaml | 64 +++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 jboss/container/jolokia/8.2/artifacts/opt/jboss/container/jolokia/jolokia-opts create mode 100755 jboss/container/jolokia/8.2/configure.sh create mode 100644 jboss/container/jolokia/8.2/module.yaml diff --git a/jboss/container/jolokia/8.2/artifacts/opt/jboss/container/jolokia/jolokia-opts b/jboss/container/jolokia/8.2/artifacts/opt/jboss/container/jolokia/jolokia-opts new file mode 100644 index 00000000..f0a3e12d --- /dev/null +++ b/jboss/container/jolokia/8.2/artifacts/opt/jboss/container/jolokia/jolokia-opts @@ -0,0 +1,92 @@ +#!/bin/sh + +# Check whether a given config is contained in AB_JOLOKIA_OPTS +is_in_jolokia_opts() { + local prop=$1 + if [ -n "${AB_JOLOKIA_OPTS}" ] && [ x"${AB_JOLOKIA_OPTS}" != x"${AB_JOLOKIA_OPTS/${prop}/}" ]; then + echo "yes" + else + echo "no" + fi +} + +get_jolokia_properties() { + + echo "host=${AB_JOLOKIA_HOST:-*}" + echo "port=${AB_JOLOKIA_PORT:-8778}" + echo "discoveryEnabled=${AB_JOLOKIA_DISCOVERY_ENABLED:=false}" + + if [ -n "$AB_JOLOKIA_PASSWORD" ]; then + echo "user=${AB_JOLOKIA_USER:-jolokia}" + echo "password=${AB_JOLOKIA_PASSWORD}" + fi + if [ -n "$AB_JOLOKIA_HTTPS" ]; then + echo "protocol=https" + use_https=1 + fi + + # Integration with OpenShift client cert auth is enabled + # by default if not explicitly turned off by setting to 'false' + if [ "x${AB_JOLOKIA_AUTH_OPENSHIFT}" != "xfalse" ] && [ -f "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" ]; then + echo "useSslClientAuthentication=true" + echo "extraClientCheck=true" + + if [ -z ${use_https+x} ]; then + echo "protocol=https" + fi + if [ $(is_in_jolokia_opts "caCert") != "yes" ]; then + echo "caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + fi + + if [ $(is_in_jolokia_opts "clientPrincipal") != "yes" ]; then + if [ x"${AB_JOLOKIA_AUTH_OPENSHIFT}" != x"${AB_JOLOKIA_AUTH_OPENSHIFT/=/}" ]; then + # Supposed to contain a principal name to check + echo "clientPrincipal=`echo ${AB_JOLOKIA_AUTH_OPENSHIFT} | sed -e 's/ /\\\\ /g'`" + else + echo "clientPrincipal=cn=system:master-proxy" + fi + fi + fi + + # Add extra opts + if [ -n "${AB_JOLOKIA_OPTS}" ]; then + echo "${AB_JOLOKIA_OPTS}" | tr "," "\n" + fi + +} + +write_jolokia_properties() { + local jolokia_property_file="$1" + + # Setup Jolokia to accept basic auth, using a randomly generated password that is stored + # in the container in the ${DEPLOYMENTS_DIR}/jolokia.pw file. + if [ "$AB_JOLOKIA_PASSWORD_RANDOM" == "true" ]; then + pw_file="${JBOSS_CONTAINER_JOLOKIA_MODULE}/etc/jolokia.pw" + if [ -f "${pw_file}" ] ; then + AB_JOLOKIA_PASSWORD=`cat "${pw_file}"` + else + AB_JOLOKIA_PASSWORD=`tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1` + touch "${pw_file}" + chmod 660 "${pw_file}" + cat > "${pw_file}" < "${jolokia_property_file}" < Date: Thu, 12 Mar 2020 11:27:02 +0000 Subject: [PATCH 8/8] Add backward-compatibility symlink for Jolokia JAR Signed-off-by: Jonathan Dowland --- jboss/container/jolokia/7/backward_compatibility.sh | 9 ++++++--- jboss/container/jolokia/8.2/backward_compatibility.sh | 6 ++++++ jboss/container/jolokia/8.2/module.yaml | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 jboss/container/jolokia/8.2/backward_compatibility.sh diff --git a/jboss/container/jolokia/7/backward_compatibility.sh b/jboss/container/jolokia/7/backward_compatibility.sh index 9d28d4aa..270860c3 100755 --- a/jboss/container/jolokia/7/backward_compatibility.sh +++ b/jboss/container/jolokia/7/backward_compatibility.sh @@ -1,8 +1,11 @@ #!/bin/bash # Set up jolokia for java s2i builder image -set -e +set -euo pipefail -# Legacy location +# Legacy locations ln -s /opt/jboss/container/jolokia /opt/jolokia -chown -h jboss:root /opt/jolokia \ No newline at end of file +chown -h jboss:root /opt/jolokia + +ln -s /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar \ + $JBOSS_CONTAINER_JOLOKIA_MODULE/jolokia.jar diff --git a/jboss/container/jolokia/8.2/backward_compatibility.sh b/jboss/container/jolokia/8.2/backward_compatibility.sh new file mode 100755 index 00000000..54fcacd3 --- /dev/null +++ b/jboss/container/jolokia/8.2/backward_compatibility.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -euo pipefail + +# Legacy (pre-RPM) location +ln -s /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar \ + $JBOSS_CONTAINER_JOLOKIA_MODULE/jolokia.jar diff --git a/jboss/container/jolokia/8.2/module.yaml b/jboss/container/jolokia/8.2/module.yaml index 717dc3b2..77731d5d 100644 --- a/jboss/container/jolokia/8.2/module.yaml +++ b/jboss/container/jolokia/8.2/module.yaml @@ -58,6 +58,7 @@ ports: execute: - script: configure.sh +- script: backward_compatibility.sh packages: install: