feat: move podmonitor to template in advance of depreciation

This commit is contained in:
2026-05-17 20:22:44 -05:00
parent f5d11d2420
commit 8d095b58f9
6 changed files with 31 additions and 15 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v2 apiVersion: v2
name: postgres-cluster name: postgres-cluster
version: 7.12.1 version: 7.13.0
description: Cloudnative-pg Cluster description: Cloudnative-pg Cluster
keywords: keywords:
- database - database
+2 -1
View File
@@ -1,6 +1,6 @@
# postgres-cluster # postgres-cluster
![Version: 7.12.1](https://img.shields.io/badge/Version-7.12.1-informational?style=flat-square) ![AppVersion: v1.29.0](https://img.shields.io/badge/AppVersion-v1.29.0-informational?style=flat-square) ![Version: 7.13.0](https://img.shields.io/badge/Version-7.13.0-informational?style=flat-square) ![AppVersion: v1.29.0](https://img.shields.io/badge/AppVersion-v1.29.0-informational?style=flat-square)
Cloudnative-pg Cluster Cloudnative-pg Cluster
@@ -42,6 +42,7 @@ Cloudnative-pg Cluster
| cluster.monitoring.podMonitor.enabled | bool | `true` | Whether to enable the PodMonitor | | cluster.monitoring.podMonitor.enabled | bool | `true` | Whether to enable the PodMonitor |
| cluster.monitoring.podMonitor.metricRelabelings | list | `[]` | The list of metric relabelings for the PodMonitor. Applied to samples before ingestion. | | cluster.monitoring.podMonitor.metricRelabelings | list | `[]` | The list of metric relabelings for the PodMonitor. Applied to samples before ingestion. |
| cluster.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. | | cluster.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. |
| cluster.monitoring.prometheusRule | object | `{"enabled":true,"excludeRules":["CNPGClusterLastFailedArchiveTimeWarning"]}` | Prometheus rule |
| cluster.monitoring.prometheusRule.enabled | bool | `true` | Whether to enable the PrometheusRule automated alerts | | cluster.monitoring.prometheusRule.enabled | bool | `true` | Whether to enable the PrometheusRule automated alerts |
| cluster.monitoring.prometheusRule.excludeRules | list | `["CNPGClusterLastFailedArchiveTimeWarning"]` | Exclude specified rules | | cluster.monitoring.prometheusRule.excludeRules | list | `["CNPGClusterLastFailedArchiveTimeWarning"]` | Exclude specified rules |
| cluster.postgresUID | int | `-1` | The UID and GID of the postgres user inside the image, defaults to 26 | | cluster.postgresUID | int | `-1` | The UID and GID of the postgres user inside the image, defaults to 26 |
+8 -13
View File
@@ -35,7 +35,7 @@ spec:
{{- with .Values.cluster.resources }} {{- with .Values.cluster.resources }}
resources: resources:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{ end }} {{- end }}
{{- with .Values.cluster.affinity }} {{- with .Values.cluster.affinity }}
affinity: affinity:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
@@ -43,7 +43,6 @@ spec:
{{- if .Values.cluster.priorityClassName }} {{- if .Values.cluster.priorityClassName }}
priorityClassName: {{ .Values.cluster.priorityClassName }} priorityClassName: {{ .Values.cluster.priorityClassName }}
{{- end }} {{- end }}
primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }} primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }}
primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }} primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }}
logLevel: {{ .Values.cluster.logLevel }} logLevel: {{ .Values.cluster.logLevel }}
@@ -57,7 +56,6 @@ spec:
name: {{ . }} name: {{ . }}
{{ end }} {{ end }}
enablePDB: {{ .Values.cluster.enablePDB }} enablePDB: {{ .Values.cluster.enablePDB }}
postgresql: postgresql:
{{- if .Values.cluster.postgresql.shared_preload_libraries }} {{- if .Values.cluster.postgresql.shared_preload_libraries }}
shared_preload_libraries: shared_preload_libraries:
@@ -85,7 +83,6 @@ spec:
parameters: parameters:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if not (and (empty .Values.cluster.roles) (empty .Values.cluster.services)) }} {{- if not (and (empty .Values.cluster.roles) (empty .Values.cluster.services)) }}
managed: managed:
{{- with .Values.cluster.services }} {{- with .Values.cluster.services }}
@@ -97,14 +94,12 @@ spec:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{ end }} {{ end }}
{{- end }} {{- end }}
{{- with .Values.cluster.serviceAccountTemplate }} {{- with .Values.cluster.serviceAccountTemplate }}
serviceAccountTemplate: serviceAccountTemplate:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
monitoring: monitoring:
enablePodMonitor: {{ and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.podMonitor.enabled }} enablePodMonitor: false
disableDefaultQueries: {{ .Values.cluster.monitoring.disableDefaultQueries }} disableDefaultQueries: {{ .Values.cluster.monitoring.disableDefaultQueries }}
{{- if not (empty .Values.cluster.monitoring.customQueries) }} {{- if not (empty .Values.cluster.monitoring.customQueries) }}
customQueriesConfigMap: customQueriesConfigMap:
@@ -127,9 +122,9 @@ spec:
{{- with .Values.cluster.monitoring.podMonitor.metricRelabelings }} {{- with .Values.cluster.monitoring.podMonitor.metricRelabelings }}
podMonitorMetricRelabelings: podMonitorMetricRelabelings:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{ end }}
{{- end }} {{- end }}
{{- end }}
{{- if not (empty .Values.backup.objectStore) -}}
plugins: plugins:
{{- range $objectStore := .Values.backup.objectStore }} {{- range $objectStore := .Values.backup.objectStore }}
- name: barman-cloud.cloudnative-pg.io - name: barman-cloud.cloudnative-pg.io
@@ -146,7 +141,7 @@ spec:
{{- else }} {{- else }}
serverName: "{{ include "cluster.name" $ }}-backup-{{ $objectStore.index }}" serverName: "{{ include "cluster.name" $ }}-backup-{{ $objectStore.index }}"
{{- end }} {{- end }}
{{- end }} {{- end -}}
{{- end -}}
{{ include "cluster.bootstrap" . | nindent 2 }} {{- include "cluster.bootstrap" . | nindent 2 -}}
{{ include "cluster.externalClusters" . | nindent 2 }} {{- include "cluster.externalClusters" . | nindent 2 -}}
@@ -0,0 +1,18 @@
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.podMonitor.enabled -}}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "cluster.name" $ }}
namespace: {{ include "cluster.namespace" $ }}
labels:
app.kubernetes.io/name: {{ include "cluster.name" $ }}
{{- include "cluster.labels" $ | nindent 4 }}
spec:
selector:
matchLabels:
cnpg.io/cluster: {{ include "cluster.name" $ }}
cnpg.io/podRole: instance
podMetricsEndpoints:
- port: metrics
{{- end -}}
@@ -1,4 +1,5 @@
{{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.prometheusRule.enabled -}} {{- if and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.prometheusRule.enabled -}}
---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule kind: PrometheusRule
metadata: metadata:
+1
View File
@@ -127,6 +127,7 @@ cluster:
# Applied to samples before ingestion. # Applied to samples before ingestion.
metricRelabelings: [] metricRelabelings: []
# -- Prometheus rule
prometheusRule: prometheusRule:
# -- Whether to enable the PrometheusRule automated alerts # -- Whether to enable the PrometheusRule automated alerts