kubeedge setup script 64/864/1
authorsrinivasan.s.n@huawei.com <srinivasan.s.n@huawei.com>
Tue, 28 May 2019 10:59:12 +0000 (10:59 +0000)
committersrinivasan.s.n@huawei.com <srinivasan.s.n@huawei.com>
Tue, 28 May 2019 11:00:19 +0000 (11:00 +0000)
Change-Id: I3bf02a3714892208dd7440a7edd5ac63f606d7c0

scripts/src/config_kubeedge [new file with mode: 0644]
scripts/src/kubeedge_setup.sh
scripts/src/nodelist [deleted file]

diff --git a/scripts/src/config_kubeedge b/scripts/src/config_kubeedge
new file mode 100644 (file)
index 0000000..2d11960
--- /dev/null
@@ -0,0 +1,6 @@
+edgenodeusr="root"
+edgenodeip="10.10.0.54"
+edgenodepassword="Huawei@akraino"
+masternodeusr="root"
+masternodeip="10.10.0.45"
+masternodepassword="Huawei@akraino"
index b79416f..6cfc2c3 100755 (executable)
 take_keedge(){
 
    git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
 take_keedge(){
 
    git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
+   source ~/.profile
    cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
    make
    cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
    make
-
+   #kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
+   #kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
 }
 
 }
 
-common_steps="git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge &&\
-cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm &&\
-make &&\
+source config_kubeedge
+common_steps="git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge && \
+source ~/.profile && \
+cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm && \
+make && \
 chmod +x kubeedge"
 
 certif_copy="cd /etc/kubeedge &&\
 scp certs.tar.gz"
 
 chmod +x kubeedge"
 
 certif_copy="cd /etc/kubeedge &&\
 scp certs.tar.gz"
 
-edge_start="kubeedge join --edgecontrollerip=${nodeip} --edgenodeid=eliot_edge_01"
+edge_start="cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm && \
+chmod +x kubeedge && \
+./kubeedge join --edgecontrollerip=$masternodeip --edgenodeid=eliotedge02 --k8sserverip=$masternodeip:8080"
 
 execute_keedge_controller(){
    cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
 
 execute_keedge_controller(){
    cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
@@ -33,30 +39,38 @@ execute_keedge_controller(){
 }
 
 
 }
 
 
-# start
+exec_edge(){
 
 
-take_keedge
+   cd $HOME/eliot/scripts/src
+   sshpass -p ${edgenodepassword} scp $HOME/release/eliot/scripts/src/config_kubeedge ${edgenodeusr}@${edgenodeip}:/root
 
 
-execute_keedge_controller
+   sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} \
+   source config_kubeedge
+   
+   source config_kubeedge
+   sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} ${common_steps} < /dev/null
+echo "after common_steps"
+   sshpass -p ${edgenodepassword} scp /etc/kubeedge/certs.tgz ${edgenodeusr}@${edgenodeip}:/etc/kubeedge
 
 
-while read line
-do
-    nodeinfo="${line}"
-    nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
-    nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
-    nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
-    masternodeip=$(echo ${nodeinfo} | cut -d"|" -f3)
+   sshpass -p ${edgenodepassword} \
+   ssh ${edgenodeusr}@${edgenodeip} \
+   tar -xvzf /etc/kubeedge/certs.tgz --directory /etc/kubeedge
+   
+   sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} ${edge_start} < /dev/null
+}
 
 
-    sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${common_steps} < /dev/null
-    sshpass -p ${nodepaswd} scp /etc/kubeedge/certs.tar.gz ${nodeusr}@${nodepaswd}:/etc/kubeedge
+# start
 
 
-    sshpass -p ${nodepaswd} \
-    tar -xvzf /etc/kubeedge/certs.tgz
+source config_kubeedge
+#sample
+#return
+take_keedge
 
 
-    sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} kubeedge join --edgecontrollerip=${masternodeip} --edgenodeid=eliot_edge_01 \
-    --k8sserverip=${masternodeip}:8080
-done < nodelist
+execute_keedge_controller
 
 
+#sample
+#execute_edge
+exec_edge
 kubectl get nodes
 
 kubectl create -f deployment.yaml
 kubectl get nodes
 
 kubectl create -f deployment.yaml
diff --git a/scripts/src/nodelist b/scripts/src/nodelist
deleted file mode 100644 (file)
index 1ebba28..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<eliotedgenodeusr>|<eliotedgenodeip>|<eliotedgenodepassword>|<eliotmasternodeusr>|<eliotmasternodeip>|<eliotmasternodepassword>