X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Finstall_ngsa.sh;h=0a4f03ab6b49099b8f1f499664904c486c9bc3e8;hb=refs%2Fchanges%2F25%2F14325%2F26;hp=151b6860de52d175caf7b17c21a97895207fde20;hpb=02609d9c7d62448a1b51b41befdfd0bc6da14d75;p=osm%2Fdevops.git diff --git a/installers/install_ngsa.sh b/installers/install_ngsa.sh index 151b6860..0a4f03ab 100755 --- a/installers/install_ngsa.sh +++ b/installers/install_ngsa.sh @@ -16,9 +16,7 @@ set +eux # 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 +AIRFLOW_HELM_VERSION=1.9.0 # Install Airflow helm chart function install_airflow() { @@ -28,64 +26,32 @@ function install_airflow() { 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))')" - helm repo add apache-airflow https://airflow.apache.org - helm repo update - helm -n osm install airflow apache-airflow/airflow -f ${OSM_HELM_WORK_DIR}/airflow-values.yaml --version ${AIRFLOW_HELM_VERSION} - else - # if it exists, upgrade - helm repo update - helm -n osm upgrade airflow apache-airflow/airflow -f ${OSM_HELM_WORK_DIR}/airflow-values.yaml --version ${AIRFLOW_HELM_VERSION} - fi - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -# Install Prometheus Pushgateway helm chart -function install_prometheus_pushgateway() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function - if ! helm -n osm status pushgateway 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 pushgateway prometheus-community/prometheus-pushgateway --version ${PROMPUSHGW_HELM_VERSION} - else - # if it exists, upgrade - helm repo update - helm -n osm upgrade pushgateway prometheus-community/prometheus-pushgateway --version ${PROMPUSHGW_HELM_VERSION} - fi - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} + sudo sed -i "s#defaultAirflowTag:.*#defaultAirflowTag: \"${OSM_DOCKER_TAG}\"#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml + echo "Updating Helm values file helm/values/airflow-values.yaml to use defaultAirflowRepository: ${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow" + sudo sed -i "s#defaultAirflowRepository:.*#defaultAirflowRepository: ${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml + echo "Updating Helm values file helm/values/airflow-values.yaml to set ingress.web.hosts with host \"airflow.${DEFAULT_IP}.nip.io\"" + sudo sed -i "s#name: \"localhost\"#name: \"airflow.${DEFAULT_IP}.nip.io\"#g" ${OSM_HELM_WORK_DIR}/airflow-values.yaml -# 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 + helm repo add apache-airflow https://airflow.apache.org + helm repo update + helm upgrade airflow apache-airflow/airflow -n osm --create-namespace --install -f ${OSM_HELM_WORK_DIR}/airflow-values.yaml --version ${AIRFLOW_HELM_VERSION} --timeout 10m || FATAL_TRACK ngsa "Failed installing airflow helm chart" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } # main +DOCKER_REGISTRY_URL= +DOCKER_USER="opensourcemano" OSM_DEVOPS="/usr/share/osm-devops" +OSM_DOCKER_TAG="testing-daily" OSM_HELM_WORK_DIR="/etc/osm/helm" -OSM_DOCKER_TAG="13" +DEFAULT_IP="127.0.0.1" -while getopts ":D:d:t:-: " o; do +while getopts ":D:d:i:t:r:U:-: " o; do case "${o}" in + i) + DEFAULT_IP="${OPTARG}" + ;; D) OSM_DEVOPS="${OPTARG}" ;; @@ -95,6 +61,12 @@ while getopts ":D:d:t:-: " o; do t) OSM_DOCKER_TAG="${OPTARG}" ;; + r) + DOCKER_REGISTRY_URL="${OPTARG}" + ;; + U) + DOCKER_USER="${OPTARG}" + ;; -) [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue echo -e "Invalid option: '--$OPTARG'\n" >&2 @@ -117,6 +89,7 @@ done source $OSM_DEVOPS/common/logging source $OSM_DEVOPS/common/track +echo "DEFAULT_IP=$DEFAULT_IP" echo "DEBUG_INSTALL=$DEBUG_INSTALL" echo "OSM_DEVOPS=$OSM_DEVOPS" echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" @@ -124,8 +97,3 @@ 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 -