From: garciadeblas Date: Fri, 25 Apr 2025 04:46:11 +0000 (+0200) Subject: Revert "Feature 11060: Remove POL and PLA modules from OSM helm chart" X-Git-Tag: v18.0.0~71 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F15180%2F1;p=osm%2Fdevops.git Revert "Feature 11060: Remove POL and PLA modules from OSM helm chart" This reverts commit 07367db6ef025e4fbb872b32a1f42737d2a563ec. Change-Id: Ifa86312a16c4841603316f38ee5ffbdb4e6cc39f Signed-off-by: garciadeblas --- diff --git a/docker/PLA/Dockerfile b/docker/PLA/Dockerfile new file mode 100644 index 00000000..e882de8d --- /dev/null +++ b/docker/PLA/Dockerfile @@ -0,0 +1,123 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +FROM ubuntu:22.04 as INSTALL + +ARG APT_PROXY +RUN if [ ! -z $APT_PROXY ] ; then \ + echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\ + echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\ + fi + +RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install \ + gcc=4:11.* \ + python3=3.10.* \ + python3-dev=3.10.* \ + python3-pip=22.0.* \ + curl=7.81.* \ + && rm -rf /var/lib/apt/lists/* + +####################################################################################### +# End of common preparation + +ARG PYTHON3_OSM_COMMON_URL +ARG PYTHON3_OSM_PLA_URL + +RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb +RUN dpkg -i ./osm_common.deb + +RUN curl $PYTHON3_OSM_PLA_URL -o osm_pla.deb +RUN dpkg -i ./osm_pla.deb + +RUN pip3 install \ + -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \ + -r /usr/lib/python3/dist-packages/osm_pla/requirements.txt + +ADD https://github.com/MiniZinc/MiniZincIDE/releases/download/2.4.2/MiniZincIDE-2.4.2-bundle-linux-x86_64.tgz /minizinc.tgz + +RUN tar -zxf /minizinc.tgz && \ + mv /MiniZincIDE-2.4.2-bundle-linux /minizinc + +####################################################################################### +FROM ubuntu:22.04 as FINAL + +ARG APT_PROXY +RUN if [ ! -z $APT_PROXY ] ; then \ + echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\ + echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\ + fi + +RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install \ + python3-minimal=3.10.* \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages +COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages + +####################################################################################### +# End of common preparation + +RUN rm -f /etc/apt/apt.conf.d/proxy.conf + +LABEL authors="Lars-Göran Magnusson" + +COPY --from=INSTALL /usr/bin/osm* /usr/bin/ +COPY --from=INSTALL /minizinc /minizinc + +RUN mkdir /entry_data && \ + mkdir /placement && \ + mkdir /entry_data/mzn-lib && \ + ln -s /entry_data/mzn-lib /minizinc/share/minizinc/exec + +COPY scripts/ /app/osm_pla/scripts/ + +# Creating the user for the app +RUN groupadd -g 1000 appuser && \ + useradd -u 1000 -g 1000 -d /app appuser && \ + mkdir -p /app/osm_pla && \ + chown -R appuser:appuser /app && \ + chown -R appuser:appuser /entry_data && \ + chown -R appuser:appuser /minizinc && \ + chown -R appuser:appuser /placement + +WORKDIR /app/osm_pla + +# Changing the security context +USER appuser + +ENV OSMPLA_MESSAGE_DRIVER kafka +ENV OSMPLA_MESSAGE_HOST kafka +ENV OSMPLA_MESSAGE_PORT 9092 + +ENV OSMPLA_DATABASE_DRIVER mongo +ENV OSMPLA_DATABASE_URI mongodb://mongo:27017 + +ENV OSMPLA_SQL_DATABASE_URI sqlite:///pla_sqlite.db + +ENV OSMPLA_GLOBAL_LOG_LEVEL INFO + +ENV FZNEXEC "/entry_data/fzn-exec" +ENV PATH "/minizinc/bin:${PATH}" +ENV LD_LIBRARY_PATH "/minizinc/lib:${LD_LIBRARY_PATH}" + +# No healtcheck yet... +#HEALTHCHECK --start-period=120s --interval=10s --timeout=5s --retries=5 \ +# CMD osm-pla-healthcheck || exit 1 + +CMD [ "/bin/bash", "scripts/start.sh" ] diff --git a/docker/PLA/scripts/start.sh b/docker/PLA/scripts/start.sh new file mode 100644 index 00000000..ae39b57f --- /dev/null +++ b/docker/PLA/scripts/start.sh @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Arctos Labs Scandinavia AB +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +DB_EXISTS="" + +max_attempts=120 +function wait_db(){ + db_host=$1 + db_port=$2 + attempt=0 + echo "Wait until $max_attempts seconds for MySQL mano Server ${db_host}:${db_port} " + while ! mysqladmin ping -h"$db_host" -P"$db_port" --silent; do + #wait 120 sec + if [ $attempt -ge $max_attempts ]; then + echo + echo "Can not connect to database ${db_host}:${db_port} during $max_attempts sec" + return 1 + fi + attempt=$[$attempt+1] + echo -n "." + sleep 1 + done + return 0 +} + +function is_db_created() { + db_host=$1 + db_port=$2 + db_user=$3 + db_pswd=$4 + db_name=$5 + + if mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -q $db_name; then + echo "DB $db_name exists" + return 0 + else + echo "DB $db_name does not exist" + return 1 + fi +} + +if [[ $OSMPLA_SQL_DATABASE_URI == *'mysql'* ]]; then + DB_HOST=$(echo $OSMPLA_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@(.+):.*$|\1|') + DB_PORT=$(echo $OSMPLA_SQL_DATABASE_URI | sed -r 's|^\w+://.*:([0-9]+).*$|\1|') + DB_USER=$(echo $OSMPLA_SQL_DATABASE_URI | sed -r 's|^\w+://(.+):.+@.+$|\1|') + DB_PASSWORD=$(echo $OSMPLA_SQL_DATABASE_URI | sed -r 's|^.+://.+:(.+)@.*$|\1|') + DB_NAME=$(echo $OSMPLA_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@.+:.*/(.+)$|\1|') + + wait_db "$DB_HOST" "$DB_PORT" || exit 1 + + is_db_created "$DB_HOST" "$DB_PORT" "$DB_USER" "$DB_PASSWORD" "$DB_NAME" && DB_EXISTS="Y" + + if [ -z $DB_EXISTS ]; then + mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" --default_character_set utf8 -e "CREATE DATABASE $DB_NAME" + fi +fi + +osm-pla-server diff --git a/docker/POL/Dockerfile b/docker/POL/Dockerfile new file mode 100644 index 00000000..2216338a --- /dev/null +++ b/docker/POL/Dockerfile @@ -0,0 +1,118 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +FROM ubuntu:22.04 as INSTALL + +ARG APT_PROXY +RUN if [ ! -z $APT_PROXY ] ; then \ + echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\ + echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\ + fi + +RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install \ + gcc=4:11.* \ + python3=3.10.* \ + python3-dev=3.10.* \ + python3-pip=22.0.* \ + curl=7.81.* \ + && rm -rf /var/lib/apt/lists/* + +####################################################################################### +# End of common preparation + +RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install \ + mysql-client-core-8.0=8.0.* + +ARG PYTHON3_OSM_COMMON_URL +ARG PYTHON3_OSM_POLICY_MODULE_URL + +RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb +RUN dpkg -i ./osm_common.deb + +RUN curl $PYTHON3_OSM_POLICY_MODULE_URL -o osm_policy_module.deb +RUN dpkg -i ./osm_policy_module.deb + +RUN pip3 install \ + -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \ + -r /usr/lib/python3/dist-packages/osm_policy_module/requirements.txt + +####################################################################################### +FROM ubuntu:22.04 as FINAL + +ARG APT_PROXY +RUN if [ ! -z $APT_PROXY ] ; then \ + echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\ + echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\ + fi + +RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install \ + python3-minimal=3.10.* \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages +COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages + +####################################################################################### +# End of common preparation + +COPY --from=INSTALL /usr/bin/osm* /usr/bin/ +COPY --from=INSTALL /usr/bin/mysql /usr/bin/ +COPY --from=INSTALL /usr/bin/mysqladmin /usr/bin/ +COPY --from=INSTALL /usr/bin/mysqlshow /usr/bin/ +COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libedit.so.2 /usr/lib/x86_64-linux-gnu/ +COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libbsd.so.0 /usr/lib/x86_64-linux-gnu/ +COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmd.so.0 /usr/lib/x86_64-linux-gnu/ + +COPY scripts/ /app/osm_pol/scripts/ + +# Creating the user for the app +RUN groupadd -g 1000 appuser && \ + useradd -u 1000 -g 1000 -d /app appuser && \ + mkdir -p /app/osm_pol && \ + mkdir -p /app/storage/kafka && \ + mkdir /app/log && \ + chown -R appuser:appuser /app + +WORKDIR /app/osm_pol + +# Changing the security context +USER appuser + +######################################################################## + +ENV OSMPOL_MESSAGE_DRIVER kafka +ENV OSMPOL_MESSAGE_HOST kafka +ENV OSMPOL_MESSAGE_PORT 9092 + +ENV OSMPOL_DATABASE_DRIVER mongo +ENV OSMPOL_DATABASE_URI mongodb://mongo:27017 + +ENV OSMPOL_SQL_DATABASE_URI sqlite:///mon_sqlite.db + +ENV OSMPOL_GLOBAL_LOG_LEVEL INFO + +ENV OSMPOL_AUTOHEAL_ENABLED True + +ENV OSMPOL_AUTOSCALE_ENABLED True + +HEALTHCHECK --start-period=120s --interval=10s --timeout=5s --retries=5 \ + CMD osm-pol-healthcheck || exit 1 + +CMD /bin/bash scripts/start.sh diff --git a/docker/POL/scripts/start.sh b/docker/POL/scripts/start.sh new file mode 100644 index 00000000..04d0d34b --- /dev/null +++ b/docker/POL/scripts/start.sh @@ -0,0 +1,55 @@ +DB_EXISTS="" + +max_attempts=120 +function wait_db(){ + db_host=$1 + db_port=$2 + attempt=0 + echo "Wait until $max_attempts seconds for MySQL mano Server ${db_host}:${db_port} " + while ! mysqladmin ping -h"$db_host" -P"$db_port" --silent; do + #wait 120 sec + if [ $attempt -ge $max_attempts ]; then + echo + echo "Can not connect to database ${db_host}:${db_port} during $max_attempts sec" + return 1 + fi + attempt=$[$attempt+1] + echo -n "." + sleep 1 + done + return 0 +} + +function is_db_created() { + db_host=$1 + db_port=$2 + db_user=$3 + db_pswd=$4 + db_name=$5 + + if mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -q $db_name; then + echo "DB $db_name exists" + return 0 + else + echo "DB $db_name does not exist" + return 1 + fi +} + +if [[ $OSMPOL_SQL_DATABASE_URI == *'mysql'* ]]; then + DB_HOST=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@(.+):.*$|\1|') + DB_PORT=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.*:([0-9]+).*$|\1|') + DB_USER=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://(.+):.+@.+$|\1|') + DB_PASSWORD=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://.+:(.+)@.*$|\1|') + DB_NAME=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@.+:.*/(.+)$|\1|') + + wait_db "$DB_HOST" "$DB_PORT" || exit 1 + + is_db_created "$DB_HOST" "$DB_PORT" "$DB_USER" "$DB_PASSWORD" "$DB_NAME" && DB_EXISTS="Y" + + if [ -z $DB_EXISTS ]; then + mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" --default_character_set utf8 -e "CREATE DATABASE $DB_NAME" + fi +fi + +osm-policy-agent \ No newline at end of file diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index a35396f4..9c6ff887 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -37,6 +37,9 @@ function usage(){ echo -e " -S use VCA/juju secret key" echo -e " -P use VCA/juju public key file" echo -e " -A use VCA/juju API proxy" + echo -e " --pla: install the PLA module for placement support" + echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway" + echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)" echo -e " -o : ONLY installs the specified component (k8s_monitor, ng-sa, k8scluster, docker, deploy-osm)" echo -e " -O : install OSM to an OpenStack infrastructure. is required. If a is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/" echo -e " -N : public network name required to setup OSM to OpenStack" @@ -242,10 +245,13 @@ EOF" fi [ -n "$OSM_VCA_APIPROXY" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set lcm.config.OSMLCM_VCA_APIPROXY=${OSM_VCA_APIPROXY}" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.defaultAirflowRepository=${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow" - [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${OSM_DOCKER_TAG}" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.ingress.web.hosts[0].name=airflow.${OSM_K8S_EXTERNAL_IP}.nip.io" - + if [ -n "${INSTALL_NGSA}" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.defaultAirflowRepository=${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow" + [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${OSM_DOCKER_TAG}" + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.ingress.web.hosts[0].name=airflow.${OSM_K8S_EXTERNAL_IP}.nip.io" + else + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.oldServiceAssurance=true --set airflow.enabled=false" + fi if [ -n "${OSM_BEHIND_PROXY}" ]; then OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.behindHttpProxy=true" [ -n "${HTTP_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTP_PROXY=\"${HTTP_PROXY}\"" @@ -271,6 +277,15 @@ EOF" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } +function install_osm_ngsa_service() { + [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + NGSA_OPTS="-i ${OSM_K8S_EXTERNAL_IP} -d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -t ${OSM_DOCKER_TAG} -U ${DOCKER_USER} ${DEBUG_INSTALL}" + [ -n "${DOCKER_REGISTRY_URL}" ] && NGSA_OPTS="${NGSA_OPTS} -r ${DOCKER_REGISTRY_URL}" + $OSM_DEVOPS/installers/install_ngsa.sh ${NGSA_OPTS} || \ + FATAL_TRACK install_osm_ngsa_service "install_ngsa.sh failed" + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function +} + function add_local_k8scluster() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function # OSM_HOSTNAME=$(kubectl get --namespace osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress) @@ -539,7 +554,7 @@ function install_osm() { fi track mgmtcluster mgmt_and_aux_cluster_ok - # Deploy OSM (OSM helm chart) + # Deploy OSM (mongodb, OSM helm chart, NGSA) echo "Deploying OSM in the K8s cluster ..." deploy_osm @@ -655,11 +670,14 @@ function dump_vars(){ echo "INSTALL_JUJU=$INSTALL_JUJU" echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR" echo "INSTALL_LXD=$INSTALL_LXD" + echo "INSTALL_NGSA=$INSTALL_NGSA" echo "INSTALL_DOCKER=$INSTALL_DOCKER" echo "INSTALL_ONLY=$INSTALL_ONLY" echo "INSTALL_ONLY_DEPLOY_OSM=$INSTALL_ONLY_DEPLOY_OSM" echo "INSTALL_ONLY_DOCKER_CE=$INSTALL_ONLY_DOCKER_CE" echo "INSTALL_ONLY_K8S_CLUSTER=$INSTALL_ONLY_K8S_CLUSTER" + echo "INSTALL_ONLY_NGSA=$INSTALL_ONLY_NGSA" + echo "INSTALL_PLA=$INSTALL_PLA" echo "INSTALL_TO_OPENSTACK=$INSTALL_TO_OPENSTACK" echo "INSTALL_VIMEMU=$INSTALL_VIMEMU" echo "OPENSTACK_PUBLIC_NET_NAME=$OPENSTACK_PUBLIC_NET_NAME" @@ -718,6 +736,8 @@ DEBUG_INSTALL="" RELEASE="testing-daily" REPOSITORY="testing" INSTALL_K8S_MONITOR="" +INSTALL_NGSA="y" +INSTALL_PLA="" INSTALL_VIMEMU="" LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd" LXD_REPOSITORY_PATH="" @@ -733,6 +753,7 @@ INSTALL_ONLY="" INSTALL_ONLY_DEPLOY_OSM="" INSTALL_ONLY_DOCKER_CE="" INSTALL_ONLY_K8S_CLUSTER="" +INSTALL_ONLY_NGSA="" INSTALL_DOCKER="" INSTALL_JUJU="" INSTALL_NOHOSTCLIENT="" @@ -810,6 +831,7 @@ while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:G:M:-: hy" o) INSTALL_ONLY="y" [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue + [ "${OPTARG}" == "ng-sa" ] && INSTALL_ONLY_NGSA="y" && continue [ "${OPTARG}" == "docker" ] && INSTALL_ONLY_DOCKER_CE="y" && continue [ "${OPTARG}" == "k8scluster" ] && INSTALL_ONLY_K8S_CLUSTER="y" && continue [ "${OPTARG}" == "deploy-osm" ] && INSTALL_ONLY_DEPLOY_OSM="y" && continue @@ -909,6 +931,9 @@ while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:G:M:-: hy" [ "${OPTARG}" == "ha" ] && continue [ "${OPTARG}" == "tag" ] && continue [ "${OPTARG}" == "registry" ] && continue + [ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue + [ "${OPTARG}" == "old-sa" ] && INSTALL_NGSA="" && continue + [ "${OPTARG}" == "ng-sa" ] && INSTALL_NGSA="y" && continue [ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue [ "${OPTARG}" == "nocachelxdimages" ] && continue [ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="--cachelxdimages" && continue @@ -989,6 +1014,7 @@ else [ -n "$INSTALL_ONLY_K8S_CLUSTER" ] && install_k8s_cluster [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring [ -n "$INSTALL_ONLY_DEPLOY_OSM" ] && deploy_osm + [ -n "$INSTALL_ONLY_NGSA" ] && install_osm_ngsa_service echo -e "\nDONE" && exit 0 fi # This is where installation starts diff --git a/installers/helm/osm/templates/airflow/airflow-secret.yaml b/installers/helm/osm/templates/airflow/airflow-secret.yaml index d373eeb7..10c664be 100644 --- a/installers/helm/osm/templates/airflow/airflow-secret.yaml +++ b/installers/helm/osm/templates/airflow/airflow-secret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.airflow.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -24,4 +25,5 @@ metadata: {{- include "osm.labels" . | nindent 4 }} data: webserver-secret-key: {{ randAlphaNum 32 | b64enc | quote }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/alertmanager/alertmanager-ingress.yaml b/installers/helm/osm/templates/alertmanager/alertmanager-ingress.yaml index 9479d9c7..d8028e84 100644 --- a/installers/helm/osm/templates/alertmanager/alertmanager-ingress.yaml +++ b/installers/helm/osm/templates/alertmanager/alertmanager-ingress.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.alertmanager.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -38,4 +39,5 @@ spec: name: alertmanager port: number: 9093 +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/mon/mon-deployment.yaml b/installers/helm/osm/templates/mon/mon-deployment.yaml index 9ec36340..4473ffaf 100644 --- a/installers/helm/osm/templates/mon/mon-deployment.yaml +++ b/installers/helm/osm/templates/mon/mon-deployment.yaml @@ -57,8 +57,10 @@ spec: {{- toYaml .Values.global.securityContext | nindent 12 }} image: {{ include "osm.mon.image" . }} imagePullPolicy: {{ .Values.global.image.pullPolicy }} + {{- if not .Values.global.oldServiceAssurance }} command: ["/bin/bash"] args: ["scripts/dashboarder-start.sh"] + {{- end }} ports: - containerPort: 8662 protocol: TCP diff --git a/installers/helm/osm/templates/pla/pla-configmap.yaml b/installers/helm/osm/templates/pla/pla-configmap.yaml new file mode 100644 index 00000000..be346a07 --- /dev/null +++ b/installers/helm/osm/templates/pla/pla-configmap.yaml @@ -0,0 +1,30 @@ +{{- if .Values.global.oldServiceAssurance -}} +{{- if .Values.pla.enabled -}} +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "osm.fullname" . }}-pla-configmap + labels: + {{- include "osm.labels" . | nindent 4 }} +data: + OSMPLA_DATABASE_HOST: "mongo" + OSMPLA_MESSAGE_HOST: "kafka" + OSMPLA_GLOBAL_LOG_LEVEL: {{ .Values.pla.logLevel | default .Values.global.logLevel | default "INFO" }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/pla/pla-deployment.yaml b/installers/helm/osm/templates/pla/pla-deployment.yaml new file mode 100644 index 00000000..cb8d85bf --- /dev/null +++ b/installers/helm/osm/templates/pla/pla-deployment.yaml @@ -0,0 +1,88 @@ +{{- if .Values.global.oldServiceAssurance -}} +{{- if .Values.pla.enabled -}} +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pla + labels: + {{- include "osm.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.pla.replicaCount | default .Values.global.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/component: pla + {{- include "osm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.global.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app.kubernetes.io/component: pla + {{- include "osm.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "osm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.global.podSecurityContext | nindent 8 }} + initContainers: + - name: kafka-mongo-test + image: alpine:latest + command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"] + containers: + - name: pla + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + runAsNonRoot: true + {{- toYaml .Values.global.securityContext | nindent 12 }} + image: {{ include "osm.pla.image" . }} + imagePullPolicy: {{ .Values.global.image.pullPolicy }} + resources: + limits: + memory: 1024Mi + requests: + memory: 128Mi + envFrom: + - configMapRef: + name: {{ include "osm.fullname" . }}-pla-configmap + env: + - name: OSMPLA_DATABASE_URI + valueFrom: + secretKeyRef: + name: {{ include "osm.fullname" . }}-secret + key: OSM_DATABASE_URI + {{- with .Values.global.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/pol/pol-configmap.yaml b/installers/helm/osm/templates/pol/pol-configmap.yaml new file mode 100644 index 00000000..8d899bcf --- /dev/null +++ b/installers/helm/osm/templates/pol/pol-configmap.yaml @@ -0,0 +1,30 @@ +{{- if .Values.global.oldServiceAssurance -}} +{{- if .Values.pol.enabled -}} +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "osm.fullname" . }}-pol-configmap + labels: + {{- include "osm.labels" . | nindent 4 }} +data: + OSMPOL_MESSAGE_HOST: "kafka" + OSMPOL_MESSAGE_PORT: "9092" + OSMPOL_GLOBAL_LOG_LEVEL: {{ .Values.pol.logLevel | default .Values.global.logLevel | default "INFO" }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/pol/pol-deployment.yaml b/installers/helm/osm/templates/pol/pol-deployment.yaml new file mode 100644 index 00000000..313b4a67 --- /dev/null +++ b/installers/helm/osm/templates/pol/pol-deployment.yaml @@ -0,0 +1,101 @@ +{{- if .Values.global.oldServiceAssurance -}} +{{- if .Values.pol.enabled -}} +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pol + labels: + {{- include "osm.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.pol.replicaCount | default .Values.global.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/component: pol + {{- include "osm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.global.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app.kubernetes.io/component: pol + {{- include "osm.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "osm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.global.podSecurityContext | nindent 8 }} + initContainers: + - name: kafka-mongo-test + image: alpine:latest + command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"] + containers: + - name: pol + securityContext: + # readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + runAsNonRoot: true + {{- toYaml .Values.global.securityContext | nindent 12 }} + image: {{ include "osm.pol.image" . }} + imagePullPolicy: {{ .Values.global.image.pullPolicy }} + ports: + - containerPort: 8662 + protocol: TCP + resources: + limits: + memory: 1024Mi + requests: + memory: 128Mi + envFrom: + - configMapRef: + name: {{ include "osm.fullname" . }}-pol-configmap + {{- if not .Values.pol.useOsmSecret }} + - secretRef: + name: {{ .Values.pol.secretName | default "pol-secret" }} + {{- else }} + env: + - name: OSMPOL_DATABASE_COMMONKEY + valueFrom: + secretKeyRef: + name: {{ include "osm.fullname" . }}-secret + key: OSM_DATABASE_COMMONKEY + - name: OSMPOL_DATABASE_URI + valueFrom: + secretKeyRef: + name: {{ include "osm.fullname" . }}-secret + key: OSM_DATABASE_URI + {{- end }} + {{- with .Values.global.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.global.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/webhook_translator/webhook-translator-configmap.yaml b/installers/helm/osm/templates/webhook_translator/webhook-translator-configmap.yaml index a266ea7d..f4464137 100644 --- a/installers/helm/osm/templates/webhook_translator/webhook-translator-configmap.yaml +++ b/installers/helm/osm/templates/webhook_translator/webhook-translator-configmap.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.webhookTranslator.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -24,4 +25,5 @@ metadata: data: AIRFLOW_HOST: "airflow-webserver" AIRFLOW_PORT: "8080" +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/webhook_translator/webhook-translator-deployment.yaml b/installers/helm/osm/templates/webhook_translator/webhook-translator-deployment.yaml index 60b2ae83..84a3dba2 100644 --- a/installers/helm/osm/templates/webhook_translator/webhook-translator-deployment.yaml +++ b/installers/helm/osm/templates/webhook_translator/webhook-translator-deployment.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.webhookTranslator.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -78,4 +79,5 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/webhook_translator/webhook-translator-ingress.yaml b/installers/helm/osm/templates/webhook_translator/webhook-translator-ingress.yaml index d803574c..f4e8b649 100644 --- a/installers/helm/osm/templates/webhook_translator/webhook-translator-ingress.yaml +++ b/installers/helm/osm/templates/webhook_translator/webhook-translator-ingress.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.webhookTranslator.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -38,4 +39,5 @@ spec: name: webhook-translator port: number: 9998 +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/webhook_translator/webhook-translator-secret.yaml b/installers/helm/osm/templates/webhook_translator/webhook-translator-secret.yaml index 10f9c6e2..e11022c7 100644 --- a/installers/helm/osm/templates/webhook_translator/webhook-translator-secret.yaml +++ b/installers/helm/osm/templates/webhook_translator/webhook-translator-secret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.webhookTranslator.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -27,4 +28,5 @@ data: AIRFLOW_USER: {{ "admin" | b64enc | quote }} # AIRFLOW_PASS: {{ randAlphaNum 32 | b64enc | quote }} AIRFLOW_PASS: {{ "admin" | b64enc | quote }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/templates/webhook_translator/webhook-translator-service.yaml b/installers/helm/osm/templates/webhook_translator/webhook-translator-service.yaml index 9db63eeb..11d25081 100644 --- a/installers/helm/osm/templates/webhook_translator/webhook-translator-service.yaml +++ b/installers/helm/osm/templates/webhook_translator/webhook-translator-service.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.global.oldServiceAssurance -}} {{- if .Values.webhookTranslator.enabled -}} ####################################################################################### # Copyright ETSI Contributors and Others. @@ -33,4 +34,5 @@ spec: selector: app.kubernetes.io/component: webhook-translator {{- include "osm.selectorLabels" . | nindent 4 }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/values.yaml b/installers/helm/osm/values.yaml index a046b9a3..b1b8b21b 100644 --- a/installers/helm/osm/values.yaml +++ b/installers/helm/osm/values.yaml @@ -88,6 +88,8 @@ global: # HTTPS_PROXY: # NO_PROXY: + oldServiceAssurance: false + airflow: enabled: true config: @@ -401,6 +403,26 @@ ngui: # tag: "testing-daily" # replicaCount: 1 +# pla module is disabled by default unless global.oldServiceAssurance and pla.enabled are set to true +pla: + enabled: false + # logLevel: DEBUG + image: {} + # repository: opensourcemano/pla + # tag: "testing-daily" + # replicaCount: 1 + +# pol module is disabled by default unless global.oldServiceAssurance and pol.enabled are set to true +pol: + enabled: true + # logLevel: DEBUG + image: {} + # repository: opensourcemano/pol + # tag: "testing-daily" + # replicaCount: 1 + useOsmSecret: true + # secretName: "pol-secret" + prometheus: enabled: true configmapReload: diff --git a/installers/helm/values/airflow-values.yaml b/installers/helm/values/airflow-values.yaml new file mode 100644 index 00000000..798648c5 --- /dev/null +++ b/installers/helm/values/airflow-values.yaml @@ -0,0 +1,86 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--- +config: + core: + parallelism: 4 + dag_concurrency: 2 + max_active_tasks_per_dag: 2 + worker_concurrency: 2 + dags_folder: "/home/airflow/.local/lib/python3.10/site-packages/osm_ngsa" +defaultAirflowRepository: opensourcemano/airflow +defaultAirflowTag: "testing-daily" +executor: LocalExecutor +extraEnv: | + - name: AIRFLOW__API__AUTH_BACKENDS + value: 'airflow.api.auth.backend.basic_auth' + - name: AIRFLOW__LOGGING__LOGGING_LEVEL + value: 'INFO' + - name: OSMMON_DATABASE_COMMONKEY + valueFrom: + secretKeyRef: + name: osm-secret + key: OSM_DATABASE_COMMONKEY +# extraEnvFrom: | +# - secretRef: +# name: ngsa-secret +ingress: + web: + enabled: True + hosts: + - name: "localhost" + ingressClassName: nginx +# scheduler: +# resources: +# requests: +# memory: 512Mi +# cpu: 250m +# limits: +# memory: 1Gi +# cpu: 500m +webserverSecretKeySecretName: airflow-webserver-secret +webserver: + resources: + requests: + memory: 256Mi + cpu: 250m + limits: + memory: 1Gi + cpu: 500m + service: + type: ClusterIP + ports: + - name: airflow-ui + port: "{{ .Values.ports.airflowUI }}" + targetPort: "{{ .Values.ports.airflowUI }}" +workers: + persistence: + size: 2Gi + replicas: 1 + resources: + requests: + memory: 512Mi + cpu: 250m + limits: + memory: 1Gi + cpu: 500m + logGroomerSidecar: + retentionDays: 7 + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi diff --git a/installers/install_ngsa.sh b/installers/install_ngsa.sh new file mode 100755 index 00000000..69314327 --- /dev/null +++ b/installers/install_ngsa.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set +eux + +# Helm chart 1.6.0 correspondes to Airflow 2.3.0 +AIRFLOW_HELM_VERSION=1.9.0 + +# Install Airflow helm chart +function install_airflow() { + [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + # 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 + 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 + + helm repo add apache-airflow https://airflow.apache.org + helm repo update + helm upgrade airflow apache-airflow/airflow -n ${OSM_NAMESPACE} --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 +while getopts ":D:d:i:s:t:r:U:-: " o; do + case "${o}" in + i) + DEFAULT_IP="${OPTARG}" + ;; + D) + OSM_DEVOPS="${OPTARG}" + ;; + d) + OSM_HELM_WORK_DIR="${OPTARG}" + ;; + s) + OSM_NAMESPACE="${OPTARG}" + ;; + 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 + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument" >&2 + exit 1 + ;; + \?) + echo -e "Invalid option: '-$OPTARG'\n" >&2 + exit 1 + ;; + *) + exit 1 + ;; + esac +done + +DEBUG_INSTALL=${DEBUG_INSTALL:-} +DEFAULT_IP=${DEFAULT_IP:-"127.0.0.1"} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} +OSM_DOCKER_TAG=${OSM_DOCKER_TAG:-"testing-daily"} +OSM_HELM_WORK_DIR=${OSM_HELM_WORK_DIR:-"/etc/osm/helm"} +OSM_NAMESPACE=${OSM_NAMESPACE:-"osm"} +DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-} +DOCKER_USER=${DOCKER_USER:-"opensourcemano"} +echo "DEBUG_INSTALL=$DEBUG_INSTALL" +echo "DEFAULT_IP=$DEFAULT_IP" +echo "OSM_DEVOPS=$OSM_DEVOPS" +echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" +echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" +echo "OSM_NAMESPACE=$OSM_NAMESPACE" +echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" +echo "DOCKER_USER=$DOCKER_USER" + +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track + +install_airflow +track deploy_osm airflow_ok diff --git a/installers/install_osm.sh b/installers/install_osm.sh index fa200f09..622ff369 100755 --- a/installers/install_osm.sh +++ b/installers/install_osm.sh @@ -41,6 +41,9 @@ function usage(){ echo -e " -S use VCA/juju secret key" echo -e " -P use VCA/juju public key file" echo -e " -A use VCA/juju API proxy" + echo -e " --pla: install the PLA module for placement support" + echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway" + echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)" echo -e " -o : ONLY installs the specified component (k8s_monitor, ng-sa, k8scluster, docker, deploy-osm)" echo -e " -O : install OSM to an OpenStack infrastructure. is required. If a is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/" echo -e " -N : public network name required to setup OSM to OpenStack" diff --git a/installers/uninstall_osm.sh b/installers/uninstall_osm.sh index 1aa9f365..1df64b6f 100755 --- a/installers/uninstall_osm.sh +++ b/installers/uninstall_osm.sh @@ -60,7 +60,7 @@ function uninstall_osm() { echo "Now osm docker images and volumes will be deleted" # TODO: clean-up of images should take into account if other tags were used for specific modules newgrp docker << EONG -for module in ro lcm keystone nbi mon osmclient; do +for module in ro lcm keystone nbi mon pol pla osmclient; do docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${OSM_DOCKER_TAG} done EONG @@ -119,6 +119,7 @@ DEBUG_INSTALL="" RELEASE="ReleaseTEN" REPOSITORY="stable" INSTALL_VIMEMU="" +INSTALL_PLA="" LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd" LXD_REPOSITORY_PATH="" INSTALL_LIGHTWEIGHT="y" @@ -227,6 +228,8 @@ while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; [ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue [ "${OPTARG}" == "RO" ] && TO_REBUILD="$TO_REBUILD RO" && continue [ "${OPTARG}" == "MON" ] && TO_REBUILD="$TO_REBUILD MON" && continue + [ "${OPTARG}" == "POL" ] && TO_REBUILD="$TO_REBUILD POL" && continue + [ "${OPTARG}" == "PLA" ] && TO_REBUILD="$TO_REBUILD PLA" && continue [ "${OPTARG}" == "osmclient" ] && TO_REBUILD="$TO_REBUILD osmclient" && continue [ "${OPTARG}" == "KAFKA" ] && TO_REBUILD="$TO_REBUILD KAFKA" && continue [ "${OPTARG}" == "MONGO" ] && TO_REBUILD="$TO_REBUILD MONGO" && continue @@ -307,6 +310,7 @@ while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; [ "${OPTARG}" == "ha" ] && continue [ "${OPTARG}" == "tag" ] && continue [ "${OPTARG}" == "registry" ] && continue + [ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue [ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue [ "${OPTARG}" == "nocachelxdimages" ] && continue [ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="--cachelxdimages" && continue diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 2f2d2160..dbdcf9a4 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -282,7 +282,7 @@ node("${params.NODE}") { parallelSteps = [:] list = ['RO', 'osmclient', 'IM', 'devops', 'MON', 'N2VC', 'NBI', - 'common', 'LCM', 'NG-UI', 'NG-SA', 'tests'] + 'common', 'LCM', 'POL', 'NG-UI', 'NG-SA', 'PLA', 'tests'] if (upstreamComponent.length() > 0) { println("Skipping upstream fetch of ${upstreamComponent}") list.remove(upstreamComponent) diff --git a/tools/check_changes.sh b/tools/check_changes.sh index e240cd42..09bd65ba 100755 --- a/tools/check_changes.sh +++ b/tools/check_changes.sh @@ -36,7 +36,7 @@ echo "Changes in branch ${BRANCH} from ${FROM_REF} to ${TO_REF} stored in ${OSM_ echo "-----------------------------------------" > "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" -modules="common devops IM LCM MON N2VC NBI NG-SA NG-UI osmclient RO SOL003 SOL005 tests" +modules="common devops IM LCM MON N2VC NBI NG-SA NG-UI osmclient RO PLA POL SOL003 SOL005 tests" for repo in $modules; do echo ${repo} git -C ${OSM_CHANGES_FOLDER} clone "https://osm.etsi.org/gerrit/osm/${repo}" diff --git a/tools/deletetag.sh b/tools/deletetag.sh index 1ffd9393..4581462e 100755 --- a/tools/deletetag.sh +++ b/tools/deletetag.sh @@ -25,7 +25,7 @@ TAG="$2" tag_header="OSM Release TWO:" tag_message="$tag_header version $TAG" -modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO SOL003 SOL005 tests" +modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO PLA POL SOL003 SOL005 tests" list="" for i in $modules; do if [ "$1" == "$i" -o "$1" == "all" ]; then diff --git a/tools/gen-repo.sh b/tools/gen-repo.sh index 337472ca..f5f586e2 100755 --- a/tools/gen-repo.sh +++ b/tools/gen-repo.sh @@ -52,7 +52,7 @@ function dump_vars() { echo "BUILD_NUMBER: $BUILD_NUMBER" } -MDG_REPOS="RO osmclient openvim SO UI IM devops MON N2VC NBI common LW-UI NG-UI NG-SA" +MDG_REPOS="RO osmclient openvim SO UI IM devops MON N2VC NBI common POL PLA LW-UI NG-UI NG-SA" IN_REPO="unstable" OUT_REPO="stable" GPGKEY=71C0472C diff --git a/tools/local-build.sh b/tools/local-build.sh index c7abc727..829649d2 100755 --- a/tools/local-build.sh +++ b/tools/local-build.sh @@ -191,7 +191,7 @@ function run_httpserver() { function stage_2() { print_section "Performing Stage 2" - MODULES="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO tests" + MODULES="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient PLA POL RO tests" if [ ! -z ${1} ] ; then POSSIBLE_MODULES=$(echo ${1} | sed "s/,/ /g") for MODULE in ${POSSIBLE_MODULES}; do diff --git a/tools/newbranch.sh b/tools/newbranch.sh index 411e508d..ccefd998 100755 --- a/tools/newbranch.sh +++ b/tools/newbranch.sh @@ -26,7 +26,7 @@ BRANCH="$2" USER="$3" tag_message="Start of $BRANCH" -modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO SOL003 SOL005 tests" +modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO PLA POL SOL003 SOL005 tests" list="" for i in $modules; do if [ "$1" == "$i" -o "$1" == "all" ]; then diff --git a/tools/newtag.sh b/tools/newtag.sh index 5d412b53..249c2776 100755 --- a/tools/newtag.sh +++ b/tools/newtag.sh @@ -29,7 +29,7 @@ RELEASE_NAME="$5" tag_header="OSM Release $RELEASE_NAME:" tag_message="$tag_header version $TAG" -modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO SOL003 SOL005 tests" +modules="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO PLA POL SOL003 SOL005 tests" list="" for i in $modules; do if [ "$1" == "$i" -o "$1" == "all" ]; then diff --git a/tools/osm-report b/tools/osm-report index 3a43c78f..e18c4b00 100755 --- a/tools/osm-report +++ b/tools/osm-report @@ -42,7 +42,7 @@ echo "which osmclient:" which osm #dockers deb packages echo "dockers deb packages" -for i in kafka keystone lcm mon mongo nbi prometheus ro mysql zookeeper; do +for i in kafka keystone lcm mon mongo nbi pol prometheus ro mysql zookeeper; do echo "docker osm_$i" docker exec $(docker ps -q -f name=osm_$i -l) dpkg -l |grep osm done @@ -50,6 +50,8 @@ done echo "dockers deb packages" echo "MON" docker exec -it $(docker ps -aqf "name=osm_mon" -n 1) dpkg -l |egrep -i "osm|n2vc" +echo "POL" +docker exec -it $(docker ps -aqf "name=osm_pol" -n 1) dpkg -l |egrep -i "osm|n2vc" echo "LCM" docker exec -it $(docker ps -aqf "name=osm_lcm" -n 1) dpkg -l |egrep -i "osm|n2vc" echo "NBI" @@ -75,6 +77,9 @@ docker exec $(docker ps -q -f name=osm_nbi -l) git -C /app/NBI describe --tags - echo "docker osm_mon" docker exec $(docker ps -q -f name=osm_mon -l) git -C /mon rev-parse HEAD docker exec $(docker ps -q -f name=osm_mon -l) git -C /mon describe --tags --long --dirty +echo "docker osm_pol" +docker exec $(docker ps -q -f name=osm_pol -l) git -C /policy_module rev-parse HEAD +docker exec $(docker ps -q -f name=osm_pol -l) git -C /policy_module describe --tags --long --dirty #Get configuration files echo "-------------------------------"