{{ if and (eq .Values.storage.type "elasticsearch") .Values.storage.elasticsearch.usePassword (not .Values.storage.elasticsearch.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "jaeger.fullname" . }}-elasticsearch
  labels:
    {{- include "jaeger.labels" . | nindent 4 }}
  annotations:
    "helm.sh/hook": pre-install,pre-upgrade
    "helm.sh/hook-weight": "-1"
    "helm.sh/hook-delete-policy": before-hook-creation
    "helm.sh/resource-policy": keep
type: Opaque
data:
  password: {{ .Values.storage.elasticsearch.password | b64enc | quote }}
{{- end }}
