apiVersion: v1
kind: Secret
metadata:
  name: {{ template "elasticsearch.fullname" . }}
  labels:
    app: {{ template "elasticsearch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
type: Opaque
data:
  {{ if .Values.env.esPassword }}
  esPassword:  {{ .Values.env.esPassword | b64enc | quote }}
  {{ else }}
  esPassword: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end }}
