{{- if .Values.prometheus.enable }}
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: {{ include "node-feature-discovery.fullname" . }}
  labels:
    {{- include "node-feature-discovery.selectorLabels" . | nindent 4 }}
    {{- with .Values.prometheus.labels }}
    {{ toYaml . | nindent 4 }}
    {{- end }}
spec:
  podMetricsEndpoints:
    - honorLabels: true
      interval: {{ .Values.prometheus.scrapeInterval }}
      path: /metrics
      port: http
      scheme: http
  namespaceSelector:
    matchNames:
    - {{ include "node-feature-discovery.namespace" . }}
  selector:
    matchExpressions:
    - {key: app.kubernetes.io/instance, operator: In, values: ["{{ .Release.Name }}"]}
    - {key: app.kubernetes.io/name, operator: In, values: ["{{ include "node-feature-discovery.name" . }}"]}
{{- end }}
