From ac7710dd2fd905890eab0095be420ba6c17db0f2 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Nov 2015 14:12:50 +0100 Subject: [PATCH 1/5] check for helloapache --- helloapache/check.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 helloapache/check.sh diff --git a/helloapache/check.sh b/helloapache/check.sh new file mode 100644 index 0000000..95fccf5 --- /dev/null +++ b/helloapache/check.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Run this script with provider name as first argument +# + +if [ $1 == "kubernetes" ]; then + IP=$(kubectl get pod helloapache -o template --template="{{ .status.podIP }}") + PORT=$(kubectl get pod helloapache -o template --template="{{ (index (index .spec.containers 0).ports 0).containerPort }}") +fi + +if [ $1 == "docker" ]; then + IP=localhost + # TODO: get port from somewhere :-) + PORT=80 +fi + +curl --max-time 1 $IP:$PORT From 9fdef3ef56a35bb33d9838afa8a20c2ab72d2877 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Nov 2015 14:26:00 +0100 Subject: [PATCH 2/5] check for guestbook-go --- guestbook-go/check.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 guestbook-go/check.sh diff --git a/guestbook-go/check.sh b/guestbook-go/check.sh new file mode 100644 index 0000000..0b61f62 --- /dev/null +++ b/guestbook-go/check.sh @@ -0,0 +1,12 @@ +#!/bin/sh +#!/bin/sh +# +# Run this script with provider name as first argument +# + +if [ $1 == "kubernets" ]; then + IP=$(kubectl get service guestbook -o template --template="{{ .spec.clusterIP }}") + PORT=$(kubectl get service guestbook -o template --template="{{ (index .spec.ports 0).port }}") +fi + +curl --max-time 1 $IP:$PORT/info From 468c834766d19beb5a28095dac4e7dea3a16b586 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Nov 2015 17:08:47 +0100 Subject: [PATCH 3/5] checks for mariadb-{centos7, fedora} --- mariadb-centos7-atomicapp/check.sh | 22 ++++++++++++++++++++++ mariadb-fedora-atomicapp/check.sh | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 mariadb-centos7-atomicapp/check.sh create mode 100644 mariadb-fedora-atomicapp/check.sh diff --git a/mariadb-centos7-atomicapp/check.sh b/mariadb-centos7-atomicapp/check.sh new file mode 100644 index 0000000..c27bf91 --- /dev/null +++ b/mariadb-centos7-atomicapp/check.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Run this script with provider name as first argument +# + +if [ $1 == "kubernetes" ]; then + IP=$(kubectl get service mariadb -o template --template="{{ .spec.clusterIP }}") + PORT=$(kubectl get service mariadb -o template --template="{{ (index .spec.ports 0).port }}") +fi + +if [ $1 == "docker" ]; then + IP=localhost + # TODO: get port from somewhere :-) + PORT=80 +fi + +# TODO: get them from answers.conf or as arguments to this script +db_pass="pass" +db_name="name" +db_user="user" + +docker run -it centos/mariadb mysqladmin -h $IP -P $PORT -u $db_user -p$db_pass --connect-timeout=10 ping diff --git a/mariadb-fedora-atomicapp/check.sh b/mariadb-fedora-atomicapp/check.sh new file mode 100644 index 0000000..c27bf91 --- /dev/null +++ b/mariadb-fedora-atomicapp/check.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Run this script with provider name as first argument +# + +if [ $1 == "kubernetes" ]; then + IP=$(kubectl get service mariadb -o template --template="{{ .spec.clusterIP }}") + PORT=$(kubectl get service mariadb -o template --template="{{ (index .spec.ports 0).port }}") +fi + +if [ $1 == "docker" ]; then + IP=localhost + # TODO: get port from somewhere :-) + PORT=80 +fi + +# TODO: get them from answers.conf or as arguments to this script +db_pass="pass" +db_name="name" +db_user="user" + +docker run -it centos/mariadb mysqladmin -h $IP -P $PORT -u $db_user -p$db_pass --connect-timeout=10 ping From 392b6dc93cf04385789dd0c0672f6579bbfc6ba5 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Nov 2015 17:09:43 +0100 Subject: [PATCH 4/5] check for skydns --- skydns-atomicapp/check.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 skydns-atomicapp/check.sh diff --git a/skydns-atomicapp/check.sh b/skydns-atomicapp/check.sh new file mode 100644 index 0000000..4fc50e6 --- /dev/null +++ b/skydns-atomicapp/check.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# this scripts require nslookup +# yum install bind-utils +# apt-get install dnsutils +# + +IP=$(kubectl get service kube-dns -o template --template="{{ .spec.clusterIP }}") + +# TODO: get it from answers.conf or as arguments to this script +dns_domain="cluster.local" + +nslookup kubernetes.default.svc.$dns_domain $IP From cf11b770b844aa01fb07b8c5e2789c0432d286cc Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 6 Nov 2015 15:45:46 +0100 Subject: [PATCH 5/5] check for redis --- redis-centos7-atomicapp/check.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 redis-centos7-atomicapp/check.sh diff --git a/redis-centos7-atomicapp/check.sh b/redis-centos7-atomicapp/check.sh new file mode 100644 index 0000000..ed461e1 --- /dev/null +++ b/redis-centos7-atomicapp/check.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Run this script with provider name as first argument +# this script require netcat +# yum install netcat +# atp-get install netcat +# + +if [ $1 == "kubernetes" ]; then + IP=$(kubectl get service redis-master -o template --template="{{ .spec.clusterIP }}") + PORT=$(kubectl get service redis-master -o template --template="{{ (index .spec.ports 0).port }}") +fi + +if [ $1 == "docker" ]; then + IP=localhost + # TODO: get port from somewhere :-) + PORT=6379 +fi + + +(printf "PING\r\n"; sleep 0.5) | nc $IP $PORT | grep PONG