| {{- if and .Values.msgTopologyOperator.metrics.serviceMonitor.enabled .Values.msgTopologyOperator.metrics.enabled }} |
| apiVersion: monitoring.coreos.com/v1 |
| kind: ServiceMonitor |
| metadata: |
| name: {{ template "rmqco.msgTopologyOperator.fullname" . }} |
| labels: {{- include "common.labels.standard" . | nindent 4 }} |
| app.kubernetes.io/component: messaging-topology-operator |
| app.kubernetes.io/part-of: rabbitmq |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.additionalLabels }} |
| {{- include "common.tplvalues.render" (dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} |
| {{- end }} |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.labels }} |
| {{- include "common.tplvalues.render" (dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.labels "context" $) | nindent 4 }} |
| {{- end }} |
| {{- if .Values.commonLabels }} |
| {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| {{- end }} |
| namespace: {{ default (include "common.names.namespace" .) .Values.msgTopologyOperator.metrics.serviceMonitor.namespace | quote }} |
| {{- if .Values.commonAnnotations }} |
| annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| {{- end }} |
| spec: |
| jobLabel: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.jobLabel }} |
| selector: |
| matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} |
| app.kubernetes.io/component: messaging-topology-operator |
| # We need an extra label for the ServiceMonitor to scrape it correctly |
| type: metrics |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.selector }} |
| {{- include "common.tplvalues.render" ( dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.selector "context" $ ) | nindent 6 }} |
| {{- end }} |
| namespaceSelector: |
| matchNames: |
| - {{ include "common.names.namespace" . | quote }} |
| endpoints: |
| - port: http |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.interval }} |
| interval: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.interval }} |
| {{- end }} |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.honorLabels }} |
| honorLabels: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.honorLabels }} |
| {{- end }} |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.scrapeTimeout }} |
| scrapeTimeout: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.scrapeTimeout }} |
| {{- end }} |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.metricRelabelings }} |
| metricRelabelings: {{ toYaml .Values.msgTopologyOperator.metrics.serviceMonitor.metricRelabelings | nindent 8 }} |
| {{- end }} |
| {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.relabelings }} |
| relabelings: {{ toYaml .Values.msgTopologyOperator.metrics.serviceMonitor.relabelings | nindent 8 }} |
| {{- end }} |
| {{- end }} |