From b699e0c998b1977ac25802714400e2e9c62c0544 Mon Sep 17 00:00:00 2001 From: Bharat Kunwar Date: Fri, 3 Jul 2020 09:25:39 +0000 Subject: [PATCH] [k8s] Use helm upgrade --install in deployment loop Sometimes, the chart may fail to deploy, e.g. if the worker node is not ready before chart deployment times out. Retry until status is deployed. Story: 2007514 Task: 40276 Change-Id: I8fd5cc154e86006e9139d5ac5f282d0b460eca37 (cherry picked from commit a008e3b44f8610675d50f8aef9c576133c707814) --- .../templates/kubernetes/fragments/install-helm-modules.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/magnum/drivers/common/templates/kubernetes/fragments/install-helm-modules.sh b/magnum/drivers/common/templates/kubernetes/fragments/install-helm-modules.sh index 41fdf3836f..eee2115835 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/install-helm-modules.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/install-helm-modules.sh @@ -48,7 +48,7 @@ else $ssh_cmd tar xzvf /srv/magnum/helm-client.tar.gz linux-amd64/helm -O > /srv/magnum/bin/helm $ssh_cmd chmod +x /srv/magnum/bin/helm - helm_install_cmd="helm install magnum . --namespace kube-system --values values.yaml --render-subchart-notes" + helm_install_cmd="helm upgrade --install magnum . --namespace kube-system --values values.yaml --render-subchart-notes" helm_history_cmd="helm history magnum --namespace kube-system" if [[ "${HELM_CLIENT_TAG}" == v2.* ]]; then CERTS_DIR="/etc/kubernetes/helm/certs" @@ -64,7 +64,7 @@ else until helm init --client-only --wait; do sleep 5s done - helm_install_cmd="helm install --name magnum . --namespace kube-system --values values.yaml --render-subchart-notes" + helm_install_cmd="helm upgrade --install --name magnum . --namespace kube-system --values values.yaml --render-subchart-notes" helm_history_cmd="helm history magnum" fi @@ -81,7 +81,7 @@ EOF sed -i '1i\dependencies:' requirements.yaml i=0 - until ($helm_history_cmd | grep magnum) || (helm dep update && $helm_install_cmd); do + until ($helm_history_cmd | grep magnum | grep deployed) || (helm dep update && $helm_install_cmd); do i=$((i + 1)) [ $i -lt 60 ] || break; sleep 5