aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh
diff options
context:
space:
mode:
authorKhantwal <anamika.khantwal@accenture.com>2025-01-31 11:50:47 +0530
committerKhantwal <anamika.khantwal@accenture.com>2025-02-07 11:09:47 +0530
commitcda490ba0cd7a415d3d32b17e0169c2905dee83c (patch)
tree067bd6e00201364dc5acf9319ffc16c9731f9267 /kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh
parenta976b00d75d1210805fcebfff55c09a141be5244 (diff)
Integrate Scalability Changes in SDC
- Add scalability changes to SDC components Issue-ID: SDC-4712 Change-Id: I9c5f81ce979d3c923981f8b00eeec25f69d9d103 Signed-off-by: Anamika Khantwal <anamika.khantwal@accenture.com>
Diffstat (limited to 'kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh')
-rw-r--r--kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh28
1 files changed, 28 insertions, 0 deletions
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