diff --git a/charts/paradedb/README.md b/charts/paradedb/README.md index b09a76f467..76daecdd2d 100644 --- a/charts/paradedb/README.md +++ b/charts/paradedb/README.md @@ -269,6 +269,7 @@ Kubernetes: `>=1.29.0-0` | cluster.primaryUpdateMethod | string | `"switchover"` | Method to follow to upgrade the primary server during a rolling update procedure, after all replicas have been successfully updated. It can be switchover (default) or restart. | | cluster.primaryUpdateStrategy | string | `"unsupervised"` | Strategy to follow to upgrade the primary server during a rolling update procedure, after all replicas have been successfully updated: it can be automated (unsupervised - default) or manual (supervised) | | cluster.priorityClassName | string | `""` | | +| cluster.replicationSlots | object | `{}` | Replication slot management. To make logical decoding slots survive failover for CDC consumers (e.g. Debezium), enable `highAvailability.synchronizeLogicalDecoding`, set `cluster.postgresql.parameters.hot_standby_feedback: "on"` and `cluster.postgresql.parameters.sync_replication_slots: "on"`, and ensure the CDC client creates its logical slot with `failover = true`. Requires CloudNativePG 1.27+ and PostgreSQL 17+ for native failover slots. See: https://cloudnative-pg.io/documentation/current/replication/#replication-slots | | cluster.resources | object | `{}` | Resources requirements of every generated Pod. Please refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for more information. We strongly advise you use the same setting for limits and requests so that your cluster pods are given a Guaranteed QoS. See: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/ | | cluster.roles | list | `[]` | This feature enables declarative management of existing roles, as well as the creation of new roles if they are not already present in the database. See: https://cloudnative-pg.io/documentation/current/declarative_role_management/ | | cluster.securityContext | object | `{}` | Configure Container Security Context. See: https://cloudnative-pg.io/documentation/preview/security/ | diff --git a/charts/paradedb/templates/cluster.yaml b/charts/paradedb/templates/cluster.yaml index e5dc7f08f6..e2c1d42007 100644 --- a/charts/paradedb/templates/cluster.yaml +++ b/charts/paradedb/templates/cluster.yaml @@ -104,6 +104,11 @@ spec: {{ end }} cron.database_name: postgres + {{- with .Values.cluster.replicationSlots }} + replicationSlots: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if not (and (empty .Values.cluster.roles) (empty .Values.cluster.services)) }} managed: {{- with .Values.cluster.services }} diff --git a/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster-assert.yaml b/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster-assert.yaml index ffdfa5b4b4..713e8101c1 100644 --- a/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster-assert.yaml +++ b/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster-assert.yaml @@ -12,6 +12,12 @@ spec: postgresUID: 1001 postgresGID: 1002 instances: 2 + replicationSlots: + highAvailability: + enabled: true + slotPrefix: "_cnpg_" + synchronizeLogicalDecoding: true + updateInterval: 30 postgresql: ldap: server: 'openldap.default.svc.cluster.local' @@ -23,7 +29,9 @@ spec: key: 'data' searchAttribute: 'uid' parameters: + hot_standby_feedback: "on" max_connections: "42" + sync_replication_slots: "on" cron.database_name: "postgres" pg_hba: - host all 1.2.3.4/32 trust diff --git a/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster.yaml b/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster.yaml index f8de6f1008..2e2a4822c5 100644 --- a/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster.yaml +++ b/charts/paradedb/test/paradedb-cluster-configuration/01-non_default_configuration_cluster.yaml @@ -88,6 +88,12 @@ cluster: inRoles: - pg_monitor - pg_signal_backend + replicationSlots: + highAvailability: + enabled: true + slotPrefix: "_cnpg_" + synchronizeLogicalDecoding: true + updateInterval: 30 postgresql: ldap: server: 'openldap.default.svc.cluster.local' @@ -99,7 +105,9 @@ cluster: key: 'data' searchAttribute: 'uid' parameters: + hot_standby_feedback: "on" max_connections: "42" + sync_replication_slots: "on" cron.database_name: "postgres" pg_hba: - host all 1.2.3.4/32 trust diff --git a/charts/paradedb/test/pooler/chainsaw-test.yaml b/charts/paradedb/test/pooler/chainsaw-test.yaml index b0fea2fab9..6b21a7f2d6 100644 --- a/charts/paradedb/test/pooler/chainsaw-test.yaml +++ b/charts/paradedb/test/pooler/chainsaw-test.yaml @@ -7,8 +7,8 @@ metadata: spec: timeouts: apply: 1s - assert: 20s - cleanup: 30s + assert: 2m + cleanup: 1m steps: - name: Install the non-default configuration cluster try: diff --git a/charts/paradedb/values.schema.json b/charts/paradedb/values.schema.json index 773352dcca..66e6849f38 100644 --- a/charts/paradedb/values.schema.json +++ b/charts/paradedb/values.schema.json @@ -330,6 +330,39 @@ "priorityClassName": { "type": "string" }, + "replicationSlots": { + "type": "object", + "properties": { + "highAvailability": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "slotPrefix": { + "type": "string" + }, + "synchronizeLogicalDecoding": { + "type": "boolean" + } + } + }, + "synchronizeReplicas": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "excludePatterns": { + "type": "array" + } + } + }, + "updateInterval": { + "type": "integer" + } + } + }, "resources": { "type": "object" }, diff --git a/charts/paradedb/values.yaml b/charts/paradedb/values.yaml index f56b440f7d..88a972295a 100644 --- a/charts/paradedb/values.yaml +++ b/charts/paradedb/values.yaml @@ -351,6 +351,21 @@ cluster: # - name: custom-queries-secret # key: custom-queries + # -- Replication slot management. To make logical decoding slots survive + # failover for CDC consumers (e.g. Debezium), enable + # `highAvailability.synchronizeLogicalDecoding`, set + # `cluster.postgresql.parameters.hot_standby_feedback: "on"` and + # `cluster.postgresql.parameters.sync_replication_slots: "on"`, and ensure + # the CDC client creates its logical slot with `failover = true`. + # Requires CloudNativePG 1.27+ and PostgreSQL 17+ for native failover slots. + # See: https://cloudnative-pg.io/documentation/current/replication/#replication-slots + replicationSlots: {} + # highAvailability: + # enabled: true + # slotPrefix: "_cnpg_" + # synchronizeLogicalDecoding: true + # updateInterval: 30 + postgresql: # -- PostgreSQL configuration options (postgresql.conf) parameters: {}