Files
charts/bitnami/cloudnative-pg/templates/plugin-barman-cloud/servicemonitor.yaml
Javier J. Salmerón García 0e71cda783 [bitnami/cloudnative-pg] feat!: 💥 Refactor and add barman (#34509)
* [bitnami/cloudnative-pg] feat!: 💥  Refactor and add barman

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* chore: 🔧 Update tag

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* feat:  Add monitoring queries configmap

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

* chore:  Revert change in redis

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

* chore: 💡 Add origin for monitoring queries

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* fix: 🐛 Remove duplicate namespace

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>

---------

Signed-off-by: Javier J. Salmerón García <javier.salmeron@broadcom.com>
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Co-authored-by: Bitnami Bot <bitnami.bot@broadcom.com>
2025-06-17 12:37:17 +00:00

55 lines
3.5 KiB
YAML

{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.pluginBarmanCloud.metrics.enabled .Values.pluginBarmanCloud.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "cloudnative-pg.plugin-barman-cloud.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.pluginBarmanCloud.metrics.serviceMonitor.namespace | quote }}
{{- /* Updating app.kubernetes.io/name because to avoid "duplicate deployment" error: https://github.com/cloudnative-pg/cloudnative-pg/blob/9c2769815ff78cbfc28e2a2818f3a04add33477c/pkg/certs/operator_deployment.go#L120 */}}
{{- $appNameLabels := dict "app.kubernetes.io/name" "plugin-barman-cloud" }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list $appNameLabels .Values.pluginBarmanCloud.metrics.serviceMonitor.labels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: cloudnative-pg
app.kubernetes.io/component: metrics
{{- if or .Values.pluginBarmanCloud.metrics.serviceMonitor.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.pluginBarmanCloud.metrics.serviceMonitor.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.pluginBarmanCloud.metrics.serviceMonitor.jobLabel | quote }}
{{- $appNameLabels := dict "app.kubernetes.io/name" "plugin-barman-cloud" }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list $appNameLabels .Values.commonLabels) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $labels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: cloudnative-pg
app.kubernetes.io/component: metrics
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.pluginBarmanCloud.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
endpoints:
- port: http-metrics
path: "/metrics"
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.interval }}
interval: {{ .Values.pluginBarmanCloud.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.pluginBarmanCloud.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.pluginBarmanCloud.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.pluginBarmanCloud.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.pluginBarmanCloud.metrics.serviceMonitor.relabelings }}
relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.pluginBarmanCloud.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . | quote }}
{{- end }}