apiVersion: v1
kind: Service
metadata:
  name: {{ template "prometheus-postgres-exporter.fullname" . }}
  {{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
  labels:
    app: {{ template "prometheus-postgres-exporter.name" . }}
    chart: {{ template "prometheus-postgres-exporter.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | trim | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: {{ .Values.service.targetPort }}
      protocol: TCP
      name: {{ .Values.service.name }}
  selector:
    app: {{ template "prometheus-postgres-exporter.name" . }}
    release: {{ .Release.Name }}
