From: Cristina Pauna Date: Wed, 27 Mar 2019 16:06:50 +0000 (+0000) Subject: Merge "[ci] Add PDF/IDF config files for 2 virtual PODs" X-Git-Tag: 1.0.0~30 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=be5ba34453977ea50ec2a5559d2d1ef3cafbeb3d;hp=f2a30f5d20e0faa1b7b61e179c196ebcdb08993d;p=iec.git Merge "[ci] Add PDF/IDF config files for 2 virtual PODs" --- diff --git a/src/foundation/scripts/config.sh b/src/foundation/scripts/config.sh new file mode 100755 index 0000000..9bd88e0 --- /dev/null +++ b/src/foundation/scripts/config.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Host user which can log into master and each worker nodes +HOST_USER=${HOST_USER:-iec} + +REPO_URL="https://gerrit.akraino.org/r/iec" +#log file +LOG_FILE="kubeadm.log" + + +# Master node IP address +K8S_MASTER_IP="10.169.36.152" + +# HOST_USER's password on Master node +K8S_MASTERPW="123456" + +###################################################### +# +# K8S_WORKER_GROUP is an array which consists of 2 +# parts. One is k8s worker ip address. The other is +# the user password. +# +###################################################### +K8S_WORKER_GROUP=( +"10.169.40.106,123456" +) + + diff --git a/src/foundation/scripts/functest.sh b/src/foundation/scripts/functest.sh new file mode 100755 index 0000000..a3e4bae --- /dev/null +++ b/src/foundation/scripts/functest.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Run the functest-kubernetes on master node for checking +# K8s environments +set -e + +K8S_MASTER_IP=$1 + + +if [ -z "${K8S_MASTER_IP}" ] +then + echo "Error:K8S_MASTER_IP is empty." + echo "Please input the k8s master ip address." + echo "Just as:" + echo "./functest.sh 10.1.1.1" + exit 1 +fi + + +cat < "${HOME}/k8.creds" +export KUBERNETES_PROVIDER=local +export KUBE_MASTER_URL=https://${K8S_MASTER_IP}:6443 +export KUBE_MASTER_IP=${K8S_MASTER_IP} +EOF + +mkdir -p "${HOME}/functest/results" + +sudo docker run --rm -e DEPLOY_SCENARIO=k8-nosdn-nofeature-noha \ + -v "${HOME}/k8.creds:/home/opnfv/functest/conf/env_file" \ + -v "${HOME}/functest/results:/home/opnfv/functest/results" \ + -v "${HOME}/.kube/config:/root/.kube/config" opnfv/functest-kubernetes-healthcheck:latest \ + /bin/bash -c 'run_tests -r -t all' diff --git a/src/foundation/scripts/helm.sh b/src/foundation/scripts/helm.sh index 3f575d2..ccd32ae 100755 --- a/src/foundation/scripts/helm.sh +++ b/src/foundation/scripts/helm.sh @@ -42,3 +42,4 @@ EOF kubectl create -f "${TILLER_SA_RBAC}" helm init --service-account tiller --tiller-image="jessestuart/tiller:${VERSION}" fi +rm -f "${TILLER_SA_RBAC}" diff --git a/src/foundation/scripts/k8s_common.sh b/src/foundation/scripts/k8s_common.sh index e1e086d..0e9de86 100755 --- a/src/foundation/scripts/k8s_common.sh +++ b/src/foundation/scripts/k8s_common.sh @@ -2,6 +2,7 @@ DOCKER_VERSION=18.06.1~ce~3-0~ubuntu KUBE_VERSION=1.13.0-00 +K8S_CNI_VERSION=0.6.0-00 # Install Docker as Prerequisite curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -25,9 +26,10 @@ cat <> ./iec/src/foundation/scripts/k8s_worker.sh" - sshpass -p ${K8S_WORKERPW} ssh ${HOST_USER}@${K8S_WORKER01_IP} ${SETUP_WORKER} + + for worker in "${K8S_WORKER_GROUP[@]}" + do + ip_addr="$(cut -d',' -f1 <<<${worker})" + passwd="$(cut -d',' -f2 <<<${worker})" + echo "Install & Deploy on ${ip_addr}. password:${passwd}" + + sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} ${INSTALL_SOFTWARE} + sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} "echo \"sudo ${KUBEADM_JOIN_CMD}\" >> ./iec/src/foundation/scripts/k8s_worker.sh" + sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} ${SETUP_WORKER} + + done + #Deploy etcd & CNI from master node #There may be more options in future. e.g: Calico, Contiv-vpp, Ovn-k8s ... @@ -62,32 +79,23 @@ check_k8s_status(){ } -PASSWD=${4:-"123456"} -HOST_USER=${3:-"iec"} - -K8S_MASTER_IP=${1:-"10.169.40.171"} -K8S_MASTERPW=${PASSWD} - -K8S_WORKER01_IP=${2:-"10.169.41.172"} -K8S_WORKERPW=${PASSWD} - -REPO_URL="https://gerrit.akraino.org/r/iec" -LOG_FILE="kubeadm.log" - -if [ -f "./${LOG_FILE}" ]; then - rm "${LOG_FILE}" -fi - # # Init # -if [ $# -lt 4 ] +if [ $1 == "--help" ] || [ $1 == "-h" ]; then display_help exit 0 fi +# Read the configuration file +source config + +echo "The number of K8s-Workers:${#K8S_WORKER_GROUP[@]}" + +rm -f "${LOG_FILE}" + deploy_k8s check_k8s_status