{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "iperf3-monitor.fullname" . }}-sm
  labels:
    {{- include "iperf3-monitor.labels" . | nindent 4 }}
    release: prometheus-operator # Standard label for Prometheus Operator discovery
    app.kubernetes.io/component: exporter
spec:
  selector:
    matchLabels:
      {{- include "iperf3-monitor.selectorLabels" . | nindent 6 }}
      app.kubernetes.io/component: exporter
  endpoints:
    - port: metrics
      interval: {{ .Values.serviceMonitor.interval }}
      scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
      path: /metrics
{{- end -}}