-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelm-deploy.sh
executable file
·46 lines (37 loc) · 1.51 KB
/
helm-deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
#*******************************************************************************
# Copyright (c) 2024 Eclipse Foundation and others.
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License 2.0
# which is available at http://www.eclipse.org/legal/epl-v20.html
# SPDX-License-Identifier: EPL-2.0
#*******************************************************************************
# Bash strict-mode
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
SCRIPT_FOLDER="$(dirname "$(readlink -f "${0}")")"
ROOT_DIR="${SCRIPT_FOLDER}"
chart_name="infocenter"
namespace="infocenter"
release_name="${1:-}"
image_tag="${2:-}" #optional
# check that release_name is not empty
if [[ -z "${release_name}" ]]; then
printf "ERROR: a release_name (e.g. '2024-12') must be given.\n"
exit 1
fi
values_file="${ROOT_DIR}/charts/${chart_name}/values-${release_name}.yaml"
if helm list -n "${namespace}" | grep "${release_name}" > /dev/null; then
echo "Found installed Helm chart for release name '${release_name}'. Upgrading..."
action="upgrade"
else
echo "Found no installed Helm chart for release name '${release_name}'. Installing..."
action="install"
fi
if [[ -z "${image_tag}" ]]; then
helm "${action}" "${release_name}" "${ROOT_DIR}/charts/${chart_name}" -f "${values_file}" --namespace "${namespace}"
else
helm "${action}" "${release_name}" "${ROOT_DIR}/charts/${chart_name}" -f "${values_file}" --set image.tag="${image_tag}" --namespace "${namespace}"
fi