{{- if .Values.prometheus.monitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ template "prometheus-node-exporter.fullname" . }}
  namespace: {{ template "prometheus-node-exporter.namespace" . }}
  labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
  {{- if .Values.prometheus.monitor.additionalLabels }}
{{ toYaml .Values.prometheus.monitor.additionalLabels | indent 4 }}
  {{- end }}
spec:
  selector:
    matchLabels:
      app: {{ template "prometheus-node-exporter.name" . }}
      release: {{ .Release.Name }}
  endpoints:
    - port: metrics
      {{- if .Values.prometheus.monitor.scrapeTimeout }}
      scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }}
      {{- end }}
{{- end }}
