RIC-919 Upgrade influxdb helm chart v1.8 > v2.2
[ric-plt/ric-dep.git] / helm / 3rdparty / influxdb / templates / secret.yaml
1 {{- if not (.Values.adminUser.existingSecret) -}}
2 apiVersion: v1
3 kind: Secret
4 metadata:
5   labels:
6     {{- include "influxdb.labels" . | nindent 4 }}
7   {{- $name := printf "%s-auth" (include "influxdb.fullname" .) }}
8   name: {{ $name }}
9 data:
10   {{- $previous := lookup "v1" "Secret" .Release.Namespace $name }}
11
12   {{- if $previous }}
13   admin-token: {{ index $previous.data "admin-token" }}
14   {{- else if .Values.adminUser.token }}
15   admin-token: {{ .Values.adminUser.token  | b64enc | quote }}
16   {{- else }}
17   admin-token: {{ randAlphaNum 32 | b64enc | quote }}
18   {{- end }}
19
20   {{- if $previous }}
21   admin-password: {{ index $previous.data "admin-password" }}
22   {{- else if .Values.adminUser.password }}
23   admin-password: {{ .Values.adminUser.password | b64enc | quote }}
24   {{- else }}
25   admin-password: {{ randAlphaNum 32 | b64enc | quote }}
26   {{- end }}
27 {{- end -}}