apiVersion: v1
kind: Secret
metadata:
  name: {{ template "rabbitmq.fullname" . }}
  labels:
    app: {{ template "rabbitmq.name" . }}
    chart: {{ template "rabbitmq.chart" .  }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
  {{ if .Values.rabbitmq.password }}
  rabbitmq-password: {{ .Values.rabbitmq.password | b64enc | quote }}
  {{ else }}
  rabbitmq-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end }}
  {{ if .Values.rabbitmq.erlangCookie }}
  rabbitmq-erlang-cookie: {{ .Values.rabbitmq.erlangCookie | b64enc | quote }}
  {{ else }}
  rabbitmq-erlang-cookie: {{ randAlphaNum 32 | b64enc | quote }}
  {{ end }}
