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