diff --git a/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml b/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml index d600b02bbb..5c24792891 100644 --- a/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml +++ b/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml @@ -22041,6 +22041,66 @@ spec: - pgbackrest type: string type: array + dcs: + description: |- + DCS configures the distributed configuration store backend. + Defaults to the Kubernetes-native backend (Endpoints). + N.B. Changing the DCS type causes downtime; all instances must restart simultaneously. + properties: + etcd: + description: |- + Etcd holds settings for the external etcd DCS backend. + Required when type is "etcd". + properties: + authSecret: + description: |- + AuthSecret is the name of a Secret in the same namespace with keys + username and password for etcd authentication. + type: string + endpoints: + description: |- + Endpoints is the list of etcd endpoints including scheme and port. + Example: ["https://etcd.etcd-cluster.svc:2379"] + The scheme of the first endpoint determines the protocol used. + All endpoints must use the same scheme. + items: + pattern: ^https?://[^/] + type: string + maxItems: 7 + minItems: 1 + type: array + x-kubernetes-validations: + - message: all endpoints must use the same scheme (http + or https) + rule: self.all(e, url(e).getScheme() == 'http') || self.all(e, + url(e).getScheme() == 'https') + tlsSecret: + description: |- + TLSSecret is the name of a Secret in the same namespace with keys + ca.crt, tls.crt, and tls.key for mutual TLS with etcd. + type: string + required: + - endpoints + type: object + type: + allOf: + - enum: + - kubernetes + - etcd + - enum: + - kubernetes + - etcd + default: kubernetes + description: PatroniDCSType identifies which DCS backend Patroni + should use. + type: string + type: object + x-kubernetes-validations: + - message: etcd.endpoints must be non-empty when type is etcd + rule: self.type != 'etcd' || (has(self.etcd) && size(self.etcd.endpoints) + > 0) + - message: DCS type is immutable after cluster creation + rule: '!has(oldSelf.type) || oldSelf.type == self.type' dynamicConfiguration: description: |- Patroni dynamic configuration settings. Changes to this value will be diff --git a/build/postgres-operator/Dockerfile b/build/postgres-operator/Dockerfile index 45c38b9745..a3de6223a5 100644 --- a/build/postgres-operator/Dockerfile +++ b/build/postgres-operator/Dockerfile @@ -70,6 +70,7 @@ COPY build/postgres-operator/postgres-entrypoint.sh /usr/local/bin COPY build/postgres-operator/postgres-liveness-check.sh /usr/local/bin COPY build/postgres-operator/postgres-readiness-check.sh /usr/local/bin COPY build/postgres-operator/restore-command-wrapper.sh /usr/local/bin +COPY build/postgres-operator/patroni-role-change.sh /usr/local/bin COPY hack/tools/queries /opt/crunchy/conf RUN chgrp -R 0 /opt/crunchy/conf && chmod -R g=u opt/crunchy/conf diff --git a/build/postgres-operator/init-entrypoint.sh b/build/postgres-operator/init-entrypoint.sh index 3090212fbf..e7c503538c 100755 --- a/build/postgres-operator/init-entrypoint.sh +++ b/build/postgres-operator/init-entrypoint.sh @@ -11,3 +11,4 @@ install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-liveness install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-readiness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-readiness-check.sh" install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/relocate-extensions.sh" "${CRUNCHY_BINDIR}/bin/relocate-extensions.sh" install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/restore-command-wrapper.sh" "${CRUNCHY_BINDIR}/bin/restore-command-wrapper.sh" +install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/patroni-role-change.sh" "${CRUNCHY_BINDIR}/bin/patroni-role-change.sh" diff --git a/build/postgres-operator/patroni-role-change.sh b/build/postgres-operator/patroni-role-change.sh new file mode 100755 index 0000000000..bc2e2bc989 --- /dev/null +++ b/build/postgres-operator/patroni-role-change.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Patroni on_role_change / on_start callback. +# Called by Patroni as: