From 01d068d70b57f086a0fff44e2082088866bd03b9 Mon Sep 17 00:00:00 2001 From: ValClarkson Date: Fri, 29 May 2026 15:27:31 -0400 Subject: [PATCH 1/3] fix(pgadmin): switch standalone pgAdmin to python3.12 site-packages path The new internal-registry pgAdmin image (registry.internal.crunchydata.com/gitlab/crunchy-pgadmin4-ubi9@sha256: b10575053e71e820ae15747f5e11e543296f0dafeb5513bbf44a8053b5cd7c1a) ships pgadmin4 under /usr/local/lib/python3.12/site-packages/pgadmin4. The previous developers.crunchydata.com image was on python3.11, so the operator hard-codes that path. The startup script generated by the operator does `cd "$PGADMIN_DIR"`, which fails on the new image with: cd: /usr/local/lib/python3.11/site-packages/pgadmin4: No such file or directory The container exits 1 immediately and the pod ends up in CrashLoopBackOff. This was caught running the standalone-pgadmin-user-management kuttl suite against the new image. * internal/controller/standalone_pgadmin/config.go: bump pgAdminDir from python3.11 -> python3.12 so the generated startup script's `cd "$PGADMIN_DIR"` succeeds. * internal/controller/standalone_pgadmin/pod_test.go: refresh both golden pod-spec fixtures to match the new path. --- internal/controller/standalone_pgadmin/config.go | 2 +- internal/controller/standalone_pgadmin/pod_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/controller/standalone_pgadmin/config.go b/internal/controller/standalone_pgadmin/config.go index 934c9fc5b9..abd09d889c 100644 --- a/internal/controller/standalone_pgadmin/config.go +++ b/internal/controller/standalone_pgadmin/config.go @@ -15,5 +15,5 @@ const ( pgAdminPort = 5050 // Directory for pgAdmin in container - pgAdminDir = "/usr/local/lib/python3.11/site-packages/pgadmin4" + pgAdminDir = "/usr/local/lib/python3.12/site-packages/pgadmin4" ) diff --git a/internal/controller/standalone_pgadmin/pod_test.go b/internal/controller/standalone_pgadmin/pod_test.go index ab807e42f8..0e67333638 100644 --- a/internal/controller/standalone_pgadmin/pod_test.go +++ b/internal/controller/standalone_pgadmin/pod_test.go @@ -45,7 +45,7 @@ containers: - |- monitor() { export PGADMIN_SETUP_PASSWORD="$(date +%s | sha256sum | base64 | head -c 32)" - PGADMIN_DIR=/usr/local/lib/python3.11/site-packages/pgadmin4 + PGADMIN_DIR=/usr/local/lib/python3.12/site-packages/pgadmin4 APP_RELEASE=$(cd $PGADMIN_DIR && python3 -c "import config; print(config.APP_RELEASE)") echo "Running pgAdmin4 Setup" @@ -246,7 +246,7 @@ containers: - |- monitor() { export PGADMIN_SETUP_PASSWORD="$(date +%s | sha256sum | base64 | head -c 32)" - PGADMIN_DIR=/usr/local/lib/python3.11/site-packages/pgadmin4 + PGADMIN_DIR=/usr/local/lib/python3.12/site-packages/pgadmin4 APP_RELEASE=$(cd $PGADMIN_DIR && python3 -c "import config; print(config.APP_RELEASE)") echo "Running pgAdmin4 Setup" From 48abef828adfbedc1e236eb4b7c94afb7a48dc6d Mon Sep 17 00:00:00 2001 From: ValClarkson Date: Fri, 29 May 2026 15:52:52 -0400 Subject: [PATCH 2/3] updated pgadmin dockerfile --- components/image-pgadmin/Dockerfile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/image-pgadmin/Dockerfile b/components/image-pgadmin/Dockerfile index 7662c809b5..4dea12ce1f 100644 --- a/components/image-pgadmin/Dockerfile +++ b/components/image-pgadmin/Dockerfile @@ -4,7 +4,7 @@ ARG BASE_VERSION=ubi9 ARG PGADMIN4_VERSION=9.13 -ARG PYTHON_VERSION=3.11 +ARG PYTHON_VERSION=3.12 ARG PG_MAJOR=18 # Some Python packages available in UBI repositories are too old for pgAdmin @@ -114,11 +114,19 @@ RUN rpm -ivh "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${BASE_V # # - https://docs.python.org/3/whatsnew/3.12.html # - https://github.com/pgadmin-org/pgadmin4/blob/REL-8_14/requirements.txt#L57 +# +# Install "wheel" and "packaging" alongside pip/setuptools so legacy pgAdmin +# transitive deps (e.g. Flask-Principal) that ship as sdists without a +# pyproject.toml can build via "setup.py bdist_wheel". Without these the +# wheel package's bdist_wheel shim fails on Python 3.12 with UBI's older +# rpm setuptools because its fallback path imports "packaging". ARG PGADMIN4_VERSION RUN \ microdnf install -y --nodocs \ +"python${PYTHON_VERSION}-packaging" \ "python${PYTHON_VERSION}-pip" \ "python${PYTHON_VERSION}-setuptools" \ +"python${PYTHON_VERSION}-wheel" \ && microdnf clean all \ && rm -f /etc/yum.repos.d/redhat.repo \ && "python${PYTHON_VERSION}" -m pip install --no-cache-dir \ @@ -128,6 +136,14 @@ microdnf install -y --nodocs \ && update-alternatives --install /usr/bin/python3 python3 "/usr/bin/python${PYTHON_VERSION}" 1 \ && update-alternatives --set python3 "/usr/bin/python${PYTHON_VERSION}" +# The operator invokes pgAdmin's setup.py CLI (add-user, update-user, load-servers, +# setup-db) against the same install that gunicorn is serving. When setup.py runs +# as a CLI, pgAdmin's Flask app.name ends with "-cli" and delete_adhoc_servers() +# wipes servers users registered through the web UI. Gate that call so it only +# runs for non-CLI invocations. +RUN sed -i "s/delete_adhoc_servers()/if not app.name.endswith('-cli'): delete_adhoc_servers()/g" \ + /usr/local/lib/python${PYTHON_VERSION}/site-packages/pgadmin4/pgadmin/__init__.py + # config_local.py should be colocated with config.py COPY --chmod=0444 conf/config_local.py \ /usr/local/lib/python${PYTHON_VERSION}/site-packages/pgadmin4/config_local.py From 255d1729814ce3be87686fef8b0d240d533e2531 Mon Sep 17 00:00:00 2001 From: ValClarkson Date: Fri, 29 May 2026 16:06:45 -0400 Subject: [PATCH 3/3] resolve conflict --- components/image-pgadmin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/image-pgadmin/Dockerfile b/components/image-pgadmin/Dockerfile index 4dea12ce1f..0e31fc8172 100644 --- a/components/image-pgadmin/Dockerfile +++ b/components/image-pgadmin/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 ARG BASE_VERSION=ubi9 -ARG PGADMIN4_VERSION=9.13 +ARG PGADMIN4_VERSION=9.15 ARG PYTHON_VERSION=3.12 ARG PG_MAJOR=18