diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-03-08 13:40:30 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-03-08 13:51:58 +0100 |
commit | bafdccabc9de867eabf732228fc7bc1e1d98e412 (patch) | |
tree | 7444357322909804ffa7ba82100a1fca79ac539f /tools | |
parent | 9880331a27a67063d802c67b2ecf95c677046406 (diff) |
Support Helm v3 in helm-healer script
Change-Id: I314b37c587c76038b1694eef7d52078f2af09a1d
Issue-ID: OOM-2665
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/helm-healer.sh | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/helm-healer.sh b/tools/helm-healer.sh index 92ddbdb7..47479a9b 100755 --- a/tools/helm-healer.sh +++ b/tools/helm-healer.sh @@ -190,7 +190,12 @@ get_labels() helm_undeploy() { msg "Undeploy helm release name: ${1}" - helm undeploy ${1} --purge + # Helm v3 does not support "--purge" flag since it's a default behavior for v3 + if [[ $(helm version --template "{{.Version}}") =~ ^v3 ]];then + helm undeploy ${1} + else + helm undeploy ${1} --purge + fi sleep 15s } @@ -349,11 +354,9 @@ docker_cleanup() is_helm_serve_running() { # healthy result: HTTP/1.1 200 OK - _helm_serve_result=$(\ - curl --head --silent --connect-timeout 3 http://127.0.0.1:8879 | \ - head -n 1 | cut -d" " -f 3 | tr '[:upper:]' '[:lower:]' | tr -d '\r' ) + _helm_serve_result=$(curl -w %{http_code} --silent --connect-timeout 3 http://127.0.0.1:8879/ -o /dev/null) - if [ "$_helm_serve_result" == ok ] ; then + if [ "$_helm_serve_result" == "200" ] ; then return 0 else return 1 @@ -620,6 +623,10 @@ if [ -n "$arg_cleanonly" ] ; then HELM_SKIP_DEPLOY=yes fi +# If running with helm v3 a time unit has to be appended to HELM_TIMEOUT +if [[ $(helm version --template "{{.Version}}") =~ ^v3 ]];then + HELM_TIMEOUT="${HELM_TIMEOUT}s" +fi # # main |