{{- if .Values.podMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ include "pod-cleaner.fullname" . }} labels: {{- include "pod-cleaner.labels" . | nindent 4 }} spec: selector: matchLabels: {{- include "pod-cleaner.labels" . | nindent 6 }} podMetricsEndpoints: - port: {{ include "pod-cleaner.metrics.portName" . | quote }} path: {{ .Values.podMonitor.path | quote }} {{- if .Values.podMonitor.tlsConfig }} scheme: "https" tlsConfig: {{- toYaml .Values.podMonitor.tlsConfig | trim | nindent 8 }} {{- end }} interval: {{ .Values.podMonitor.interval }} scrapeTimeout: {{ .Values.podMonitor.scrapeTimeout }} namespaceSelector: matchNames: - {{ .Release.Namespace }} {{- if .Values.podMonitor.additionalLabels }} jobLabel: {{- toYaml .Values.podMonitor.additionalLabels | trim | nindent 4 }} {{- end }} {{- end }}