From 5c369d6d40462704f6467a19411802d18cc6153b Mon Sep 17 00:00:00 2001 From: Aleksandr Didenko Date: Fri, 1 Jul 2016 15:55:57 +0200 Subject: [PATCH] Added deploy-netchecker.sh script --- deploy-netchecker.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 deploy-netchecker.sh diff --git a/deploy-netchecker.sh b/deploy-netchecker.sh new file mode 100755 index 000000000..00781b0e2 --- /dev/null +++ b/deploy-netchecker.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if [ -n "$1" ] ; then + NS="--namespace=$1" +fi + +kubectl get nodes || exit 1 + +echo "Installing netchecker server" +git clone https://github.com/adidenko/netchecker-server +pushd netchecker-server + pushd docker + docker build -t 127.0.0.1:31500/netchecker/server:latest . + docker push 127.0.0.1:31500/netchecker/server:latest + popd + kubectl create -f netchecker-server_pod.yaml $NS + kubectl create -f netchecker-server_svc.yaml $NS +popd + +echo "Installing netchecker agents" +git clone https://github.com/adidenko/netchecker-agent +pushd netchecker-agent + pushd docker + docker build -t 127.0.0.1:31500/netchecker/agent:latest . + docker push 127.0.0.1:31500/netchecker/agent:latest + popd + kubectl get nodes | grep Ready | awk '{print $1}' | xargs -I {} kubectl label nodes {} netchecker=agent + NUMNODES=`kubectl get nodes --show-labels | grep Ready | grep netchecker=agent | wc -l` + sed -e "s/replicas:.*/replicas: $NUMNODES/g" -i netchecker-agent_rc.yaml + kubectl create -f netchecker-agent_rc.yaml $NS +popd + +echo "DONE" +curl -s -X GET 'http://localhost:31081/api/v1/agents/' | python -mjson.tool +echo +echo "use the following command to check agents:" +echo "curl -s -X GET 'http://localhost:31081/api/v1/agents/' | python -mjson.tool"