Revert "Feature 11060: Remove POL and PLA modules from OSM helm chart"

This reverts commit 07367db6ef025e4fbb872b32a1f42737d2a563ec.

Change-Id: Ifa86312a16c4841603316f38ee5ffbdb4e6cc39f
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/helm/osm/templates/airflow/airflow-secret.yaml b/installers/helm/osm/templates/airflow/airflow-secret.yaml
index d373eeb..10c664b 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 @@
     {{- 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 9479d9c..d8028e8 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 @@
             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 9ec3634..4473ffa 100644
--- a/installers/helm/osm/templates/mon/mon-deployment.yaml
+++ b/installers/helm/osm/templates/mon/mon-deployment.yaml
@@ -57,8 +57,10 @@
             {{- 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 0000000..be346a0
--- /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 0000000..cb8d85b
--- /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 0000000..8d899bc
--- /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 0000000..313b4a6
--- /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 a266ea7..f446413 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 @@
 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 60b2ae8..84a3dba 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 @@
       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 d803574..f4e8b64 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 @@
             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 10f9c6e..e11022c 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 @@
   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 9db63ee..11d2508 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 @@
   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 a046b9a..b1b8b21 100644
--- a/installers/helm/osm/values.yaml
+++ b/installers/helm/osm/values.yaml
@@ -88,6 +88,8 @@
     # HTTPS_PROXY: <HTTPS_PROXY>
     # NO_PROXY: <NO_PROXY>
 
+  oldServiceAssurance: false
+
 airflow:
   enabled: true
   config:
@@ -401,6 +403,26 @@
     # 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 0000000..798648c
--- /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