summaryrefslogtreecommitdiffstats
path: root/kubernetes/config/docker/init/src
diff options
context:
space:
mode:
authormayankg2703 <mayank.gupta@amdocs.com>2017-12-18 09:54:42 +0000
committermayankg2703 <mayank.gupta@amdocs.com>2017-12-18 10:09:03 +0000
commitc5a02355b0b3ee9f442cda09e42632b44f908e79 (patch)
tree3ffa4c06ecad153b6e234b65ecdb03c77e322ced /kubernetes/config/docker/init/src
parenta6eb9be0e091746c824b169a46242ef0943a2b05 (diff)
Vid Health Check using consul
Issue-ID: OOM-29 Change-Id: Ide81bdc5e1174d3b0eb1b172116ea262e9a85c6e Signed-off-by: mayankg2703 <mayank.gupta@amdocs.com>
Diffstat (limited to 'kubernetes/config/docker/init/src')
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/vid-mariadb-script.sh14
-rw-r--r--kubernetes/config/docker/init/src/config/consul/consul-agent-config/vid-health.json29
2 files changed, 43 insertions, 0 deletions
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/vid-mariadb-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/vid-mariadb-script.sh
new file mode 100644
index 0000000000..c87686f764
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/vid-mariadb-script.sh
@@ -0,0 +1,14 @@
+NAME=$(/consul/config/bin/kubectl -n onap-vid get pod | grep -o "vid-mariadb[^[:space:]]*")
+
+ if [ -n "$NAME" ]; then
+ if /consul/config/bin/kubectl -n onap-vid exec -it $NAME -- bash -c 'mysqladmin status -u root -p$MYSQL_ROOT_PASSWORD' > /dev/null; then
+ echo Success. mariadb process is running. 2>&1
+ exit 0
+ else
+ echo Failed. mariadb process is not running. 2>&1
+ exit 1
+ fi
+ else
+ echo Failed. mariadb container is offline. 2>&1
+ exit 1
+ fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/vid-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/vid-health.json
new file mode 100644
index 0000000000..8a2a4dca9b
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/vid-health.json
@@ -0,0 +1,29 @@
+{
+ "service": {
+ "name": "Health Check: VID",
+ "checks": [
+ {
+ "id": "vid-server",
+ "name": "VID Server Health Check",
+ "http": "http://vid-server.onap-vid:8080/vid/healthCheck",
+ "method": "GET",
+ "header": {
+ "Authorization": ["Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=="],
+ "Cache-Control": ["no-cache"],
+ "Content-Type": ["application/json"],
+ "Accept": ["application/json"]
+ },
+ "tls_skip_verify": true,
+ "interval": "15s",
+ "timeout": "1s"
+ },
+ {
+ "id": "vid-mariadb",
+ "name": "Vid Mariadb Health Check",
+ "script": "/consul/config/scripts/vid-mariadb-script.sh",
+ "interval": "10s",
+ "timeout": "1s"
+ }
+ ]
+ }
+}