2 ##############################################################################
3 # Copyright (c) 2019 Huawei Tech and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 ########################################################################################
13 # The script is to setup the ELIOT Manager and ELIOT nodes. #
14 # It installs Docker in both ELIOT Manager and ELIOT node. #
15 # It installs Kubernetes. In the ELIOT Manager kubeadm, kubelet, kubectl is installed. #
16 # In ELIOT Edge Node it will install kubeadn, kubelet. #
17 # Script is tested in Ubuntu 16.04 version. #
18 # sshpass needs to be installed before executing this script. #
19 ########################################################################################
23 echo "The script helps in setting up the ELIOT Toplogy Infrastrucutre"
24 echo "The setup installs Docker, K8S Master and K8S worker nodes in "
25 echo "ELIOT Manager and ELIOT Workder Nodes respectively "
26 echo "After completion of script execution execute command: "
27 echo "kubectl get nodes to check whether the connection between "
28 echo "ELIOT Manager and ELIOT Nodes are established"
30 echo "Nodelist file should have the details of Worker Nodes in the format of:"
31 echo "EliotNodeUserName|EliotNodeIP|EliotNodePasswor"
32 echo "Each line should have detail of one ELIOT Node only"
35 # Setting up ELIOT Manager Node.
36 # Installing Docker, K8S and Initializing K8S Master
41 source common.sh | tee eliotcommon.log
42 source k8smaster.sh | tee kubeadm.log
51 # Install Docker on ELIOT Node
52 ELIOT_REPO="https://gerrit.akraino.org/r/eliot"
53 SETUP_WORKER_COMMON="sudo rm -rf ~/eliot &&\
54 git clone ${ELIOT_REPO} &&\
55 cd eliot/scripts && source common.sh"
56 #SETUP_WORKER_COMMON="cd eliot/scripts && source common.sh"
57 SETUP_WORKER="cd eliot/scripts/ && source k8sworker.sh"
59 KUBEADM_JOIN=$(grep "kubeadm join " ./kubeadm.log)
60 KUBEADM_JOIN="sudo ${KUBEADM_JOIN}"
62 # Read all the Worker Node details from nodelist file.
66 nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
67 nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
68 nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
69 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON} < /dev/null
70 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER} < /dev/null
71 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN} < /dev/null
80 if [ $1 == "--help" ] || [ $1 == "-h" ];