{{- if .Values.setDefaultUser.enabled -}}
apiVersion: v1
kind: Secret
metadata:
  labels:
    app: {{ template "influxdb.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    heritage: "{{ .Release.Service }}"
    release: "{{ .Release.Name }}"
  name: {{ template "influxdb.fullname" . }}-auth
data:
  {{- if .Values.setDefaultUser.user.password }}
  influxdb-password:  {{ .Values.setDefaultUser.user.password | b64enc | quote }}
  {{- else }}
  influxdb-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{- end }}
  influxdb-user: {{ .Values.setDefaultUser.user.username | b64enc | quote }}
{{- end -}}
