{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "airflow.fullname" . }}-exporter
  labels:
    app.kubernetes.io/name: {{ include "airflow.name" . }}
    helm.sh/chart: {{ include "airflow.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/component: metrics
spec:
  type: ClusterIP
  ports:
    - name: metrics
      port: 9112
      targetPort: metrics
  selector:
    app.kubernetes.io/name: {{ include "airflow.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: metrics
{{- end }}