From d8231861fea9dbdb16952bc1a744a2f8046e1bcf Mon Sep 17 00:00:00 2001 From: Srinivasan Selvam Date: Thu, 14 Nov 2019 10:43:14 +0530 Subject: [PATCH] changes for centos updated to iotgateway blueprint Signed-off-by: Srinivasan Selvam Change-Id: I0977ce0bf5835f66eb8cfe6a8addf7e799ae2878 --- .../scripts/ci_management/cleanup_centos.sh | 39 ++++++++++++++++++++++ .../ci_management/cleanup_centos_control.sh | 17 ++++++++++ blueprints/iotgateway/scripts/common_centos.sh | 2 +- blueprints/iotgateway/scripts/k8smaster_centos.sh | 2 +- blueprints/iotgateway/scripts/setup.sh | 3 +- 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100755 blueprints/iotgateway/scripts/ci_management/cleanup_centos.sh create mode 100755 blueprints/iotgateway/scripts/ci_management/cleanup_centos_control.sh diff --git a/blueprints/iotgateway/scripts/ci_management/cleanup_centos.sh b/blueprints/iotgateway/scripts/ci_management/cleanup_centos.sh new file mode 100755 index 0000000..9ddb210 --- /dev/null +++ b/blueprints/iotgateway/scripts/ci_management/cleanup_centos.sh @@ -0,0 +1,39 @@ +# !/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 # +############################################################################## + +sudo kubeadm reset + +if [ -f "$HOME/testk8s-nginx.yaml" ]; then + cd $HOME && kubectl delete -f test-k8snginx.yaml && rm -rf testk8s-nginx.yaml + echo "testk8s-nginx.yaml cleaned" +fi + +if [ -d "/var/lib/etcd" ]; then + sudo rm -rf /var/lib/etcd + echo "etcd cleaned" +fi + +KUBEADM_RESET="sudo kubeadm reset" +ETCD_CLEAN="sudo rm -rf /var/lib/etcd" +CLEANUP_PROM_CADVISOR="cd eliot/scripts/ci_management && ./uninstall_cadvisor.sh" + +# Read all the Worker Node details from nodelist file. +echo $(pwd) +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} ${KUBEADM_RESET} + sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${ETCD_CLEAN} + sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${CLEANUP_PROM_CADVISOR} +done < nodelist > /dev/null 2>&1 + diff --git a/blueprints/iotgateway/scripts/ci_management/cleanup_centos_control.sh b/blueprints/iotgateway/scripts/ci_management/cleanup_centos_control.sh new file mode 100755 index 0000000..54b5b06 --- /dev/null +++ b/blueprints/iotgateway/scripts/ci_management/cleanup_centos_control.sh @@ -0,0 +1,17 @@ +#!/usr/bin/expect -f +############################################################################## +# 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 # +############################################################################## + +spawn ./cleanup_centos.sh +expect "Are you sure you want to proceed? " +send "y\n" + +expect "Are you sure you want to proceed? " +send "y\n" +interact diff --git a/blueprints/iotgateway/scripts/common_centos.sh b/blueprints/iotgateway/scripts/common_centos.sh index 1fb51b3..d833198 100755 --- a/blueprints/iotgateway/scripts/common_centos.sh +++ b/blueprints/iotgateway/scripts/common_centos.sh @@ -12,7 +12,7 @@ # constants DOCKER_VERSION=18.09.6 -KUBE_VERSION=1.15.0-0 +KUBE_VERSION=1.16.0-0 MACHINE=$(uname -m) # start diff --git a/blueprints/iotgateway/scripts/k8smaster_centos.sh b/blueprints/iotgateway/scripts/k8smaster_centos.sh index c78bc0d..69c3ef9 100755 --- a/blueprints/iotgateway/scripts/k8smaster_centos.sh +++ b/blueprints/iotgateway/scripts/k8smaster_centos.sh @@ -11,7 +11,7 @@ # constants POD_NETWORK_CIDR=192.168.0.0/16 -KUBE_VERSION=1.15.0-0 +KUBE_VERSION=1.16.0-0 KUBERNETES_CNI=0.7.5-0 # start diff --git a/blueprints/iotgateway/scripts/setup.sh b/blueprints/iotgateway/scripts/setup.sh index 8da394a..8406c73 100755 --- a/blueprints/iotgateway/scripts/setup.sh +++ b/blueprints/iotgateway/scripts/setup.sh @@ -87,8 +87,7 @@ setup_k8smaster_centos() # Setup ELIOT Node setup_k8sworkers_centos - kubectl apply -f cni/calico/rbac.yaml - kubectl apply -f cni/calico/calico.yaml + kubectl apply -f cni/calico/v38/calico.yaml } -- 2.16.6