Create readiness health check for readiness probe 81/49181/4
authorAaron Hay <ah415j@att.com>
Fri, 25 May 2018 18:58:32 +0000 (14:58 -0400)
committerAaron Hay <ah415j@att.com>
Wed, 20 Jun 2018 14:41:48 +0000 (10:41 -0400)
New health_check.sh added that allows the readiness probe configured in statefulset.yaml to succeed

Change-Id: I3b619dfc84926bc27381c0b932971b41b12e4269
Issue-ID: OOM-1109
Signed-off-by: Aaron Hay <ah415j@att.com>
kubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh [new file with mode: 0755]
kubernetes/appc/templates/statefulset.yaml

diff --git a/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh
new file mode 100755 (executable)
index 0000000..544358c
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash -x
+
+startODL_status=$(ps -e | grep startODL | wc -l)
+waiting_bundles=$(/opt/opendaylight/current/bin/client bundle:list | grep Waiting | wc -l)
+run_level=$(/opt/opendaylight/current/bin/client system:start-level)
+
+  if [ "$run_level" == "Level 100" ] && [ "$startODL_status" -lt "1" ] && [ "$waiting_bundles" -lt "1" ]
+  then
+    echo APPC is healthy.
+  else
+    echo APPC is not healthy.
+    exit 1
+  fi
+
+exit 0
index d2da2ec..f440969 100644 (file)
@@ -45,8 +45,9 @@ spec:
           - containerPort: {{ .Values.service.internalPort }}
           - containerPort: {{ .Values.service.externalPort2 }}
           readinessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
+            exec:
+              command:
+              - /opt/appc/bin/health_check.sh
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
           env:
@@ -93,6 +94,9 @@ spec:
           - mountPath: /opt/onap/appc/bin/installAppcDb.sh
             name: onap-appc-bin
             subPath: installAppcDb.sh
+          - mountPath: /opt/onap/appc/bin/health_check.sh
+            name: onap-appc-bin
+            subPath: health_check.sh
           - mountPath: /opt/onap/ccsdk/data/properties/dblib.properties
             name: onap-sdnc-data-properties
             subPath: dblib.properties