From 2ded8747b241491c6b0dba3d95068e3757a4f60a Mon Sep 17 00:00:00 2001 From: Simon Li Date: Tue, 17 Feb 2026 20:19:42 +0000 Subject: [PATCH] Use CloudNativePG for testing --- README.md | 10 +++------- ci/test.sh | 16 +++++++++++---- test-omero-server.yaml | 6 +++--- test-postgresql.yaml | 45 +++++++++++++++++++++--------------------- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index d799221..8ddd3e4 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ Optionally create your OMERO.server and OMERO.web Helm configuration files. You can use [`test-omero-server.yaml`](test-omero-server.yaml) and [`test-omero-web.yaml`](test-omero-web.yaml) as examples. Create a PostgreSQL database, and add the credentials to your OMERO.server chart configuration file. -For testing you could use the `bitnami/postgresql` Helm chart: +For testing you can use the [CloudNativePG](https://cloudnative-pg.io/) operator: - helm repo add bitnami https://charts.bitnami.com/bitnami - helm upgrade --install postgresql bitnami/postgresql -f test-postgresql.yaml + kubectl apply --server-side=true -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/main/releases/cnpg-1.28.1.yaml + kubectl apply -f test-postgresql.yaml Install OMERO.server and OMERO.web @@ -44,14 +44,10 @@ You must delete the PVCs manually if you want a fresh installation. - PostgreSQL is no longer automatically deployed due to the complexity of managing major version upgrades. You are strongly recommended to deploy a PostgreSQL server separately, for example: - - using a Helm chart such as [bitnami/postgresql](https://artifacthub.io/packages/helm/bitnami/postgresql) - using an operator such as - [CloudNativePG](https://github.com/cloudnative-pg/cloudnative-pg) - [Postgres Operator from Zalondo](https://github.com/zalando/postgres-operator) - [PGO from Crunchy Data](https://access.crunchydata.com/documentation/postgres-operator/) - - which generally provide better support for major PostgreSQL upgrades - - using a managed service such as [Amazon RDS](https://aws.amazon.com/rds/postgresql/) or [Google Cloud SQL](https://cloud.google.com/sql/docs/postgres) - Kubernetes 1.21+ is required. diff --git a/ci/test.sh b/ci/test.sh index 42cb8c2..dd3c22d 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -1,6 +1,8 @@ #!/bin/bash -BITNAMI_POSTGRESQL_VERSION=12.6.0 +# Can update when we drop older K8s versions +# CNPG_VERSION=1.28.1 +CNPG_VERSION=1.15.1 fold_start() { echo "::group::$1" @@ -36,13 +38,19 @@ display_logs() { set -eux -fold_start "installing postgresql omero-server omero-web" +fold_start "installing postgresql" IP=$(hostname -I | awk '{print $1}') TEST_NAMESPACE=omero-test -helm repo add bitnami https://charts.bitnami.com/bitnami -helm upgrade --install postgresql --namespace $TEST_NAMESPACE --create-namespace bitnami/postgresql --version $BITNAMI_POSTGRESQL_VERSION -f test-postgresql.yaml +kubectl create namespace $TEST_NAMESPACE + +kubectl apply --server-side=true -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/main/releases/cnpg-${CNPG_VERSION}.yaml +kubectl -ncnpg-system rollout status deploy cnpg-controller-manager --timeout=300s +kubectl apply --namespace $TEST_NAMESPACE -f test-postgresql.yaml +fold_end + +fold_start "installing omero-server omero-web" helm upgrade --install omero-server --namespace $TEST_NAMESPACE --create-namespace \ ./omero-server/ -f test-omero-server.yaml diff --git a/test-omero-server.yaml b/test-omero-server.yaml index d914d84..ff85406 100644 --- a/test-omero-server.yaml +++ b/test-omero-server.yaml @@ -1,5 +1,5 @@ database: - host: postgresql + host: postgresql-rw username: omero password: ChAnGeMe name: omero @@ -34,9 +34,9 @@ ingress: enabled: true hosts: # If you only have an IP add `.xip.io` since bare IPs aren't supported - # - 192.168.99.100.xip.io + # - 192.168.99.100.nip.io - localhost tls: - hosts: - # - 192.168.99.100.xip.io + # - 192.168.99.100.nip.io - localhost diff --git a/test-postgresql.yaml b/test-postgresql.yaml index 7e911f9..c0abf51 100644 --- a/test-postgresql.yaml +++ b/test-postgresql.yaml @@ -1,25 +1,24 @@ -# See https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters -# image: -# tag: 15.0.0-debian-11-r1 -image: - # Temporary workaround for https://github.com/manics/kubernetes-omero/issues/55 - repository: bitnamilegacy/postgresql - -# TODO: Use the autogenerated postgres secret instead - -# Bitnami chart v11: -auth: +apiVersion: v1 +kind: Secret +metadata: + name: postgresql-omero +type: kubernetes.io/basic-auth +stringData: username: omero password: ChAnGeMe - database: omero -# primary: -# persistence: -# enabled: -# existingClaim: -# storageClass: -# accessModes: -# annotations: -# size: -# subPath: -# mountPath: -# resources: + +--- +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: postgresql +spec: + instances: 1 + storage: + size: 1Gi + bootstrap: + initdb: + database: omero + owner: omero + secret: + name: postgresql-omero