summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMandeep Khinda <Mandeep.Khinda@amdocs.com>2017-09-22 17:59:45 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 17:59:45 +0000
commitf493d79b881b40f7941bbe8fdb632237dc6d7f5a (patch)
tree4465a83cbc1cbc388d94f7880a59cd3041e06d1d
parentdbadfd8db0b7d1da74bda67f968d3d1393d3e23e (diff)
parentfe17bbe3206203c823eb5e6f726f24f14e87cbff (diff)
Merge "Add Consul health check support for MSO"
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json28
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh15
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh15
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh15
4 files changed, 73 insertions, 0 deletions
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json
new file mode 100644
index 0000000000..354cd9ebab
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json
@@ -0,0 +1,28 @@
+{
+ "service": {
+ "name": "Health Check: MSO",
+ "checks": [
+ {
+ "id": "mso-api-healthcheck",
+ "name": "MSO API Health Check",
+ "script": "/consul/config/scripts/mso-api-script.sh",
+ "interval": "10s",
+ "timeout": "1s"
+ },
+ {
+ "id": "mso-camunda-healthcheck",
+ "name": "MSO Camunda Health Check",
+ "script": "/consul/config/scripts/mso-camunda-script.sh",
+ "interval": "10s",
+ "timeout": "1s"
+ },
+ {
+ "id": "mso-jra-healthcheck",
+ "name": "MSO JRA Health Check",
+ "script": "/consul/config/scripts/mso-jra-script.sh",
+ "interval": "10s",
+ "timeout": "1s"
+ }
+ ]
+ }
+}
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh
new file mode 100644
index 0000000000..ba0afc0dce
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/ecomp/mso/infra/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+ echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+ echo "Produces response: $HEALTH_CHECK_RESPONSE"
+ echo "Application is not in an available state"
+ return 2
+else
+ echo "Application is available."
+ return 0
+fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh
new file mode 100644
index 0000000000..254a0445ce
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/mso/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+ echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+ echo "Produces response: $HEALTH_CHECK_RESPONSE"
+ echo "Application is not in an available state"
+ return 2
+else
+ echo "Application is available."
+ return 0
+fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh
new file mode 100644
index 0000000000..29ffd8fe4c
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/networks/rest/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+ echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+ echo "Produces response: $HEALTH_CHECK_RESPONSE"
+ echo "Application is not in an available state"
+ return 2
+else
+ echo "Application is available."
+ return 0
+fi