{{- if .Values.updater.podMonitor }}
{{- if and .Values.updater.enabled .Values.updater.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: {{ include "vpa.fullname" . }}-updater
  {{- with .Values.updater.podMonitor.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- with .Values.updater.podMonitor.labels }}
  labels:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  namespaceSelector:
    matchNames:
    - {{ .Release.Namespace }}
  podMetricsEndpoints:
  - interval: 30s
    path: /metrics
    port: metrics
  selector:
    matchLabels:
      app.kubernetes.io/component: updater
      {{- include "vpa.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end }}