{{- if and .Values.auth.tls.enabled (not .Values.auth.tls.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "rabbitmq.fullname" . }}-certs
  namespace: {{ .Release.Namespace }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
type: kubernetes.io/tls
data:
  ca.crt:
    {{ required "A valid .Values.auth.tls.caCertificate entry required!" .Values.auth.tls.caCertificate | b64enc | quote }}
  tls.crt:
    {{ required "A valid .Values.auth.tls.serverCertificate entry required!" .Values.auth.tls.serverCertificate| b64enc | quote }}
  tls.key:
    {{ required "A valid .Values.auth.tls.serverKey entry required!" .Values.auth.tls.serverKey | b64enc | quote }}
{{- end }}
