# Helm chart 1.6.0 correspondes to Airflow 2.3.0
AIRFLOW_HELM_VERSION=1.6.0
PROMPUSHGW_HELM_VERSION=1.18.2
+ALERTMANAGER_HELM_VERSION=0.22.0
# Install Airflow helm chart
function install_airflow() {
# copy airflow-values.yaml to the destination folder
sudo mkdir -p ${OSM_HELM_WORK_DIR}
sudo cp ${OSM_DEVOPS}/installers/helm/values/airflow-values.yaml ${OSM_HELM_WORK_DIR}
+ # update airflow-values.yaml to use the right tag
+ echo "Updating Helm values file helm/values/airflow-values.yaml to use defaultAirflowTag: ${OSM_DOCKER_TAG}"
+ sudo sed -i "s#defaultAirflowTag:.*#defaultAirflowTag: ${OSM_DOCKER_TAG}#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml
if ! helm -n osm status airflow 2> /dev/null ; then
# if it does not exist, create secrets and install
kubectl -n osm create secret generic airflow-webserver-secret --from-literal="webserver-secret-key=$(python3 -c 'import secrets; print(secrets.token_hex(16))')"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
+# Install Prometheus AlertManager helm chart
+function install_prometheus_alertmanager() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+ # copy alertmanager-values.yaml to the destination folder
+ sudo mkdir -p ${OSM_HELM_WORK_DIR}
+ sudo cp ${OSM_DEVOPS}/installers/helm/values/alertmanager-values.yaml ${OSM_HELM_WORK_DIR}
+ if ! helm -n osm status alertmanager 2> /dev/null ; then
+ # if it does not exist, install
+ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
+ helm repo update
+ helm -n osm install alertmanager prometheus-community/alertmanager -f ${OSM_HELM_WORK_DIR}/alertmanager-values.yaml --version ${ALERTMANAGER_HELM_VERSION}
+ else
+ # if it exists, upgrade
+ helm repo update
+ helm -n osm upgrade alertmanager prometheus-community/alertmanager -f ${OSM_HELM_WORK_DIR}/alertmanager-values.yaml --version ${ALERTMANAGER_HELM_VERSION}
+ fi
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
# main
-while getopts ":D:d:-: " o; do
+
+OSM_DEVOPS="/usr/share/osm-devops"
+OSM_HELM_WORK_DIR="/etc/osm/helm"
+OSM_DOCKER_TAG="13"
+
+while getopts ":D:d:t:-: " o; do
case "${o}" in
D)
OSM_DEVOPS="${OPTARG}"
d)
OSM_HELM_WORK_DIR="${OPTARG}"
;;
+ t)
+ OSM_DOCKER_TAG="${OPTARG}"
+ ;;
-)
[ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue
echo -e "Invalid option: '--$OPTARG'\n" >&2
echo "DEBUG_INSTALL=$DEBUG_INSTALL"
echo "OSM_DEVOPS=$OSM_DEVOPS"
+echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG"
echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
install_airflow
track deploy_osm airflow_ok
install_prometheus_pushgateway
track deploy_osm pushgateway_ok
+install_prometheus_alertmanager
+track deploy_osm alertmanager_ok