From 071c2e5c23e28e42905326e06465493de82b11f3 Mon Sep 17 00:00:00 2001 From: David Chan Date: Mon, 2 Jun 2025 17:25:22 -0400 Subject: [PATCH 1/6] Add MP Health health check scripts + update PATH (#692) * Add health check scripts * Update PATH to include helpers/runtime * Add helpers/runtime to PATH of kernel docker images --- ga/latest/kernel/Dockerfile.ubi.ibmjava8 | 2 +- ga/latest/kernel/Dockerfile.ubi.openjdk11 | 2 +- ga/latest/kernel/Dockerfile.ubi.openjdk17 | 2 +- ga/latest/kernel/Dockerfile.ubi.openjdk8 | 2 +- .../kernel/Dockerfile.ubi9-minimal.ibmjava8 | 2 +- .../kernel/Dockerfile.ubi9-minimal.openjdk11 | 2 +- .../kernel/Dockerfile.ubi9-minimal.openjdk17 | 2 +- .../kernel/Dockerfile.ubi9-minimal.openjdk21 | 2 +- .../kernel/Dockerfile.ubi9-minimal.openjdk8 | 2 +- ga/latest/kernel/Dockerfile.ubuntu.ibmjava8 | 2 +- ga/latest/kernel/Dockerfile.ubuntu.openjdk11 | 2 +- ga/latest/kernel/Dockerfile.ubuntu.openjdk17 | 2 +- .../helpers/runtime/livenessHealthCheck.sh | 78 ++++++++++++++++++ .../helpers/runtime/readinessHealthCheck.sh | 78 ++++++++++++++++++ .../helpers/runtime/startupHealthCheck.sh | 81 +++++++++++++++++++ 15 files changed, 249 insertions(+), 12 deletions(-) create mode 100755 ga/latest/kernel/helpers/runtime/livenessHealthCheck.sh create mode 100755 ga/latest/kernel/helpers/runtime/readinessHealthCheck.sh create mode 100755 ga/latest/kernel/helpers/runtime/startupHealthCheck.sh diff --git a/ga/latest/kernel/Dockerfile.ubi.ibmjava8 b/ga/latest/kernel/Dockerfile.ubi.ibmjava8 index 030fcf66f..e44df7cdd 100644 --- a/ga/latest/kernel/Dockerfile.ubi.ibmjava8 +++ b/ga/latest/kernel/Dockerfile.ubi.ibmjava8 @@ -67,7 +67,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend summary="Image for WebSphere Liberty with IBM's Java and Red Hat's UBI 8" \ description="This image contains the WebSphere Liberty runtime with IBM's Java and Red Hat's UBI 8 as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi.openjdk11 b/ga/latest/kernel/Dockerfile.ubi.openjdk11 index 8f919920d..4a610ddff 100644 --- a/ga/latest/kernel/Dockerfile.ubi.openjdk11 +++ b/ga/latest/kernel/Dockerfile.ubi.openjdk11 @@ -68,7 +68,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8 as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi.openjdk17 b/ga/latest/kernel/Dockerfile.ubi.openjdk17 index dbac4169d..268f28ba5 100644 --- a/ga/latest/kernel/Dockerfile.ubi.openjdk17 +++ b/ga/latest/kernel/Dockerfile.ubi.openjdk17 @@ -67,7 +67,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8 as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi.openjdk8 b/ga/latest/kernel/Dockerfile.ubi.openjdk8 index 5acd761be..0d594bafe 100644 --- a/ga/latest/kernel/Dockerfile.ubi.openjdk8 +++ b/ga/latest/kernel/Dockerfile.ubi.openjdk8 @@ -67,7 +67,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 8 as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi9-minimal.ibmjava8 b/ga/latest/kernel/Dockerfile.ubi9-minimal.ibmjava8 index 4e508d1d0..5e956e060 100644 --- a/ga/latest/kernel/Dockerfile.ubi9-minimal.ibmjava8 +++ b/ga/latest/kernel/Dockerfile.ubi9-minimal.ibmjava8 @@ -78,7 +78,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Iain Lewis, Melissa summary="Image for WebSphere Liberty with IBM's Java and Red Hat's UBI 9 minimal" \ description="This image contains the WebSphere Liberty runtime with IBM's Java and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk11 b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk11 index 8bbbdc93b..8a416524b 100644 --- a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk11 +++ b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk11 @@ -66,7 +66,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Iain Lewis, Melissa summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk17 b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk17 index b6bdbe77a..ab78311b7 100644 --- a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk17 +++ b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk17 @@ -66,7 +66,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Iain Lewis, Melissa summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk21 b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk21 index aa1fa67be..52c7589c8 100644 --- a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk21 +++ b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk21 @@ -66,7 +66,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk8 b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk8 index 934b37345..795dc9e99 100644 --- a/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk8 +++ b/ga/latest/kernel/Dockerfile.ubi9-minimal.openjdk8 @@ -66,7 +66,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Iain Lewis, Melissa summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal" \ description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubuntu.ibmjava8 b/ga/latest/kernel/Dockerfile.ubuntu.ibmjava8 index 375986b09..33857fa48 100644 --- a/ga/latest/kernel/Dockerfile.ubuntu.ibmjava8 +++ b/ga/latest/kernel/Dockerfile.ubuntu.ibmjava8 @@ -34,7 +34,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend liberty.version="$LIBERTY_VERSION" \ com.ibm.websphere.liberty.version="$LIBERTY_VERSION" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubuntu.openjdk11 b/ga/latest/kernel/Dockerfile.ubuntu.openjdk11 index 0c3238ce2..33a634610 100644 --- a/ga/latest/kernel/Dockerfile.ubuntu.openjdk11 +++ b/ga/latest/kernel/Dockerfile.ubuntu.openjdk11 @@ -34,7 +34,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend liberty.version="$LIBERTY_VERSION" \ com.ibm.websphere.liberty.version="$LIBERTY_VERSION" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/Dockerfile.ubuntu.openjdk17 b/ga/latest/kernel/Dockerfile.ubuntu.openjdk17 index 487560212..567e7abba 100644 --- a/ga/latest/kernel/Dockerfile.ubuntu.openjdk17 +++ b/ga/latest/kernel/Dockerfile.ubuntu.openjdk17 @@ -34,7 +34,7 @@ LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wend liberty.version="$LIBERTY_VERSION" \ com.ibm.websphere.liberty.version="$LIBERTY_VERSION" -ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build +ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build:/opt/ibm/helpers/runtime # Add labels for consumption by IBM Product Insights LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \ diff --git a/ga/latest/kernel/helpers/runtime/livenessHealthCheck.sh b/ga/latest/kernel/helpers/runtime/livenessHealthCheck.sh new file mode 100755 index 000000000..bfec3cda3 --- /dev/null +++ b/ga/latest/kernel/helpers/runtime/livenessHealthCheck.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +#Default to Kubernetes default for periodSeconds of 10 seconds +period_seconds=10 +period_milliseconds=$((period_seconds * 1000)) + +#Default location for 'live' file - Can change through parameter or server env +live_file=/output/health/live + + +# Evaluate if there is a env var for periodSeconds +if [ -n "${LIVENESS_PROBE_PERIOD_SECONDS}" ] +then + #Check input is numerical only + if [[ ${LIVENESS_PROBE_PERIOD_SECONDS} =~ ^[0-9]+$ ]] + then + period_seconds=${LIVENESS_PROBE_PERIOD_SECONDS} + period_milliseconds=$((period_seconds * 1000)) + else + echo "Expected only a numerical value for LIVENESS_PROBE_PERIOD_SECONDS environment variable, but recieved: ${LIVENESS_PROBE_PERIOD_SECONDS}. This value will not be used." + fi +fi + +# Evaluate if there is a env var for 'live' file location +if [ -n "${LIVE_FILE_LOCATION}" ] +then + live_file=${LIVE_FILE_LOCATION} +fi + + +while [[ $# -gt 0 ]]; do + case $1 in + -p|--period-seconds) + #Check input is numerical only + if [[ $2 =~ ^[0-9]+$ ]] + then + period_seconds=$2 + period_milliseconds=$((period_seconds*1000)) + else + echo "Expected only a numerical value for the -p/--period-seconds parameter, but recieved: $2. Defaulting to 10 second period seconds or environment variable defined value if valid." + fi + shift + shift + ;; + -f|--file) + live_file=$2 + shift + shift + ;; + --help) + printf "This script is used to query the 'live' health check file to determine if the container is live or not. The default location is '/output/health/live' but can be configured with the '-f' or '--file' option or with the environment variable 'LIVE_FILE_LOCATION' if the file exists in another location. This script will check whether the file has been updated or not within the last 'period seconds' (default is 10 seconds). This value can be configured with the '-p' or '--period-seconds' option or with the 'LIVENESS_PROBE_PERIOD_SECONDS' environment variable. It is important to configure the period seconds option for this script if the Kubernetes 'periodSeconds' field of the liveness probe is configured. Failure to do so will result in misreporting of the liveness status of the container.\n\nNote that the options passed directly in to the script will supersede the environment variable configuration.\n\nUsage: ./livenessHealthCheck.sh