X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=tools%2Fk8s%2Fheat%2Fscripts%2Fk8s_vm_install.sh;h=ee98acf5c209aef9ee17f05ffed4cd45a8024955;hb=a72e0f1c2ae78ab9eadacf5e7b3df53998584a72;hp=8b8f62de963e1bfbbeea1d2c0c169dc1d4f75fe2;hpb=ef5e8a36f7ae076da4d6bcf7ec383bc1817517b1;p=it%2Fdep.git diff --git a/tools/k8s/heat/scripts/k8s_vm_install.sh b/tools/k8s/heat/scripts/k8s_vm_install.sh index 8b8f62de..ee98acf5 100644 --- a/tools/k8s/heat/scripts/k8s_vm_install.sh +++ b/tools/k8s/heat/scripts/k8s_vm_install.sh @@ -16,7 +16,7 @@ ################################################################################ -# first parameter: number of expected running pods +# first parameter: number of expected running pods # second parameter: namespace (all-namespaces means all namespaces) # third parameter: [optional] keyword wait_for_pods_running () { @@ -131,7 +131,7 @@ if [[ ${UBUNTU_RELEASE} == 16.* ]]; then elif [[ ${UBUNTU_RELEASE} == 18.* ]]; then echo "Installing on Ubuntu $UBUNTU_RELEASE (Bionic Beaver)" if [ ! -z "${DOCKERV}" ]; then - DOCKERVERSION="${DOCKERV}-0ubuntu1~18.04.5" + DOCKERVERSION="${DOCKERV}-0ubuntu1~18.04.4" fi else echo "Unsupported Ubuntu release ($UBUNTU_RELEASE) detected. Exit." @@ -148,8 +148,7 @@ echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries # install low latency kernel, docker.io, and kubernetes apt-get update - -RES=$(apt-get install -y virt-what curl jq netcat make 2>&1) +RES=$(apt-get install -y virt-what curl jq netcat make ipset moreutils 2>&1) if [[ $RES == */var/lib/dpkg/lock* ]]; then echo "Fail to get dpkg lock. Wait for any other package installation" echo "process to finish, then rerun this script" @@ -260,7 +259,7 @@ apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration mode: ipvs EOF - elif [[ ${KUBEV} == 1.16.* ]]; then + elif [[ ${KUBEV} == 1.15.* ]] || [[ ${KUBEV} == 1.16.* ]] || [[ ${KUBEV} == 1.18.* ]]; then cat </root/config.yaml apiVersion: kubeadm.k8s.io/v1beta2 kubernetesVersion: v${KUBEV} @@ -314,7 +313,8 @@ EOF mkdir -p .kube cp -i /etc/kubernetes/admin.conf /root/.kube/config chown root:root /root/.kube/config - export KUBECONFIG=/root/.kube/config + export KUBECONFIG=/root/.kube/config + echo "KUBECONFIG=${KUBECONFIG}" >> /etc/environment # at this point we should be able to use kubectl kubectl get pods --all-namespaces @@ -333,7 +333,7 @@ EOF HELMV=$(cat /opt/config/helm_version.txt) HELMVERSION=${HELMV} if [ ! -e helm-v${HELMVERSION}-linux-amd64.tar.gz ]; then - wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELMVERSION}-linux-amd64.tar.gz + wget https://get.helm.sh/helm-v${HELMVERSION}-linux-amd64.tar.gz fi cd /root && rm -rf Helm && mkdir Helm && cd Helm tar -xvf ../helm-v${HELMVERSION}-linux-amd64.tar.gz @@ -341,20 +341,29 @@ EOF cd /root # install RBAC for Helm - kubectl create -f rbac-config.yaml + if [[ ${HELMVERSION} == 2.* ]]; then + kubectl create -f rbac-config.yaml + fi rm -rf /root/.helm if [[ ${KUBEV} == 1.16.* ]]; then # helm init uses API extensions/v1beta1 which is depreciated by Kubernetes # 1.16.0. Until upstream (helm) provides a fix, this is the work-around. - helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml > /tmp/helm-init.yaml - sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' /tmp/helm-init.yaml > /tmp/helm-init-patched.yaml - kubectl apply -f /tmp/helm-init-patched.yaml + if [[ ${HELMVERSION} == 2.* ]]; then + helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml > /tmp/helm-init.yaml + sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' /tmp/helm-init.yaml > /tmp/helm-init-patched.yaml + kubectl apply -f /tmp/helm-init-patched.yaml + fi else - helm init --service-account tiller + if [[ ${HELMVERSION} == 2.* ]]; then + helm init --service-account tiller + fi + fi + if [[ ${HELMVERSION} == 2.* ]]; then + helm init -c + export HELM_HOME="$(pwd)/.helm" + echo "HELM_HOME=${HELM_HOME}" >> /etc/environment fi - helm init -c - export HELM_HOME="/root/.helm" # waiting for tiller pod to be in running state while ! helm version; do @@ -404,4 +413,4 @@ EOF docker pull ${__RUNRICENV_DOCKER_HOST__}:${__RUNRICENV_DOCKER_PORT__}/whoami:0.0.1 fi -if [ "$(uname -r)" != "4.15.0-45-lowlatency" ]; then reboot; fi \ No newline at end of file +if [ "$(uname -r)" != "4.15.0-45-lowlatency" ]; then reboot; fi