Andreas Geissler | cde4a78 | 2024-02-28 16:08:06 +0100 | [diff] [blame] | 1 | {{- /* |
| 2 | Copyright VMware, Inc. |
| 3 | SPDX-License-Identifier: APACHE-2.0 |
| 4 | */}} |
| 5 | |
| 6 | {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} |
| 7 | apiVersion: monitoring.coreos.com/v1 |
| 8 | kind: ServiceMonitor |
| 9 | metadata: |
| 10 | name: {{ include "mongodb.fullname" . }} |
| 11 | namespace: {{ include "mongodb.serviceMonitor.namespace" . }} |
| 12 | {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.serviceMonitor.labels .Values.commonLabels ) "context" . ) }} |
| 13 | labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} |
| 14 | app.kubernetes.io/component: metrics |
| 15 | {{- if .Values.commonAnnotations }} |
| 16 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 17 | {{- end }} |
| 18 | spec: |
| 19 | {{- if .Values.metrics.serviceMonitor.jobLabel }} |
| 20 | jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }} |
| 21 | {{- end }} |
| 22 | selector: |
| 23 | matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} |
| 24 | {{- if .Values.metrics.serviceMonitor.selector }} |
| 25 | {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }} |
| 26 | {{- end }} |
| 27 | app.kubernetes.io/component: metrics |
| 28 | endpoints: |
| 29 | - port: http-metrics |
| 30 | {{- if .Values.metrics.serviceMonitor.interval }} |
| 31 | interval: {{ .Values.metrics.serviceMonitor.interval }} |
| 32 | {{- end }} |
| 33 | {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} |
| 34 | scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} |
| 35 | {{- end }} |
| 36 | {{- if .Values.metrics.serviceMonitor.relabelings }} |
| 37 | relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }} |
| 38 | {{- end }} |
| 39 | {{- if .Values.metrics.serviceMonitor.metricRelabelings }} |
| 40 | metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }} |
| 41 | {{- end }} |
| 42 | {{- if .Values.metrics.serviceMonitor.honorLabels }} |
| 43 | honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} |
| 44 | {{- end }} |
| 45 | namespaceSelector: |
| 46 | matchNames: |
| 47 | - "{{ include "mongodb.namespace" . }}" |
| 48 | {{- end }} |