[OOF] Use the common mariadb-galera instance 02/121902/10
authorMahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Sun, 13 Jun 2021 12:21:42 +0000 (14:21 +0200)
committerMahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Mon, 21 Jun 2021 10:06:29 +0000 (10:06 +0000)
Updates for OOF CMSO:
- Add section under (.Values.global) for shared mariadb instance with a
condition to instantiate local instance.
- Use a hook to send mariadb info to oof-csmo-service and
oof-csmo-optimizer
- Add condition under (requirments.yaml) to install local mariadb
instance
- Update oof-cmso-service and oof-cmso-optimizer (.Values) files to
accomodate for local mariadb instance
- Update oof-cmso-service and oof-cmso-optimizer deployments to use the
templates defined under (templates/_mariadb.tpl)

Issue-ID: OOM-2769
Signed-off-by: Mahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Change-Id: I59e6c98ae992faafd363c5f97e18bf631f9c4d4e

kubernetes/oof/components/oof-cmso/components/oof-cmso-optimizer/templates/deployment.yaml
kubernetes/oof/components/oof-cmso/components/oof-cmso-optimizer/values.yaml
kubernetes/oof/components/oof-cmso/components/oof-cmso-service/templates/deployment.yaml
kubernetes/oof/components/oof-cmso/components/oof-cmso-service/values.yaml
kubernetes/oof/components/oof-cmso/requirements.yaml
kubernetes/oof/components/oof-cmso/values.yaml

index 08af62d..2050fe6 100644 (file)
@@ -41,7 +41,7 @@ spec:
         - /app/ready.py
         args:
         - --container-name
-        - {{ .Values.config.db.container }}
+        - {{ include "common.mariadbService" . }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -77,9 +77,9 @@ spec:
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
+          value: {{ include "common.mariadbService" . }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db.port | quote}}
+          value: {{ include "common.mariadbPort" . | quote}}
         - name: DB_USERNAME
           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
         - name: DB_SCHEMA
@@ -99,9 +99,9 @@ spec:
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
+          value: {{ include "common.mariadbService" . }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db.port | quote}}
+          value: {{ include "common.mariadbPort" . | quote}}
         - name: DB_USERNAME
           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
         - name: DB_SCHEMA
index c9de654..3bee34a 100644 (file)
@@ -19,6 +19,7 @@
 global: # global defaults
   nodePortPrefix: 302
   readinessImage: onap/oom/readiness:3.0.1
+  mariadbGalera: {}
 
 subChartsOnly:
   enabled: true
@@ -85,6 +86,7 @@ service:
   # as of 20181022 port 23 is reserved for cmso
   # see https://wiki.onap.org/display/DW/OOM+NodePort+List
 
+mariadb-galera: {}
 
 config:
   aaf:
@@ -92,7 +94,6 @@ config:
     password: pass
 #    userCredentialsExternalSecret: some-secret
   db:
-    port: 3306
 #    rootPassword: pass
 #    rootPasswordExternalSecret: some secret
     user: cmso-admin
index 3fd0112..d82040b 100644 (file)
@@ -41,7 +41,7 @@ spec:
         - /app/ready.py
         args:
         - --container-name
-        - {{ .Values.config.db.container }}
+        - {{ include "common.mariadbService" . }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -77,9 +77,9 @@ spec:
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
+          value: {{ include "common.mariadbService" . }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db.port | quote}}
+          value: {{ include "common.mariadbPort" . | quote}}
         - name: DB_USERNAME
           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
         - name: DB_SCHEMA
@@ -113,9 +113,9 @@ spec:
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
+          value: {{ include "common.mariadbService" . }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db.port | quote}}
+          value: {{ include "common.mariadbPort" . | quote}}
         - name: DB_USERNAME
           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
         - name: DB_SCHEMA
index 105163e..3eb94ea 100644 (file)
@@ -18,6 +18,7 @@
 #################################################################
 global: # global defaults
   nodePortPrefix: 302
+  mariadbGalera: {}
 
 subChartsOnly:
   enabled: true
@@ -83,6 +84,7 @@ service:
   # as of 20181022 port 23 is reserved for cmso
   # see https://wiki.onap.org/display/DW/OOM+NodePort+List
 
+mariadb-galera: {}
 
 config:
   aaf:
@@ -90,7 +92,6 @@ config:
     password: pass
 #    userCredentialsExternalSecret: some-secret
   db:
-    port: 3306
 #    rootPassword: pass
 #    rootPasswordExternalSecret: some secret
     user: cmso-admin
index 535a1e1..30946c6 100644 (file)
@@ -23,6 +23,7 @@ dependencies:
   - name: mariadb-galera
     version: ~8.x-0
     repository: '@local'
+    condition: global.mariadbGalera.localCluster
   - name: mariadb-init
     version: ~8.x-0
     repository: '@local'
index c46fd0a..15aac51 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+global:
+  commonConfigPrefix: "oof-cmso"
+  truststoreFile: "truststoreONAPall.jks"
+  keystoreFile: "org.onap.oof.jks"
+  truststorePassword:
+  authentication: aaf-auth
+  mariadbGalera: &mariadbGalera
+    #This flag allows OOF-CMSO to instantiate its own mariadb-galera cluster
+    localCluster: false
+    service: mariadb-galera
+    internalPort: 3306
+    nameOverride: mariadb-galera
+
 #################################################################
 # Secrets metaconfig
 #################################################################
@@ -42,7 +55,7 @@ secrets:
     login: '{{ .Values.config.aaf.user }}'
     password: '{{ .Values.config.aaf.password }}'
 
-mariadb-galera:
+mariadb-galera: &localMariadb
   replicaCount: 1
   nameOverride: &dbName cmso-db
   nfsprovisionerPrefix: cmso
@@ -56,19 +69,7 @@ mariadb-galera:
   serviceAccount:
     nameOverride: *dbName
 
-global:
-  commonConfigPrefix: "oof-cmso"
-  truststoreFile: "truststoreONAPall.jks"
-  keystoreFile: "org.onap.oof.jks"
-  truststorePassword:
-  authentication: aaf-auth
-
 mariadb-init:
-  mariadbGalera:
-    containerName: *dbName
-    serviceName: *dbName
-    servicePort: 3306
-    userRootSecret: *rootPassword
   config:
     userCredentialsExternalSecret: *serviceDbCreds
     mysqlDatabase: cmso
@@ -117,11 +118,10 @@ oof-cmso-service:
   certInitializer:
     << : *certInitConfig
     nameOverride: oof-cmso-service-cert-initializer
+  mariadb-galera: *localMariadb
   config:
     db:
       userCredentialsExternalSecret: *serviceDbCreds
-      host: *dbName
-      container: *dbName
       mysqlDatabase: cmso
     aaf:
       userCredentialsExternalSecret: *aafCreds
@@ -131,12 +131,11 @@ oof-cmso-optimizer:
   certInitializer:
     << : *certInitConfig
     nameOverride: oof-cmso-optimizer-cert-initializer
+  mariadb-galera: *localMariadb
   config:
     enabled: true
     db:
       userCredentialsExternalSecret: *optimizerDbCreds
-      host: *dbName
-      container: *dbName
       mysqlDatabase: optimizer
     aaf:
       userCredentialsExternalSecret: *aafCreds