Merge "[DCAEGEN2] Upgrade vescollector to 1.9.2"
[oom.git] / kubernetes / common / common / templates / _mariadb.tpl
index cd7142f..5021c50 100644 (file)
 # limitations under the License.
 */}}
 
+{{/*
+  UID of mariadb root password
+*/}}
+{{- define "common.mariadb.secret.rootPassUID" -}}
+  {{- printf "db-root-password" }}
+{{- end -}}
+
+{{/*
+  Name of mariadb secret
+*/}}
+{{- define "common.mariadb.secret._secretName" -}}
+  {{- $global := .dot }}
+  {{- $chartName := tpl .chartName $global -}}
+  {{- include "common.secret.genName" (dict "global" $global "uid" (include .uidTemplate $global) "chartName" $chartName) }}
+{{- end -}}
+
+{{/*
+  Name of mariadb root password secret
+*/}}
+{{- define "common.mariadb.secret.rootPassSecretName" -}}
+  {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.rootPassUID") }}
+{{- end -}}
+
+{{/*
+  UID of mariadb user credentials
+*/}}
+{{- define "common.mariadb.secret.userCredentialsUID" -}}
+  {{- printf "db-user-credentials" }}
+{{- end -}}
+
+{{/*
+  UID of mariadb backup credentials
+*/}}
+{{- define "common.mariadb.secret.backupCredentialsUID" -}}
+  {{- printf "db-backup-credentials" }}
+{{- end -}}
+
+{{/*
+  Name of mariadb user credentials secret
+*/}}
+{{- define "common.mariadb.secret.userCredentialsSecretName" -}}
+  {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.userCredentialsUID") }}
+{{- end -}}
+
 {{/*
   Choose the name of the mariadb service to use.
 */}}
 {{- define "common.mariadbService" -}}
   {{- if .Values.global.mariadbGalera.localCluster -}}
-    {{- index .Values "mariadb-galera" "service" "name" -}}
+    {{- index .Values "mariadb-galera" "nameOverride" -}}
   {{- else -}}
     {{- .Values.global.mariadbGalera.service -}}
   {{- end -}}
@@ -41,9 +85,9 @@
 */}}
 {{- define "common.mariadbSecret" -}}
   {{- if .Values.global.mariadbGalera.localCluster -}}
-    {{ printf "%s-%s" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}}
+    {{ printf "%s-%s-db-user-credentials" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}}
   {{- else -}}
-    {{ printf "%s-%s" (.Release.Name) (index .Values "mariadb-init" "nameOverride") -}}
+    {{ printf "%s-%s-%s" ( include "common.release" .) (index .Values "mariadb-init" "nameOverride") (index .Values "mariadb-init" "config" "mysqlDatabase" ) -}}
   {{- end -}}
 {{- end -}}
 
@@ -51,9 +95,5 @@
   Choose the value of secret param to retrieve user value.
 */}}
 {{- define "common.mariadbSecretParam" -}}
-  {{- if .Values.global.mariadbGalera.localCluster -}}
-    {{ printf "user-password" -}}
-  {{- else -}}
-    {{ printf "db-user-password" -}}
-  {{- end -}}
+  {{ printf "password" -}}
 {{- end -}}