Merge "[POLICY] Use common secret template in pdp"
[oom.git] / kubernetes / common / elasticsearch / templates / _helpers.tpl
1 # Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 {{/* vim: set filetype=mustache: */}}
15 {{/*
16 Expand the name of the chart.
17 */}}
18
19
20 {{ define "elasticsearch.clustername"}}
21 {{- printf "%s-%s" (include "common.name" .) "cluster" -}}
22 {{- end -}}
23
24 {{/*
25 This define should be used instead of "common.fullname" to allow
26 special handling of kibanaEnabled=true
27 Create a default fully qualified coordinating name.
28 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
29 */}}
30 {{- define "elasticsearch.coordinating.fullname" -}}
31 {{- if .Values.global.kibanaEnabled -}}
32 {{- printf "%s-%s" .Release.Name .Values.global.coordinating.name | trunc 63 | trimSuffix "-" -}}
33 {{- else -}}
34 {{- printf "%s-%s" (include "common.fullname" .) .Values.global.coordinating.name | trunc 63 | trimSuffix "-" -}}
35 {{- end -}}
36 {{- end -}}
37
38 {{/*
39  Create the name of the master service account to use
40  */}}
41 {{- define "elasticsearch.master.serviceAccountName" -}}
42 {{- if .Values.master.serviceAccount.create -}}
43     {{ default (include "common.fullname" (dict "suffix" "master" "dot" .)) .Values.master.serviceAccount.name }}
44 {{- else -}}
45     {{ default "default" .Values.master.serviceAccount.name }}
46 {{- end -}}
47 {{- end -}}
48
49 {{/*
50  Create the name of the coordinating-only service account to use
51  */}}
52 {{- define "elasticsearch.serviceAccountName" -}}
53 {{- if .Values.serviceAccount.create -}}
54     {{ default (include "common.fullname" . ) .Values.serviceAccount.name }}
55 {{- else -}}
56     {{ default "default" .Values.serviceAccount.name }}
57 {{- end -}}
58 {{- end -}}
59
60 {{/*
61  Create the name of the data service account to use
62  */}}
63 {{- define "elasticsearch.data.serviceAccountName" -}}
64 {{- if .Values.serviceAccount.create -}}
65     {{ default (include "common.fullname" (dict "suffix" "data" "dot" .)) .Values.data.serviceAccount.name }}
66 {{- else -}}
67     {{ default "default" .Values.serviceAccount.name }}
68 {{- end -}}
69 {{- end -}}
70
71
72 {{/*
73 Return the proper Docker Image Registry Secret Names
74 */}}
75 {{- define "elasticsearch.imagePullSecrets" -}}
76 {{- if .Values.global }}
77 {{- if .Values.global.imagePullSecrets }}
78 imagePullSecrets:
79 {{- range .Values.global.imagePullSecrets }}
80   - name: {{ . }}
81 {{- end }}
82 {{- end }}
83 {{- else }}
84 {{- $imagePullSecrets := coalesce .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.curator.image.pullSecrets .Values.sysctlImage.pullSecrets .Values.volumePermissions.image.pullSecrets -}}
85 {{- if $imagePullSecrets }}
86 imagePullSecrets:
87 {{- range $imagePullSecrets }}
88   - name: {{ . }}
89 {{- end -}}
90 {{- end -}}
91 {{- end -}}
92 {{- end -}}
93
94 {{/*
95 Create the name of the service account to use
96 */}}
97 {{- define "elasticsearch.curator.serviceAccountName" -}}
98 {{- if .Values.curator.serviceAccount.create -}}
99     {{ default (include "common.fullname" (dict "suffix" "currator" "dot" .)) .Values.curator.serviceAccount.name }}
100 {{- else -}}
101     {{ default "default" .Values.curator.serviceAccount.name }}
102 {{- end -}}
103 {{- end -}}