[ROBOT] Uses new tpls for repos / images
[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   Name of mariadb user credentials secret
49 */}}
50 {{- define "common.mariadb.secret.userCredentialsSecretName" -}}
51   {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.userCredentialsUID") }}
52 {{- end -}}
53
54 {{/*
55   Choose the name of the mariadb service to use.
56 */}}
57 {{- define "common.mariadbService" -}}
58   {{- if .Values.global.mariadbGalera.localCluster -}}
59     {{- index .Values "mariadb-galera" "service" "name" -}}
60   {{- else -}}
61     {{- .Values.global.mariadbGalera.service -}}
62   {{- end -}}
63 {{- end -}}
64
65 {{/*
66   Choose the value of mariadb port to use.
67 */}}
68 {{- define "common.mariadbPort" -}}
69   {{- if .Values.global.mariadbGalera.localCluster -}}
70     {{- index .Values "mariadb-galera" "service" "internalPort" -}}
71   {{- else -}}
72     {{- .Values.global.mariadbGalera.internalPort -}}
73   {{- end -}}
74 {{- end -}}
75
76 {{/*
77   Choose the value of secret to retrieve user value.
78 */}}
79 {{- define "common.mariadbSecret" -}}
80   {{- if .Values.global.mariadbGalera.localCluster -}}
81     {{ printf "%s-%s-db-user-credentials" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}}
82   {{- else -}}
83     {{ printf "%s-%s-%s" ( include "common.release" .) (index .Values "mariadb-init" "nameOverride") (index .Values "mariadb-init" "config" "mysqlDatabase" ) -}}
84   {{- end -}}
85 {{- end -}}
86
87 {{/*
88   Choose the value of secret param to retrieve user value.
89 */}}
90 {{- define "common.mariadbSecretParam" -}}
91   {{ printf "password" -}}
92 {{- end -}}