| Giorgi Lekveishvili | 8c99d62 | 2023-05-30 14:40:50 +0400 | [diff] [blame] | 1 | {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled (eq .Values.architecture "replication") }} |
| 2 | apiVersion: monitoring.coreos.com/v1 |
| 3 | kind: ServiceMonitor |
| 4 | metadata: |
| 5 | name: {{ include "postgresql.readReplica.fullname" . }} |
| 6 | namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }} |
| 7 | labels: {{- include "common.labels.standard" . | nindent 4 }} |
| 8 | app.kubernetes.io/component: metrics-read |
| 9 | {{- if .Values.metrics.serviceMonitor.labels }} |
| 10 | {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }} |
| 11 | {{- end }} |
| 12 | {{- if .Values.commonLabels }} |
| 13 | {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 14 | {{- end }} |
| 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" . | 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-read |
| 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 6 }} |
| 38 | {{- end }} |
| 39 | {{- if .Values.metrics.serviceMonitor.metricRelabelings }} |
| 40 | metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 6 }} |
| 41 | {{- end }} |
| 42 | {{- if .Values.metrics.serviceMonitor.honorLabels }} |
| 43 | honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} |
| 44 | {{- end }} |
| 45 | namespaceSelector: |
| 46 | matchNames: |
| 47 | - {{ .Release.Namespace | quote }} |
| 48 | {{- end }} |