From 6728e0ef8cbce9d073249d7ce618fa46f5998cb9 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Tue, 7 Nov 2023 16:45:45 +0100 Subject: [PATCH] fix(cnpg): update cnpg helm chart for recent cnpg changes (#14425) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Kjeld Schouten --- charts/operators/cloudnative-pg/Chart.yaml | 2 +- .../_mutatingwebhookconfiguration.tpl | 6 +- .../_validatingwebhookconfiguration.tpl | 8 +- charts/operators/cloudnative-pg/values.yaml | 489 +++++++++--------- 4 files changed, 262 insertions(+), 243 deletions(-) diff --git a/charts/operators/cloudnative-pg/Chart.yaml b/charts/operators/cloudnative-pg/Chart.yaml index 761db41ea73..75bfe801e93 100644 --- a/charts/operators/cloudnative-pg/Chart.yaml +++ b/charts/operators/cloudnative-pg/Chart.yaml @@ -23,7 +23,7 @@ sources: - https://github.com/cloudnative-pg - https://cloudnative-pg.io/ type: application -version: 2.0.8 +version: 2.0.9 annotations: truecharts.org/category: operators truecharts.org/SCALE-support: "true" diff --git a/charts/operators/cloudnative-pg/templates/_mutatingwebhookconfiguration.tpl b/charts/operators/cloudnative-pg/templates/_mutatingwebhookconfiguration.tpl index 8c3d90f10fb..073df3dba78 100644 --- a/charts/operators/cloudnative-pg/templates/_mutatingwebhookconfiguration.tpl +++ b/charts/operators/cloudnative-pg/templates/_mutatingwebhookconfiguration.tpl @@ -27,7 +27,7 @@ webhooks: path: /mutate-postgresql-cnpg-io-v1-backup port: 443 failurePolicy: {{ .Values.webhook.mutating.failurePolicy }} - name: mbackup.kb.io + name: mbackup.cnpg.io rules: - apiGroups: - postgresql.cnpg.io @@ -48,7 +48,7 @@ webhooks: path: /mutate-postgresql-cnpg-io-v1-cluster port: 443 failurePolicy: {{ .Values.webhook.mutating.failurePolicy }} - name: mcluster.kb.io + name: mcluster.cnpg.io rules: - apiGroups: - postgresql.cnpg.io @@ -69,7 +69,7 @@ webhooks: path: /mutate-postgresql-cnpg-io-v1-scheduledbackup port: 443 failurePolicy: {{ .Values.webhook.mutating.failurePolicy }} - name: mscheduledbackup.kb.io + name: mscheduledbackup.cnpg.io rules: - apiGroups: - postgresql.cnpg.io diff --git a/charts/operators/cloudnative-pg/templates/_validatingwebhookconfiguration.tpl b/charts/operators/cloudnative-pg/templates/_validatingwebhookconfiguration.tpl index e16d46ee015..581be43d758 100644 --- a/charts/operators/cloudnative-pg/templates/_validatingwebhookconfiguration.tpl +++ b/charts/operators/cloudnative-pg/templates/_validatingwebhookconfiguration.tpl @@ -27,7 +27,7 @@ webhooks: path: /validate-postgresql-cnpg-io-v1-backup port: 9443 failurePolicy: {{ .Values.webhook.validating.failurePolicy }} - name: vbackup.kb.io + name: vbackup.cnpg.io rules: - apiGroups: - postgresql.cnpg.io @@ -48,7 +48,7 @@ webhooks: path: /validate-postgresql-cnpg-io-v1-cluster port: 443 failurePolicy: {{ .Values.webhook.validating.failurePolicy }} - name: vcluster.kb.io + name: vcluster.cnpg.io rules: - apiGroups: - postgresql.cnpg.io @@ -69,7 +69,7 @@ webhooks: path: /validate-postgresql-cnpg-io-v1-scheduledbackup port: 443 failurePolicy: {{ .Values.webhook.validating.failurePolicy }} - name: vscheduledbackup.kb.io + name: vscheduledbackup.cnpg.io rules: - apiGroups: - postgresql.cnpg.io @@ -90,7 +90,7 @@ webhooks: path: /validate-postgresql-cnpg-io-v1-pooler port: 443 failurePolicy: {{ .Values.webhook.validating.failurePolicy }} - name: vpooler.kb.io + name: vpooler.cnpg.io rules: - apiGroups: - postgresql.cnpg.io diff --git a/charts/operators/cloudnative-pg/values.yaml b/charts/operators/cloudnative-pg/values.yaml index f9aa8f62030..1793741304a 100644 --- a/charts/operators/cloudnative-pg/values.yaml +++ b/charts/operators/cloudnative-pg/values.yaml @@ -97,326 +97,336 @@ rbac: clusterWide: true rules: - apiGroups: - - "" + - "" resources: - - configmaps + - configmaps verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - "" + - "" resources: - - configmaps/status + - configmaps/status verbs: - - get - - patch - - update + - get + - patch + - update - apiGroups: - - "" + - "" resources: - - events + - events verbs: - - create - - patch + - create + - patch - apiGroups: - - "" + - "" resources: - - namespaces + - namespaces verbs: - - get - - list - - watch + - get + - list + - watch - apiGroups: - - "" + - "" resources: - - nodes + - nodes verbs: - - get - - list - - watch + - get + - list + - watch - apiGroups: - - "" + - "" resources: - - persistentvolumeclaims + - persistentvolumeclaims verbs: - - create - - delete - - get - - list - - patch - - watch + - create + - delete + - get + - list + - patch + - watch - apiGroups: - - "" + - "" resources: - - pods + - pods verbs: - - create - - delete - - get - - list - - patch - - watch + - create + - delete + - get + - list + - patch + - watch - apiGroups: - - "" + - "" resources: - - pods/exec + - pods/exec verbs: - - create - - delete - - get - - list - - patch - - watch + - create + - delete + - get + - list + - patch + - watch - apiGroups: - - "" + - "" resources: - - pods/status + - pods/status verbs: - - get + - get - apiGroups: - - "" + - "" resources: - - secrets + - secrets verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - "" + - "" resources: - - secrets/status + - secrets/status verbs: - - get - - patch - - update + - get + - patch + - update - apiGroups: - - "" + - "" resources: - - serviceaccounts + - serviceaccounts verbs: - - create - - get - - list - - patch - - update - - watch + - create + - get + - list + - patch + - update + - watch - apiGroups: - - "" + - "" resources: - - services + - services verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - admissionregistration.k8s.io + - admissionregistration.k8s.io resources: - - mutatingwebhookconfigurations + - mutatingwebhookconfigurations verbs: - - get - - list - - patch - - update + - get + - list + - patch + - update - apiGroups: - - admissionregistration.k8s.io + - admissionregistration.k8s.io resources: - - validatingwebhookconfigurations + - validatingwebhookconfigurations verbs: - - get - - list - - patch - - update + - get + - list + - patch + - update - apiGroups: - - apiextensions.k8s.io + - apiextensions.k8s.io resources: - - customresourcedefinitions + - customresourcedefinitions verbs: - - get - - list - - update + - get + - list + - update - apiGroups: - - apps + - apps resources: - - deployments + - deployments verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - batch + - batch resources: - - jobs + - jobs verbs: - - create - - delete - - get - - list - - patch - - watch + - create + - delete + - get + - list + - patch + - watch - apiGroups: - - coordination.k8s.io + - coordination.k8s.io resources: - - leases + - leases verbs: - - create - - get - - update + - create + - get + - update - apiGroups: - - monitoring.coreos.com + - monitoring.coreos.com resources: - - podmonitors + - podmonitors verbs: - - create - - delete - - get - - list - - patch - - watch + - create + - delete + - get + - list + - patch + - watch - apiGroups: - - policy + - policy resources: - - poddisruptionbudgets + - poddisruptionbudgets verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - backups + - backups verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - backups/status + - backups/status verbs: - - get - - patch - - update + - get + - patch + - update - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - clusters + - clusters verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - clusters/finalizers + - clusters/finalizers verbs: - - update + - update - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - clusters/status + - clusters/status verbs: - - get - - patch - - update - - watch + - get + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - poolers + - poolers verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - poolers/finalizers + - poolers/finalizers verbs: - - update + - update - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - poolers/status + - poolers/status verbs: - - get - - patch - - update - - watch + - get + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - scheduledbackups + - scheduledbackups verbs: - - create - - delete - - get - - list - - patch - - update - - watch + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - - postgresql.cnpg.io + - postgresql.cnpg.io resources: - - scheduledbackups/status + - scheduledbackups/status verbs: - - get - - patch - - update + - get + - patch + - update - apiGroups: - - rbac.authorization.k8s.io + - rbac.authorization.k8s.io resources: - - rolebindings + - rolebindings verbs: - - create - - get - - list - - patch - - update - - watch + - create + - get + - list + - patch + - update + - watch - apiGroups: - - rbac.authorization.k8s.io + - rbac.authorization.k8s.io resources: - - roles + - roles verbs: - - create - - get - - list - - patch - - update - - watch + - create + - get + - list + - patch + - update + - watch + - apiGroups: + - snapshot.storage.k8s.io + resources: + - volumesnapshots + verbs: + - create + - get + - list + - patch + - watch serviceAccount: main: @@ -488,7 +498,7 @@ configmap: - max_tx_duration_seconds: usage: "GAUGE" description: "Maximum duration of a transaction in seconds" - + backends_waiting: query: | SELECT count(*) AS total @@ -511,7 +521,7 @@ configmap: - total: usage: "GAUGE" description: "Total number of backends that are currently waiting on other queries" - + pg_database: query: | SELECT datname @@ -532,7 +542,7 @@ configmap: - mxid_age: usage: "GAUGE" description: "Number of multiple transactions (Multixact) from the frozen XID to the current one" - + pg_postmaster: query: | SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time @@ -541,16 +551,18 @@ configmap: - start_time: usage: "GAUGE" description: "Time at which postgres started (based on epoch)" - + pg_replication: - query: "SELECT CASE WHEN NOT pg_catalog.pg_is_in_recovery() + query: "SELECT CASE WHEN ( + NOT pg_catalog.pg_is_in_recovery() + OR pg_catalog.pg_last_wal_receive_lsn() = pg_catalog.pg_last_wal_replay_lsn()) THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_catalog.pg_last_xact_replay_timestamp()))) END AS lag, pg_catalog.pg_is_in_recovery() AS in_recovery, EXISTS (TABLE pg_stat_wal_receiver) AS is_wal_receiver_up, - (SELECT count(*) FROM pg_stat_replication) AS streaming_replicas" + (SELECT count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas" metrics: - lag: usage: "GAUGE" @@ -564,14 +576,17 @@ configmap: - streaming_replicas: usage: "GAUGE" description: "Number of streaming replicas connected to the instance" - + pg_replication_slots: query: | SELECT slot_name, slot_type, database, active, - pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn) + (CASE pg_catalog.pg_is_in_recovery() + WHEN TRUE THEN pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_receive_lsn(), restart_lsn) + ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn) + END) as pg_wal_lsn_diff FROM pg_catalog.pg_replication_slots WHERE NOT temporary metrics: @@ -590,7 +605,7 @@ configmap: - pg_wal_lsn_diff: usage: "GAUGE" description: "Replication lag in bytes" - + pg_stat_archiver: query: | SELECT archived_count @@ -631,7 +646,7 @@ configmap: - stats_reset_time: usage: "GAUGE" description: "Time at which these statistics were last reset" - + pg_stat_bgwriter: query: | SELECT checkpoints_timed @@ -676,7 +691,7 @@ configmap: - buffers_alloc: usage: "COUNTER" description: "Number of buffers allocated" - + pg_stat_database: query: | SELECT datname @@ -745,13 +760,14 @@ configmap: - blk_write_time: usage: "COUNTER" description: "Time spent writing data file blocks by backends in this database, in milliseconds" - + pg_stat_replication: primary: true query: | SELECT usename , COALESCE(application_name, '') AS application_name , COALESCE(client_addr::text, '') AS client_addr + , COALESCE(client_port::text, '') AS client_port , EXTRACT(EPOCH FROM backend_start) AS backend_start , COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes @@ -772,6 +788,9 @@ configmap: - client_addr: usage: "LABEL" description: "Client IP address" + - client_port: + usage: "LABEL" + description: "Client TCP port" - backend_start: usage: "COUNTER" description: "Time when this process was started" @@ -799,7 +818,7 @@ configmap: - replay_lag_seconds: usage: "GAUGE" description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it" - + pg_settings: query: | SELECT name,