Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / common / common / templates / _mariadb.tpl
1 {{/*
2 # Copyright © 2019 Orange
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 {{/*
18   UID of mariadb root password
19 */}}
20 {{- define "common.mariadb.secret.rootPassUID" -}}
21   {{- printf "db-root-password" }}
22 {{- end -}}
23
24 {{/*
25   Name of mariadb secret
26 */}}
27 {{- define "common.mariadb.secret._secretName" -}}
28   {{- $global := .dot }}
29   {{- $chartName := tpl .chartName $global -}}
30   {{- include "common.secret.genName" (dict "global" $global "uid" (include .uidTemplate $global) "chartName" $chartName) }}
31 {{- end -}}
32
33 {{/*
34   Name of mariadb root password secret
35 */}}
36 {{- define "common.mariadb.secret.rootPassSecretName" -}}
37   {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.rootPassUID") }}
38 {{- end -}}
39
40 {{/*
41   UID of mariadb user credentials
42 */}}
43 {{- define "common.mariadb.secret.userCredentialsUID" -}}
44   {{- printf "db-user-credentials" }}
45 {{- end -}}
46
47 {{/*
48   UID of mariadb backup credentials
49 */}}
50 {{- define "common.mariadb.secret.backupCredentialsUID" -}}
51   {{- printf "db-backup-credentials" }}
52 {{- end -}}
53
54 {{/*
55   Name of mariadb user credentials secret
56 */}}
57 {{- define "common.mariadb.secret.userCredentialsSecretName" -}}
58   {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.userCredentialsUID") }}
59 {{- end -}}
60
61 {{/*
62   Choose the name of the mariadb service to use.
63 */}}
64 {{- define "common.mariadbService" -}}
65   {{- if .Values.global.mariadbGalera.localCluster -}}
66     {{- index .Values "mariadb-galera" "nameOverride" -}}
67   {{- else -}}
68     {{- .Values.global.mariadbGalera.service -}}
69   {{- end -}}
70 {{- end -}}
71
72 {{/*
73   Choose the value of mariadb port to use.
74 */}}
75 {{- define "common.mariadbPort" -}}
76   {{- if .Values.global.mariadbGalera.localCluster -}}
77     {{- index .Values "mariadb-galera" "service" "internalPort" -}}
78   {{- else -}}
79     {{- .Values.global.mariadbGalera.internalPort -}}
80   {{- end -}}
81 {{- end -}}
82
83 {{/*
84   Choose the value of secret to retrieve user value.
85 */}}
86 {{- define "common.mariadbSecret" -}}
87   {{- if .Values.global.mariadbGalera.localCluster -}}
88     {{ printf "%s-%s-db-user-credentials" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}}
89   {{- else -}}
90     {{ printf "%s-%s-%s" ( include "common.release" .) (index .Values "mariadb-init" "nameOverride") (index .Values "mariadb-init" "config" "mysqlDatabase" ) -}}
91   {{- end -}}
92 {{- end -}}
93
94 {{/*
95   Choose the value of secret param to retrieve user value.
96 */}}
97 {{- define "common.mariadbSecretParam" -}}
98   {{ printf "password" -}}
99 {{- end -}}