{{- if and .Values.exporter.enabled .Values.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "keydb.fullname" . }} labels: {{- include "keydb.labels" . | nindent 4 }} {{- if .Values.serviceMonitor.labels }} {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} {{- end }} {{- if .Values.serviceMonitor.annotations }} annotations: {{- toYaml .Values.serviceMonitor.annotations | nindent 4 }} {{- end }} spec: selector: matchLabels: {{- include "keydb.labels" . | nindent 6 }} namespaceSelector: matchNames: - {{.Release.Namespace }} endpoints: - port: redis-exporter path: {{ .Values.exporter.scrapePath }} {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} {{- if .Values.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- end }} {{- end }}