From cda490ba0cd7a415d3d32b17e0169c2905dee83c Mon Sep 17 00:00:00 2001 From: Khantwal Date: Fri, 31 Jan 2025 11:50:47 +0530 Subject: Integrate Scalability Changes in SDC - Add scalability changes to SDC components Issue-ID: SDC-4712 Change-Id: I9c5f81ce979d3c923981f8b00eeec25f69d9d103 Signed-off-by: Anamika Khantwal --- .../config/readyProbe/combined-liveness.sh | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh (limited to 'kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh') diff --git a/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh b/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh new file mode 100644 index 0000000000..28ad30aef5 --- /dev/null +++ b/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Variables + +INTERNAL_PORT=8181 +HEALTHCHECK_URL="http://localhost:8181/sdc1/rest/healthCheck" + +# 1. TCP Socket Check for Internal Port + +nc -z localhost $INTERNAL_PORT +TCP_STATUS=$? + +if [ $TCP_STATUS -ne 0 ]; then + echo "TCP check failed: Internal port $INTERNAL_PORT is not open." + exit 1 +fi + +# 2. Cassandra Health Check from API Response using jq + +CASSANDRA_STATUS=$(curl -s $HEALTHCHECK_URL | jq -r '.componentsInfo[] | select(.healthCheckComponent == "CASSANDRA") | .healthCheckStatus') + +if [ "$CASSANDRA_STATUS" != "UP" ]; then + echo "Cassandra API check failed: HealthCheck status is $CASSANDRA_STATUS, not UP." + exit 1 +fi + +echo "Liveness check passed: Internal port $INTERNAL_PORT is open, and Cassandra is healthy." +exit 0 -- cgit