[SO] Create OOM changes for SO-CNFM

Including removal of AAf dependency

Signed-off-by: egernug <gerard.nugent@est.tech>
Change-Id: Ib7707bd838d4384622c8f21cd69a73d6ff8f0340
Issue-ID: SO-4066
diff --git a/kubernetes/so/Chart.yaml b/kubernetes/so/Chart.yaml
index 3d5c0c4..3f1f871 100755
--- a/kubernetes/so/Chart.yaml
+++ b/kubernetes/so/Chart.yaml
@@ -1,6 +1,6 @@
 # Copyright © 2017 Amdocs, Bell Canada
 # Modifications Copyright © 2021 Orange
-# Modifications Copyright © 2021 Nordix Foundation
+# Modifications Copyright © 2023 Nordix Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -53,6 +53,10 @@
     version: ~12.x-0
     repository: "file://components/so-cnf-adapter"
     condition: so-cnf-adapter.enabled
+  - name: so-cnfm-lcm
+    version: ~12.x-0
+    repository: 'file://components/so-cnfm-lcm'
+    condition: so-cnfm-lcm.enabled
   - name: so-etsi-nfvo-ns-lcm
     version: ~12.x-0
     repository: 'file://components/so-etsi-nfvo-ns-lcm'
diff --git a/kubernetes/so/components/so-cnfm-lcm/Chart.yaml b/kubernetes/so/components/so-cnfm-lcm/Chart.yaml
new file mode 100644
index 0000000..ad0a799
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/Chart.yaml
@@ -0,0 +1,35 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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: v2
+name: so-cnfm-lcm
+description: ONAP SO CNFM LCM
+version: 12.0.0
+
+dependencies:
+  - name: common
+    version: ~12.x-0
+    # local reference to common chart, as it is
+    # a part of this chart's package and will not
+    # be published independently to a repo (at this point)
+    repository: '@local'
+  - name: repositoryGenerator
+    version: ~12.x-0
+    repository: '@local'
+  - name: soHelpers
+    version: ~12.x-0
+    repository: 'file://../soHelpers'
+  - name: serviceAccount
+    version: ~12.x-0
+    repository: '@local'
diff --git a/kubernetes/so/components/so-cnfm-lcm/resources/config/overrides/override.yaml b/kubernetes/so/components/so-cnfm-lcm/resources/config/overrides/override.yaml
new file mode 100644
index 0000000..411b75f
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/resources/config/overrides/override.yaml
@@ -0,0 +1,53 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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.
+
+aai:
+  auth: {{ .Values.aai.auth }}
+  version: v24
+  endpoint: http://aai.{{ include "common.namespace" . }}:80
+spring:
+  datasource:
+    hikari:
+      camunda:
+        jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+        username: ${DB_USERNAME}
+        password: ${DB_PASSWORD}
+        driver-class-name: org.mariadb.jdbc.Driver
+        pool-name: bpmn-pool
+        registerMbeans: true
+      cnfm:
+        jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/cnfm
+        username: ${DB_ADMIN_USERNAME}
+        password: ${DB_ADMIN_PASSWORD}
+        driver-class-name: org.mariadb.jdbc.Driver
+        pool-name: cnfm-pool
+        registerMbeans: true
+server:
+  port: {{ .Values.containerPort }}
+  tomcat:
+    max-threads: 50
+mso:
+  key: {{ .Values.mso.key }}
+sdc:
+  username: {{ .Values.sdc.username }}
+  password: {{ .Values.sdc.password }}
+  key: {{ .Values.sdc.key }}
+  endpoint: http://sdc-be.{{ include "common.namespace" . }}:8080
+camunda:
+  bpm:
+    history-level: full
+    job-execution:
+      max-pool-size: 30
+      core-pool-size: 3
+      deployment-aware: true
diff --git a/kubernetes/so/components/so-cnfm-lcm/templates/configmap.yaml b/kubernetes/so/components/so-cnfm-lcm/templates/configmap.yaml
new file mode 100644
index 0000000..2d8cb1e
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/templates/configmap.yaml
@@ -0,0 +1,43 @@
+{{/*
+  # Copyright © 2023 Nordix Foundation
+  #
+  # 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 "common.fullname" . }}-configmap
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ include "common.release" . }}
+    heritage: {{ .Release.Service }}
+data:
+  LOG_PATH: {{ index .Values.logPath }}
+  APP: {{ index .Values.app }}
+  ACTIVE_PROFILE: "basic"
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-app-configmap
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ include "common.release" . }}
+    heritage: {{ .Release.Service }}
+data:
+{{ tpl (.Files.Glob "resources/config/overrides/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/so/components/so-cnfm-lcm/templates/deployment.yaml b/kubernetes/so/components/so-cnfm-lcm/templates/deployment.yaml
new file mode 100644
index 0000000..42d5fcf
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/templates/deployment.yaml
@@ -0,0 +1,74 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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: {{- include "common.resourceMetadata" . | nindent 2 }}
+spec:
+  selector: {{- include "common.selectors" . | nindent 4 }}
+  replicas: {{ index .Values.replicaCount }}
+  minReadySeconds: {{ index .Values.minReadySeconds }}
+  strategy:
+    type: {{ index .Values.updateStrategy.type }}
+    rollingUpdate:
+      maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
+      maxSurge: {{ index .Values.updateStrategy.maxSurge }}
+  template:
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
+    spec:
+      containers:
+        - name: {{ include "common.name" . }}
+          command: [ "./start-app.sh" ]
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
+          resources: {{ include "common.resources" . | nindent 12 }}
+          env:
+            - name: DB_HOST
+              value: {{ include "common.mariadbService" . }}
+            - name: DB_PORT
+              value: {{ include "common.mariadbPort" . | quote }}
+            - name: DB_USERNAME
+                {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 14 }}
+            - name: DB_PASSWORD
+                {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 14 }}
+            - name: DB_ADMIN_USERNAME
+                {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 14 }}
+            - name: DB_ADMIN_PASSWORD
+                {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 14 }}
+          envFrom:
+            - configMapRef:
+                name: {{ include "common.fullname" . }}-configmap
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          volumeMounts:
+            - name: logs
+              mountPath: /app/logs
+            - name: config
+              mountPath: /app/config
+              readOnly: true
+          livenessProbe:
+            tcpSocket:
+              port: {{ index .Values.livenessProbe.port }}
+            initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
+            periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
+            successThreshold: {{ index .Values.livenessProbe.successThreshold}}
+            failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
+          ports: {{ include "common.containerPorts" . | nindent 12  }}
+      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
+      volumes:
+        - name: logs
+          emptyDir: {}
+        - name: config
+          configMap:
+            name: {{ include "common.fullname" . }}-app-configmap
+      imagePullSecrets:
+          - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/so/components/so-cnfm-lcm/templates/ingress.yaml b/kubernetes/so/components/so-cnfm-lcm/templates/ingress.yaml
new file mode 100644
index 0000000..30c7b6e
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/templates/ingress.yaml
@@ -0,0 +1,15 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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.
+
+{{ include "common.ingress" . }}
diff --git a/kubernetes/so/components/so-cnfm-lcm/templates/secret.yaml b/kubernetes/so/components/so-cnfm-lcm/templates/secret.yaml
new file mode 100644
index 0000000..e361015
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/templates/secret.yaml
@@ -0,0 +1,15 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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.
+
+{{ include "common.secretFast" . }}
diff --git a/kubernetes/so/components/so-cnfm-lcm/templates/service.yaml b/kubernetes/so/components/so-cnfm-lcm/templates/service.yaml
new file mode 100644
index 0000000..72b8e4b
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/templates/service.yaml
@@ -0,0 +1,15 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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.
+
+{{ include "common.service" . }}
diff --git a/kubernetes/so/components/so-cnfm-lcm/values.yaml b/kubernetes/so/components/so-cnfm-lcm/values.yaml
new file mode 100644
index 0000000..9cb7483
--- /dev/null
+++ b/kubernetes/so/components/so-cnfm-lcm/values.yaml
@@ -0,0 +1,133 @@
+# Copyright © 2023 Nordix Foundation
+#
+# 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.
+
+#################################################################
+# Global configuration defaults.
+#################################################################
+global:
+  persistence:
+    mountPath: /dockerdata-nfs
+  mariadbGalera:
+    serviceName: mariadb-galera
+    servicePort: '3306'
+
+#################################################################
+# Secrets metaconfig
+#################################################################
+secrets:
+  - uid: db-user-creds
+    type: basicAuth
+    externalSecret: '{{ tpl (default "" .Values.db.userCredsExternalSecret) . }}'
+    login: '{{ .Values.db.userName }}'
+    password: '{{ .Values.db.userPassword }}'
+    passwordPolicy: required
+  - uid: db-admin-creds
+    type: basicAuth
+    externalSecret: '{{ tpl (default "" .Values.db.adminCredsExternalSecret) . }}'
+    login: '{{ .Values.db.adminName }}'
+    password: '{{ .Values.db.adminPassword }}'
+    passwordPolicy: required
+
+#################################################################
+# Application configuration defaults.
+#################################################################
+image: onap/so/so-cnfm-as-lcm:1.12.0
+pullPolicy: Always
+
+aai:
+  auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586
+db:
+  userName: so_user
+  userPassword: so_User123
+  # userCredsExternalSecret: some secret
+  adminName: so_admin
+  adminPassword: so_Admin123
+  # adminCredsExternalSecret: some secret
+mso:
+  key: 07a7159d3bf51a0e53be7a8f89699be7
+sdc:
+  username: mso
+  password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F
+  key: 566B754875657232314F5548556D3665
+
+replicaCount: 1
+minReadySeconds: 10
+containerPort: &containerPort 9888
+logPath: ./logs/so-cnfm-lcm/
+app: so-cnfm-lcm
+service:
+  type: ClusterIP
+  ports:
+    - name: http
+      port: *containerPort
+updateStrategy:
+  type: RollingUpdate
+  maxUnavailable: 1
+  maxSurge: 1
+
+#################################################################
+# soHelpers part
+#################################################################
+soHelpers:
+  containerPort: *containerPort
+
+# Resource Limit flavor -By Default using small
+flavor: small
+# Segregation for Different environment (Small and Large)
+resources:
+  small:
+    limits:
+      memory: 4Gi
+      cpu: 2000m
+    requests:
+      memory: 1Gi
+      cpu: 500m
+  large:
+    limits:
+      memory: 8Gi
+      cpu: 4000m
+    requests:
+      memory: 2Gi
+      cpu: 1000m
+  unlimited: {}
+
+livenessProbe:
+  port: *containerPort
+  initialDelaySeconds: 600
+  periodSeconds: 60
+  timeoutSeconds: 10
+  successThreshold: 1
+  failureThreshold: 3
+
+ingress:
+  enabled: false
+  service:
+    - baseaddr: 'so-cnfm-lcm-api'
+      name: 'so-cnfms-lcm'
+      port: *containerPort
+  config:
+    ssl: 'redirect'
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}
+
+#Pods Service Account
+serviceAccount:
+  nameOverride: so-cnfm-lcm
+  roles:
+    - read
+
diff --git a/kubernetes/so/values.yaml b/kubernetes/so/values.yaml
index ce7ee71..014cbad 100755
--- a/kubernetes/so/values.yaml
+++ b/kubernetes/so/values.yaml
@@ -1,6 +1,7 @@
 # Copyright © 2018 AT&T USA
 # Copyright © 2020 Huawei
 # Copyright © 2021 Orange
+# Modifications Copyright © 2023 Nordix Foundation
 # 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
@@ -639,6 +640,11 @@
   mso:
     msoKeySecret: *mso-key
 
+so-cnfm-lcm:
+  enabled: true
+  db:
+    <<: *dbSecrets
+
 so-etsi-nfvo-ns-lcm:
   enabled: true
   db: