aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xkubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh15
-rw-r--r--kubernetes/appc/templates/statefulset.yaml8
2 files changed, 21 insertions, 2 deletions
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
index 0000000000..544358c1af
--- /dev/null
+++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh
@@ -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
diff --git a/kubernetes/appc/templates/statefulset.yaml b/kubernetes/appc/templates/statefulset.yaml
index d2da2ec756..f4409697b3 100644
--- a/kubernetes/appc/templates/statefulset.yaml
+++ b/kubernetes/appc/templates/statefulset.yaml
@@ -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