Mohammed Naser | 9ad0d46 | 2023-01-15 20:36:37 -0500 | [diff] [blame] | 1 | {{- if and .Values.msgTopologyOperator.metrics.serviceMonitor.enabled .Values.msgTopologyOperator.metrics.enabled }} |
| 2 | apiVersion: monitoring.coreos.com/v1 |
| 3 | kind: ServiceMonitor |
| 4 | metadata: |
| 5 | name: {{ template "rmqco.msgTopologyOperator.fullname" . }} |
| 6 | labels: {{- include "common.labels.standard" . | nindent 4 }} |
| 7 | app.kubernetes.io/component: messaging-topology-operator |
| 8 | app.kubernetes.io/part-of: rabbitmq |
| 9 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.additionalLabels }} |
| 10 | {{- include "common.tplvalues.render" (dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} |
| 11 | {{- end }} |
| 12 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.labels }} |
| 13 | {{- include "common.tplvalues.render" (dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.labels "context" $) | nindent 4 }} |
| 14 | {{- end }} |
| 15 | {{- if .Values.commonLabels }} |
| 16 | {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 17 | {{- end }} |
| 18 | namespace: {{ default (include "common.names.namespace" .) .Values.msgTopologyOperator.metrics.serviceMonitor.namespace | quote }} |
| 19 | {{- if .Values.commonAnnotations }} |
| 20 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 21 | {{- end }} |
| 22 | spec: |
| 23 | jobLabel: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.jobLabel }} |
| 24 | selector: |
| 25 | matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} |
| 26 | app.kubernetes.io/component: messaging-topology-operator |
| 27 | # We need an extra label for the ServiceMonitor to scrape it correctly |
| 28 | type: metrics |
| 29 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.selector }} |
| 30 | {{- include "common.tplvalues.render" ( dict "value" .Values.msgTopologyOperator.metrics.serviceMonitor.selector "context" $ ) | nindent 6 }} |
| 31 | {{- end }} |
| 32 | namespaceSelector: |
| 33 | matchNames: |
| 34 | - {{ include "common.names.namespace" . | quote }} |
| 35 | endpoints: |
| 36 | - port: http |
| 37 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.interval }} |
| 38 | interval: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.interval }} |
| 39 | {{- end }} |
| 40 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.honorLabels }} |
| 41 | honorLabels: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.honorLabels }} |
| 42 | {{- end }} |
| 43 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.scrapeTimeout }} |
| 44 | scrapeTimeout: {{ .Values.msgTopologyOperator.metrics.serviceMonitor.scrapeTimeout }} |
| 45 | {{- end }} |
| 46 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.metricRelabelings }} |
| 47 | metricRelabelings: {{ toYaml .Values.msgTopologyOperator.metrics.serviceMonitor.metricRelabelings | nindent 8 }} |
| 48 | {{- end }} |
| 49 | {{- if .Values.msgTopologyOperator.metrics.serviceMonitor.relabelings }} |
| 50 | relabelings: {{ toYaml .Values.msgTopologyOperator.metrics.serviceMonitor.relabelings | nindent 8 }} |
| 51 | {{- end }} |
| 52 | {{- end }} |