diff --git a/build/postgres-operator/Dockerfile b/build/postgres-operator/Dockerfile index f39296f8a1..844c6a0309 100644 --- a/build/postgres-operator/Dockerfile +++ b/build/postgres-operator/Dockerfile @@ -62,6 +62,7 @@ COPY --from=go_builder /usr/local/bin/extension-installer /usr/local/bin COPY --from=go_builder /usr/local/bin/pgbackrest /usr/local/bin/ COPY --from=go_builder /licenses /licenses COPY build/postgres-operator/install-extensions.sh /usr/local/bin +COPY build/postgres-operator/relocate-extensions.sh /usr/local/bin COPY build/postgres-operator/init-entrypoint.sh /usr/local/bin COPY build/postgres-operator/postgres-entrypoint.sh /usr/local/bin COPY build/postgres-operator/postgres-liveness-check.sh /usr/local/bin diff --git a/build/postgres-operator/init-entrypoint.sh b/build/postgres-operator/init-entrypoint.sh index 533b78a84d..2fde1f02bf 100755 --- a/build/postgres-operator/init-entrypoint.sh +++ b/build/postgres-operator/init-entrypoint.sh @@ -9,3 +9,4 @@ install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/pgbackrest" "${CR install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-entrypoint.sh" "${CRUNCHY_BINDIR}/bin/postgres-entrypoint.sh" install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-liveness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-liveness-check.sh" 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" diff --git a/build/postgres-operator/relocate-extensions.sh b/build/postgres-operator/relocate-extensions.sh new file mode 100755 index 0000000000..ca786b745f --- /dev/null +++ b/build/postgres-operator/relocate-extensions.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +PG_EXTENSIONS_DIR=/usr/pgsql-${PG_VERSION}/share/extension +PG_LIB_DIR=/usr/pgsql-${PG_VERSION}/lib + +PGDATA_EXTENSIONS_DIR=/pgdata/extension/${PG_VERSION}/usr/pgsql-${PG_VERSION}/share/extension +PGDATA_LIB_DIR=/pgdata/extension/${PG_VERSION}/usr/pgsql-${PG_VERSION}/lib + +mkdir -p "${PGDATA_EXTENSIONS_DIR}" +mkdir -p "${PGDATA_LIB_DIR}" + +cp -r "${PG_EXTENSIONS_DIR}"/* "${PGDATA_EXTENSIONS_DIR}/" +cp -r "${PG_LIB_DIR}"/* "${PGDATA_LIB_DIR}/" diff --git a/e2e-tests/vars.sh b/e2e-tests/vars.sh index 47a3dd2cf6..9d0d78cdfb 100755 --- a/e2e-tests/vars.sh +++ b/e2e-tests/vars.sh @@ -16,7 +16,7 @@ export IMAGE_BASE=${IMAGE_BASE:-"perconalab/percona-postgresql-operator"} export IMAGE=${IMAGE:-"${IMAGE_BASE}:${VERSION}"} export PG_VER="${PG_VER:-17}" export IMAGE_PGBOUNCER=${IMAGE_PGBOUNCER:-"${IMAGE_BASE}:main-pgbouncer$PG_VER"} -export IMAGE_POSTGRESQL=${IMAGE_POSTGRESQL:-"${IMAGE_BASE}:main-ppg$PG_VER-postgres"} +export IMAGE_POSTGRESQL=${IMAGE_POSTGRESQL:-"ademajazzserve/postgres:11"} # TODO: replace it export IMAGE_BACKREST=${IMAGE_BACKREST:-"${IMAGE_BASE}:main-pgbackrest$PG_VER"} export IMAGE_UPGRADE=${IMAGE_UPGRADE:-"${IMAGE_BASE}:main-upgrade"} export BUCKET=${BUCKET:-"pg-operator-testing"} diff --git a/percona/extensions/k8s.go b/percona/extensions/k8s.go index 7cf5839ae5..90e7d12730 100644 --- a/percona/extensions/k8s.go +++ b/percona/extensions/k8s.go @@ -21,11 +21,15 @@ func ExtensionRelocatorContainer(cr *pgv2.PerconaPGCluster, image string, imageP containerName = fmt.Sprintf("extension-relocator-%d", postgresVersion) } + command := "/usr/local/bin/relocate-extensions.sh" + if cr.CompareVersion("2.8.0") >= 0 { + command = "/opt/crunchy/bin/relocate-extensions.sh" + } return corev1.Container{ Name: containerName, Image: image, ImagePullPolicy: imagePullPolicy, - Command: []string{"/usr/local/bin/relocate-extensions.sh"}, + Command: []string{command}, Env: []corev1.EnvVar{ { Name: "PG_VERSION",