# helm_charts_svc-headless-rs.yaml
{{- if .Values.replicaSet.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "mongodb.fullname" . }}-headless
  labels:
    app: {{ template "mongodb.name" . }}
    chart: {{ template "mongodb.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
{{- with .Values.service.annotations }}
  annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
  type: ClusterIP
  clusterIP: None
  ports:
  - name: mongodb
    port: {{ .Values.service.port }}
  selector:
    app: {{ template "mongodb.name" . }}
    release: {{ .Release.Name }}
{{- end }}