Update versions of helm3 and kubernetes for OSM community installer
[osm/devops.git] / installers / install_kubeadm_cluster.sh
index 1e72f37..972fef1 100755 (executable)
@@ -18,7 +18,8 @@ set +eux
 #installs kubernetes packages
 function install_kube() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
-    K8S_VERSION=1.20.11-00
+    K8S_VERSION=1.20.14-00
+    # Kubernetes releases can be found here: https://kubernetes.io/releases/
     # To check other available versions, run the following command
     # curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}'
     sudo apt-get update && sudo apt-get install -y apt-transport-https
@@ -73,20 +74,23 @@ function taint_master_node() {
 }
 
 #Install Helm v3
+#Helm releases can be found here: https://github.com/helm/helm/releases
 function install_helm() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
-    helm > /dev/null 2>&1
-    if [ $? != 0 ] ; then
+    HELM_VERSION="v3.7.2"
+    if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then
         # Helm is not installed. Install helm
-        echo "Helm is not installed, installing ..."
-        curl https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz --output helm-v3.6.3.tar.gz
-        tar -zxvf helm-v3.6.3.tar.gz
+        echo "Helm3 is not installed, installing ..."
+        curl https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz --output helm-${HELM_VERSION}.tar.gz
+        tar -zxvf helm-${HELM_VERSION}.tar.gz
         sudo mv linux-amd64/helm /usr/local/bin/helm
         rm -r linux-amd64
-        rm helm-v3.6.3.tar.gz
-        helm repo add stable https://charts.helm.sh/stable
-        helm repo update
+        rm helm-${HELM_VERSION}.tar.gz
+    else
+        echo "Helm3 is already installed. Skipping installation..."
     fi
+    helm repo add stable https://charts.helm.sh/stable
+    helm repo update
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
@@ -272,25 +276,25 @@ echo "HOME=$HOME"
 
 
 install_kube
-track install_k8s
+track k8scluster install_k8s_ok
 init_kubeadm $OSM_DOCKER_WORK_DIR/cluster-config.yaml
 kube_config_dir
-track init_k8s
+track k8scluster init_k8s_ok
 if [ -n "$INSTALL_K8S_MONITOR" ]; then
     # uninstall OSM MONITORING
     uninstall_k8s_monitoring
-    track uninstall_k8s_monitoring
+    track k8scluster uninstall_k8s_monitoring_ok
 fi
 #remove old namespace
 remove_k8s_namespace osm
 deploy_cni_provider
 taint_master_node
 install_helm
-track install_helm
+track k8scluster install_helm_ok
 install_k8s_storageclass
-track k8s_storageclass
+track k8scluster k8s_storageclass_ok
 install_helm_metallb
-track k8s_metallb
+track k8scluster k8s_metallb_ok
 check_for_readiness
-track k8s_ready
+track k8scluster k8s_ready_ok