blob: a45fd0628b4c7ea7c5a8541f789905014bad96fc [file] [log] [blame]
{{- if not (.Values.adminUser.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "influxdb.labels" . | nindent 4 }}
{{- $name := printf "%s-auth" (include "influxdb.fullname" .) }}
name: {{ $name }}
data:
{{- $previous := lookup "v1" "Secret" .Release.Namespace $name }}
{{- if $previous }}
admin-token: {{ index $previous.data "admin-token" }}
{{- else if .Values.adminUser.token }}
admin-token: {{ .Values.adminUser.token | b64enc | quote }}
{{- else }}
admin-token: {{ randAlphaNum 32 | b64enc | quote }}
{{- end }}
{{- if $previous }}
admin-password: {{ index $previous.data "admin-password" }}
{{- else if .Values.adminUser.password }}
admin-password: {{ .Values.adminUser.password | b64enc | quote }}
{{- else }}
admin-password: {{ randAlphaNum 32 | b64enc | quote }}
{{- end }}
{{- end -}}