diff --git a/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml b/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml index 594b73af50..46fb7df0ef 100644 --- a/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml +++ b/build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml @@ -22031,6 +22031,64 @@ 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 + 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 + x-kubernetes-validations: + - message: all endpoints must use the same scheme (http or + https) + rule: self.endpoints.all(e, e.startsWith('https://')) || + self.endpoints.all(e, e.startsWith('http://')) + type: + default: kubernetes + description: |- + Type of DCS backend. Defaults to "kubernetes". + Changing this value causes cluster downtime; all instances must restart. + This field is immutable after cluster creation. + enum: + - kubernetes + - etcd + 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 @@ -22101,6 +22159,10 @@ spec: minimum: 1 type: integer type: object + x-kubernetes-validations: + - message: DCS type is immutable after cluster creation + rule: '(has(oldSelf.dcs) ? oldSelf.dcs.type : ''kubernetes'') == + (has(self.dcs) ? self.dcs.type : ''kubernetes'')' pause: description: |- Whether or not the PostgreSQL cluster should be stopped. 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..0ed4b2cd58 --- /dev/null +++ b/build/postgres-operator/patroni-role-change.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Patroni on_role_change / on_start callback. +# Called by Patroni as: