From: Jingzhao.Ni Date: Wed, 22 May 2019 10:41:12 +0000 (+0800) Subject: Fix install bug X-Git-Tag: 1.0.0~1 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=0c0074f81e13dc505b36d187fd98df9e343358c5;hp=cf0f46af320cc9cf41efb6edad7afbe94dd5e1b6;p=iec.git Fix install bug Fix install bug which is about kube config Signed-off-by: Jingzhao.Ni Change-Id: I1ef16554850992f38e0220440666f37caf35e5be --- diff --git a/src/foundation/scripts/helm.sh b/src/foundation/scripts/helm.sh index ccd32ae..44205ca 100755 --- a/src/foundation/scripts/helm.sh +++ b/src/foundation/scripts/helm.sh @@ -1,5 +1,10 @@ #!/bin/bash -ex +if [ -f "$HOME/.bashrc" ]; then + # shellcheck source=/dev/null + source "$HOME/.bashrc" +fi + VERSION='v2.12.3' TILLER_SA_RBAC=~/tiller-rbac.yaml if [ "$(uname -m)" == 'aarch64' ]; then diff --git a/src/foundation/scripts/k8s_master.sh b/src/foundation/scripts/k8s_master.sh index cc6a0c2..0c00623 100755 --- a/src/foundation/scripts/k8s_master.sh +++ b/src/foundation/scripts/k8s_master.sh @@ -22,11 +22,12 @@ if ! kubectl get nodes; then tee -a "${HOME}/.bashrc" # shellcheck disable=SC1090 source "${HOME}/.bashrc" - else - mkdir -p "${HOME}/.kube" - sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config" - sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config" fi + + mkdir -p "${HOME}/.kube" + sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config" + sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config" + sleep 5 sudo swapon -a fi diff --git a/src/foundation/scripts/nginx.sh b/src/foundation/scripts/nginx.sh index 307371b..3e419b9 100755 --- a/src/foundation/scripts/nginx.sh +++ b/src/foundation/scripts/nginx.sh @@ -36,6 +36,11 @@ spec: - containerPort: 80 EOF +if [ -f "$HOME/.bashrc" ]; then + # shellcheck source=/dev/null + source "$HOME/.bashrc" +fi + if ! kubectl get services | grep -q nginx; then kubectl create -f "${NGINX_APP}" fi diff --git a/src/foundation/scripts/setup-cni.sh b/src/foundation/scripts/setup-cni.sh index 643f157..0d82360 100755 --- a/src/foundation/scripts/setup-cni.sh +++ b/src/foundation/scripts/setup-cni.sh @@ -2,6 +2,11 @@ set -o xtrace set -e +if [ -f "$HOME/.bashrc" ]; then + # shellcheck source=/dev/null + source "$HOME/.bashrc" +fi + CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script POD_NETWORK_CIDR=${2:-192.168.0.0/16} diff --git a/src/foundation/scripts/startup.sh b/src/foundation/scripts/startup.sh index dad6728..01783bc 100755 --- a/src/foundation/scripts/startup.sh +++ b/src/foundation/scripts/startup.sh @@ -64,9 +64,9 @@ deploy_k8s () { #Deploy etcd & CNI from master node #There may be more options in future. e.g: Calico, Contiv-vpp, Ovn-k8s ... - SETUP_CNI="KUBECONFIG=/etc/kubernetes/admin.conf && cd iec/src/foundation/scripts && source setup-cni.sh" + SETUP_CNI="cd iec/src/foundation/scripts && source setup-cni.sh" sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_CNI} - SETUP_HELM="KUBECONFIG=/etc/kubernetes/admin.conf && cd iec/src/foundation/scripts && source helm.sh" + SETUP_HELM="cd iec/src/foundation/scripts && source helm.sh" sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_HELM} }