Setup Kubeedge script on x86 58/858/2
authorsrinivasan.s.n@huawei.com <srinivasan.s.n@huawei.com>
Mon, 27 May 2019 17:59:12 +0000 (17:59 +0000)
committersrinivasan.s.n@huawei.com <srinivasan.s.n@huawei.com>
Mon, 27 May 2019 18:09:04 +0000 (18:09 +0000)
Change-Id: I913b719c471bc98ea2a87b95da74d84f4d709a0f

scripts/ci_management/cleanup.sh [new file with mode: 0644]
scripts/src/kubeedge_setup.sh [new file with mode: 0755]
scripts/src/nodelist [new file with mode: 0644]

diff --git a/scripts/ci_management/cleanup.sh b/scripts/ci_management/cleanup.sh
new file mode 100644 (file)
index 0000000..3aa86e3
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash -ex
+##############################################################################
+# Copyright (c) 2019 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# start
+
+kubeedge reset
+
+reset="kubeedge reset --k8sserverip ${masternodeip}:8080"
+
+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 ${nodepaswd} \
+    kubeedge reset --k8sserverip ${masternodeip}:8080
+
+done < nodelist
+
diff --git a/scripts/src/kubeedge_setup.sh b/scripts/src/kubeedge_setup.sh
new file mode 100755 (executable)
index 0000000..b79416f
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash -ex
+##############################################################################
+# Copyright (c) 2019 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+take_keedge(){
+
+   git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
+   cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
+   make
+
+}
+
+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 &&\
+chmod +x kubeedge"
+
+certif_copy="cd /etc/kubeedge &&\
+scp certs.tar.gz"
+
+edge_start="kubeedge join --edgecontrollerip=${nodeip} --edgenodeid=eliot_edge_01"
+
+execute_keedge_controller(){
+   cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
+   sudo chmod +x kubeedge
+   ./kubeedge init
+}
+
+
+# start
+
+take_keedge
+
+execute_keedge_controller
+
+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 ${nodepaswd} ssh ${nodeusr}@${nodeip} ${common_steps} < /dev/null
+    sshpass -p ${nodepaswd} scp /etc/kubeedge/certs.tar.gz ${nodeusr}@${nodepaswd}:/etc/kubeedge
+
+    sshpass -p ${nodepaswd} \
+    tar -xvzf /etc/kubeedge/certs.tgz
+
+    sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} kubeedge join --edgecontrollerip=${masternodeip} --edgenodeid=eliot_edge_01 \
+    --k8sserverip=${masternodeip}:8080
+done < nodelist
+
+kubectl get nodes
+
+kubectl create -f deployment.yaml
+
+kubectl get pods
diff --git a/scripts/src/nodelist b/scripts/src/nodelist
new file mode 100644 (file)
index 0000000..1ebba28
--- /dev/null
@@ -0,0 +1 @@
+<eliotedgenodeusr>|<eliotedgenodeip>|<eliotedgenodepassword>|<eliotmasternodeusr>|<eliotmasternodeip>|<eliotmasternodepassword>