{{- if .Values.metrics.enabled }}
{{- if .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "rawfile-localpv.fullname" . }}-node
  labels:
    {{- include "rawfile-localpv.labels" . | nindent 4 }}
spec:
  endpoints:
  - port: metrics
    path: /metrics
    {{- with .Values.metrics.serviceMonitor.interval }}
    interval: {{ . }}
    {{- end }}
  jobLabel: "helm.sh/chart"
  namespaceSelector:
    matchNames:
      - {{ .Release.Namespace }}
  selector:
    matchLabels:
      {{- include "rawfile-localpv.selectorLabels" . | nindent 6 }}
      component: node
{{- end }}
{{- end }}
