aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorAlexis de Talhouƫt <alexis.de_talhouet@bell.ca>2017-12-20 15:41:45 +0000
committerGerrit Code Review <gerrit@onap.org>2017-12-20 15:41:45 +0000
commit34a6e790e402f1c7c291d92ea3a35630bc824d89 (patch)
tree728f8f2e4373dddc71a01f29afdc36e098f38749 /kubernetes
parent8dfce86d1662eab7006669943d5fdb8782b0721b (diff)
parentc5a02355b0b3ee9f442cda09e42632b44f908e79 (diff)
Merge "Vid Health Check using consul"
Diffstat (limited to 'kubernetes')
-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"
+ }
+ ]
+ }
+}