X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=scripts%2Fsetup.sh;h=5b246c505d97b35b52760730a87f180b14fb3ba2;hb=c4fec5378030c1652c8bfcad929a5c6983838974;hp=15e5a84f8f59fb0ceb9fd81ee1fd7a1f13c82a09;hpb=626923f10d38ef7b35938c36199a4e600429a74f;p=eliot.git diff --git a/scripts/setup.sh b/scripts/setup.sh index 15e5a84..5b246c5 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -21,7 +21,7 @@ # constants OSPLATFORM=$(awk -F= '/^NAME/{print $2}' /etc/os-release) - +ELIOT_REPO="https://gerrit.akraino.org/r/eliot" show_help() { @@ -46,7 +46,7 @@ setup_k8smaster() source common.sh | tee eliotcommon.log source k8smaster.sh | tee kubeadm.log # Setup ELIOT Node - setup_k8sworkers + oscheck_edge } setup_k8sworkers() @@ -54,15 +54,14 @@ setup_k8sworkers() set -o xtrace # Install Docker on ELIOT Node - ELIOT_REPO="https://gerrit.akraino.org/r/eliot" SETUP_WORKER_COMMON="sudo rm -rf ~/eliot &&\ git clone ${ELIOT_REPO} &&\ - cd eliot/scripts && source common.sh" - #SETUP_WORKER_COMMON="cd eliot/scripts && source common.sh" + cd eliot/scripts/ && source common.sh" + #SETUP_WORKER_COMMON="cd eliot/scripts/ && source common.sh" SETUP_WORKER="cd eliot/scripts/ && source k8sworker.sh" - KUBEADM_JOIN=$(grep "kubeadm join" ./kubeadm.log) - KUBEADM_JOIN="sudo ${KUBEADM_JOIN}" + KUBEADM_TOKEN=$(kubeadm token create --print-join-command) + KUBEADM_JOIN="sudo ${KUBEADM_TOKEN}" # Read all the Worker Node details from nodelist file. while read line @@ -86,11 +85,7 @@ setup_k8smaster_centos() source k8smaster_centos.sh | tee kubeadm_centos.log # Setup ELIOT Node - setup_k8sworkers_centos - - cd cni/calico - kubectl apply -f rbac.yaml - kubectl apply -f calico.yaml + oscheck_edge } @@ -99,38 +94,62 @@ setup_k8sworkers_centos() set -o xtrace # Install Docker on ELIOT Node - ELIOT_REPO="https://gerrit.akraino.org/r/eliot" SETUP_WORKER_COMMON_CENTOS="sudo rm -rf ~/eliot &&\ git clone ${ELIOT_REPO} &&\ - cd eliot/scripts && source common_centos.sh" + cd eliot/scripts/ && source common_centos.sh" + + # SETUP_WORKER_COMMON_CENTOS="cd /root/eliot/scripts/ && source common_centos.sh" KUBEADM_TOKEN=$(sudo kubeadm token create --print-join-command) KUBEADM_JOIN_CENTOS="sudo ${KUBEADM_TOKEN}" + # Read all the Worker Node details from nodelist file. + while read line + do + nodeinfo="${line}" < /dev/null 2>&1 + nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1) < /dev/null + nodeip=$(echo ${nodeinfo} | cut -d"|" -f2) < /dev/null + nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3) < /dev/null + sudo sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON_CENTOS} < /dev/null + sudo sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN_CENTOS} < /dev/null + done < nodelist > /dev/null 2>&1 - # Read all the Worker Node details from nodelist file. - while read line - do +} + +# ELIOT edgenode os check and setup edge node +oscheck_edge() +{ + while read line + do nodeinfo="${line}" nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1) nodeip=$(echo ${nodeinfo} | cut -d"|" -f2) nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3) - sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON_CENTOS} < /dev/null - #sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_CENTOS} < /dev/null - sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN_CENTOS} < /dev/null - done < nodelist - + if sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} [ $OSPLATFORM="*Ubuntu*" ]; then + setup_k8sworkers + elif sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} [ $OSPLATFORM="*CentOS*" ]; then + setup_k8sworkers_centos + kubectl apply -f cni/calico/rbac.yaml + kubectl apply -f cni/calico/calico.yaml + fi + done < nodelist > /dev/null 2>&1 } -#verify kubernetes setup by deploying nginx server. +# verify kubernetes setup by deploying nginx server. verify_k8s_status(){ set -o xtrace source verifyk8s.sh | tee verifyk8s.log } + +install_edgex(){ + set -o xtrace + cd edgex && source edgexonk8s.sh +} + install_cadvisor_edge(){ set -o xtrace - SETUP_CADVISOR_ATEDGE="cd eliot/scripts/ && source cadvisorsetup.sh" + SETUP_CADVISOR_ATEDGE="cd eliot/scripts/ && source cadvisorsetup.sh" while read line do nodeinfo="${line}" @@ -168,3 +187,12 @@ sleep 10 install_prometheus sleep 5 sudo docker ps | grep prometheus + +install_edgex +sleep 20 + +# Removing the taint from master node +kubectl taint nodes --all node-role.kubernetes.io/master- || true + +echo "ELIOT Setup execution is Completed..." +