# This is a ServicMonitor for the MySQL operator itself. # To scrape the operator, we need https://github.com/bitpoke/mysql-operator/issues/151 first. {{- if .Values.serviceMonitor.enabled }} {{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "mysql-operator.fullname" . }} labels: {{- include "mysql-operator.labels" . | nindent 4 }} {{- if .Values.serviceMonitor.additionalLabels }} {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }} {{- end }} spec: selector: matchLabels: {{- include "mysql-operator.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: operator {{- with .Values.serviceMonitor.jobLabel }} jobLabel: {{ . | quote}} {{- end }} {{- with .Values.serviceMonitor.targetLabels }} targetLabels: {{ toYaml . | trim | indent 4 -}} {{- end }} {{- with .Values.serviceMonitor.podTargetLabels }} podTargetLabels: {{ toYaml . | trim | indent 4 -}} {{- end }} endpoints: - path: /metrics port: {{ .Values.serviceMonitor.servicePortName }} {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} {{- if .Values.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- end }} {{- if .Values.serviceMonitor.metricRelabelings }} metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 8 }} {{- end }} {{- end }} {{- end }}