{{- if .Values.tls.enabled -}}
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
  labels:
    app: {{ template "mongodb-replicaset.name" . }}
    chart: {{ template "mongodb-replicaset.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels | indent 4 }}
{{- end }}
  name: {{ template "mongodb-replicaset.fullname" . }}-ca
  namespace: {{ template "mongodb-replicaset.namespace" . }}
data:
  tls.key: {{ .Values.tls.cakey }}
  tls.crt: {{ .Values.tls.cacert }}
{{- end -}}
