# A headless service for client applications to use
apiVersion: v1
kind: Service
metadata:
  annotations:
  {{- if .Values.serviceAnnotations }}
{{ toYaml .Values.serviceAnnotations | indent 4 }}
  {{- end }}
  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" . }}-client
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - name: mongodb
      port: {{ .Values.port }}
{{- if .Values.metrics.enabled }}
    - name: metrics
      port: {{ .Values.metrics.port }}
      targetPort: metrics
{{- end }}
  selector:
    app: {{ template "mongodb-replicaset.name" . }}
    release: {{ .Release.Name }}

