{{- if .Values.metrics.serviceMonitor.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "node-problem-detector.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "node-problem-detector.name" . }}
    helm.sh/chart: {{ include "node-problem-detector.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app: {{ include "node-problem-detector.name" . }}
  namespace: {{ .Release.Namespace }}
spec:
  type: ClusterIP
  clusterIP: None
  ports:
  - name: exporter
    port: {{ .Values.settings.prometheus_port }}
    protocol: TCP
  selector:
    app: {{ include "node-problem-detector.name" . }}
{{- end }}
