summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Latusek <j.latusek@samsung.com>2020-10-14 16:20:12 +0200
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-10-20 14:28:43 +0200
commitdd364d3f93be7f436c3ae3d62dafb930b9a491fe (patch)
tree8359c0bf886dbd7bc0d3aad4edaeab74518a3dae
parentb61ad49e3b97eadebccbf76bcebefa638ef10c05 (diff)
[HELM] Update helm deploy plugin
Change cache path to one used by helm3 plugins Remove --purge flag for helm3 Signed-off-by: Jakub Latusek <j.latusek@samsung.com> Issue-ID: OOM-2562 Change-Id: Ic33a1a5e2149478c8451c38a87f7bc1d32f00d55
-rwxr-xr-xkubernetes/helm/plugins/deploy/deploy.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh
index bb98a3b95e..40338b9485 100755
--- a/kubernetes/helm/plugins/deploy/deploy.sh
+++ b/kubernetes/helm/plugins/deploy/deploy.sh
@@ -98,7 +98,12 @@ deploy() {
FLAGS=${@:3}
CHART_REPO="$(cut -d'/' -f1 <<<"$CHART_URL")"
CHART_NAME="$(cut -d'/' -f2 <<<"$CHART_URL")"
- CACHE_DIR=~/.helm/plugins/deploy/cache
+ if [[ $HELM_VER == "v3."* ]]; then
+ CACHE_DIR=~/.local/share/helm/plugins/deploy/cache
+ else
+ CACHE_DIR=~/.helm/plugins/deploy/cache
+ fi
+ echo "Use cache dir: $CACHE_DIR"
CHART_DIR=$CACHE_DIR/$CHART_NAME
CACHE_SUBCHART_DIR=$CHART_DIR-subcharts
LOG_DIR=$CHART_DIR/logs
@@ -114,7 +119,7 @@ deploy() {
if [[ $FLAGS = *"--delay"* ]]; then
FLAGS="$(echo $FLAGS| sed -n 's/--delay//p')"
DELAY="true"
- fi
+ fi
# determine if set-last-applied flag is enabled
SET_LAST_APPLIED="false"
if [[ $FLAGS = *"--set-last-applied"* ]]; then
@@ -246,12 +251,16 @@ deploy() {
if [[ $DELAY == "true" ]]; then
echo sleep 3m
sleep 3m
- fi
+ fi
else
array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}"))
n=${#array[*]}
for (( i = n-1; i >= 0; i-- )); do
- helm del "${array[i]}" --purge
+ if [[ $HELM_VER == "v3."* ]]; then
+ helm del "${array[i]}"
+ else
+ helm del "${array[i]}" --purge
+ fi
done
fi
done
@@ -259,6 +268,8 @@ deploy() {
# report on success/failures of installs/upgrades
helm ls | grep FAILED | grep $RELEASE
}
+HELM_VER=$(helm version --template "{{.Version}}")
+echo $HELM_VER
case "${1:-"help"}" in
"help")