[COMMON] Update MariaDB readinessChecks to fix Operator issues
[oom.git] / kubernetes / policy / values.yaml
index 9027e49..9d08080 100755 (executable)
 # Global configuration defaults.
 #################################################################
 global:
-  mariadb:
+  mariadbGalera:
+    # flag to enable the DB creation via mariadb-operator
+    useOperator: true
+    # if useOperator set to "true", set "enableServiceAccount to "false"
+    # as the SA is created by the Operator
+    enableServiceAccount: false
     localCluster: true
     # '&mariadbConfig' means we "store" the values for  later use in the file
     # with '*mariadbConfig' pointer.
@@ -27,6 +32,9 @@ global:
     service: &mariadbService
       name: &policy-mariadb policy-mariadb
       internalPort: 3306
+    nameOverride: *policy-mariadb
+    # (optional) if localCluster=false and an external secret is used set this variable
+    #userRootSecret: <secretName>
   prometheusEnabled: false
   postgres:
     localCluster: false
@@ -53,7 +61,19 @@ secrets:
   - uid: db-root-password
     name: &dbRootPassSecretName '{{ include "common.release" . }}-policy-db-root-password'
     type: password
-    externalSecret: '{{ ternary "" (tpl (default "" (index .Values "mariadb-galera" "rootUser" "externalSecret")) .) (hasSuffix "policy-db-root-password" (index .Values "mariadb-galera" "rootUser" "externalSecret"))}}'
+    externalSecret: '{{ .Values.global.mariadbGalera.localCluster |
+      ternary (( hasSuffix "policy-db-root-password" (index .Values "mariadb-galera" "rootUser" "externalSecret")) |
+               ternary
+                  ""
+                  (tpl (default "" (index .Values "mariadb-galera" "rootUser" "externalSecret")) .)
+               )
+               ( (not (empty (default "" .Values.global.mariadbGalera.userRootSecret))) |
+                 ternary
+                   .Values.global.mariadbGalera.userRootSecret
+                   (include "common.mariadb.secret.rootPassSecretName"
+                     (dict "dot" . "chartName" .Values.global.mariadbGalera.nameOverride)
+                   )
+               ) }}'
     password: '{{ (index .Values "mariadb-galera" "rootUser" "password") }}'
     policy: generate
   - uid: db-secret
@@ -153,7 +173,7 @@ policy-gui:
 #################################################################
 
 dbmigrator:
-  image: onap/policy-db-migrator:2.6.2
+  image: onap/policy-db-migrator:3.1.0
   schema: policyadmin
   policy_home: "/opt/app/policy"
 
@@ -210,18 +230,21 @@ config:
   someConfig: blah
 
 mariadb-galera:
-  # mariadb-galera.config and global.mariadb.config must be equals
+  # mariadb-galera.config and global.mariadbGalera.config must be equals
   db:
-    user: policy_user
+    user: policy-user
     # password:
     externalSecret: *dbSecretName
     name: &mysqlDbName policyadmin
   rootUser:
     externalSecret: *dbRootPassSecretName
   nameOverride: *policy-mariadb
-  # mariadb-galera.service and global.mariadb.service must be equals
+  # mariadb-galera.service and global.mariadbGalera.service must be equals
   service: *mariadbService
   replicaCount: 1
+  mariadbOperator:
+    galera:
+      enabled: false
   persistence:
     enabled: true
     mountSubPath: policy/maria/data
@@ -244,7 +267,7 @@ postgres:
     mountSubPath: policy/postgres/data
     mountInitPath: policy
   config:
-    pgUserName: policy_user
+    pgUserName: policy-user
     pgDatabase: policyadmin
     pgUserExternalSecret: *dbSecretName
     pgRootPasswordExternalSecret: *dbRootPassSecretName
@@ -252,6 +275,18 @@ postgres:
 readinessCheck:
   wait_for:
     - '{{ ternary .Values.postgres.service.name "postgres" .Values.global.postgres.localCluster }}'
+  wait_for_global_operator:
+    pods:
+      - '{{ .Values.global.mariadbGalera.nameOverride }}-0'
+  wait_for_local_operator:
+    pods:
+      - '{{ index .Values "mariadb-galera" "nameOverride" }}-0'
+  wait_for_global:
+    apps:
+      - '{{ include "common.mariadbAppName" . }}'
+  wait_for_local:
+    apps:
+      - '{{ include "common.mariadbAppName" . }}'
 
 restServer:
   policyPapUserName: policyadmin
@@ -265,18 +300,18 @@ flavor: small
 resources:
   small:
     limits:
-      cpu: 1
-      memory: 4Gi
+      cpu: "1"
+      memory: "4Gi"
     requests:
-      cpu: 100m
-      memory: 1Gi
+      cpu: "100m"
+      memory: "1Gi"
   large:
     limits:
-      cpu: 2
-      memory: 8Gi
+      cpu: "2"
+      memory: "8Gi"
     requests:
-      cpu: 200m
-      memory: 2Gi
+      cpu: "200m"
+      memory: "2Gi"
   unlimited: {}
 
 #Pods Service Account