diff --git a/Makefile b/Makefile index 10e6b1c038..c7d1e982ae 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,6 @@ clean: clean-deprecated rm -f bin/postgres-operator rm -rf licenses/*/ [ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated - [ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other [ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest [ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; } [ ! -d hack/tools/pgmonitor ] || rm -rf hack/tools/pgmonitor @@ -85,6 +84,8 @@ clean-deprecated: ## Clean deprecated resources [ ! -d build/crunchy-postgres-exporter ] || rm -r build/crunchy-postgres-exporter @# CRDs used to require patching [ ! -d build/crd ] || rm -r build/crd + @# Old testing directories + [ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other ##@ Deployment @@ -228,7 +229,6 @@ generate-kuttl: export KUTTL_PSQL_IMAGE ?= registry.developers.crunchydata.com/c generate-kuttl: export KUTTL_TEST_DELETE_NAMESPACE ?= kuttl-test-delete-namespace generate-kuttl: ## Generate kuttl tests [ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated - [ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other bash -ceu ' \ case $(KUTTL_PG_VERSION) in \ 16 ) export KUTTL_BITNAMI_IMAGE_TAG=16.0.0-debian-11-r3 ;; \ @@ -245,7 +245,7 @@ generate-kuttl: ## Generate kuttl tests source="$${1}" target="$${1/e2e/e2e-generated}"; \ mkdir -p "$${target%/*}"; render < "$${source}" > "$${target}"; \ shift; \ - done' - testing/kuttl/e2e/*/*.yaml testing/kuttl/e2e-other/*/*.yaml testing/kuttl/e2e/*/*/*.yaml testing/kuttl/e2e-other/*/*/*.yaml + done' - testing/kuttl/e2e/*/*.yaml testing/kuttl/e2e/*/*/*.yaml ##@ Generate diff --git a/testing/kuttl/README.md b/testing/kuttl/README.md index 555ce9a26d..41fbf46e19 100644 --- a/testing/kuttl/README.md +++ b/testing/kuttl/README.md @@ -74,19 +74,10 @@ calling the `make generate-kuttl` target: KUTTL_PG_VERSION=13 KUTTL_POSTGIS_VERSION=3.0 make generate-kuttl ``` -This will loop through the files under the `e2e` and `e2e-other` directories and create matching -files under the `e2e-generated` and `e2e-generated-other` directories that can be checked for +This will loop through the files under testing directories and create matching +files under testing + `generated` directories that can be checked for correctness before running the tests. -Please note, `make check-kuttl` does not run the `e2e-other` tests. To run the `postgis-cluster` -test, you can use: - -``` -kubectl kuttl test testing/kuttl/e2e-generated-other/ --timeout=180 --test postgis-cluster` -``` - -To run the `gssapi` test, please see testing/kuttl/e2e-other/gssapi/README.md. - To prevent errors, we want to set defaults for all the environment variables used in the source YAML files; so if you add a new test with a new variable, please update the Makefile with a reasonable/preferred default. diff --git a/testing/kuttl/e2e-other/autogrow-volume/00-assert.yaml b/testing/kuttl/e2e-other/autogrow-volume/00-assert.yaml deleted file mode 100644 index b4372b75e7..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/00-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Ensure that the default StorageClass supports VolumeExpansion -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - annotations: - storageclass.kubernetes.io/is-default-class: "true" -allowVolumeExpansion: true diff --git a/testing/kuttl/e2e-other/autogrow-volume/01-create.yaml b/testing/kuttl/e2e-other/autogrow-volume/01-create.yaml deleted file mode 100644 index fc947a538f..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/01-create.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/01-create-cluster.yaml -assert: -- files/01-cluster-and-pvc-created.yaml diff --git a/testing/kuttl/e2e-other/autogrow-volume/02-add-data.yaml b/testing/kuttl/e2e-other/autogrow-volume/02-add-data.yaml deleted file mode 100644 index 261c274a51..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/02-add-data.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/02-create-data.yaml -assert: -- files/02-create-data-completed.yaml diff --git a/testing/kuttl/e2e-other/autogrow-volume/03-assert.yaml b/testing/kuttl/e2e-other/autogrow-volume/03-assert.yaml deleted file mode 100644 index ad31b61401..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/03-assert.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# Check that annotation is set -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: auto-grow-volume - postgres-operator.crunchydata.com/data: postgres - postgres-operator.crunchydata.com/instance-set: instance1 - postgres-operator.crunchydata.com/patroni: auto-grow-volume-ha - annotations: - suggested-pgdata-pvc-size: 1461Mi diff --git a/testing/kuttl/e2e-other/autogrow-volume/04-assert.yaml b/testing/kuttl/e2e-other/autogrow-volume/04-assert.yaml deleted file mode 100644 index d486f9de18..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/04-assert.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# We know that the PVC sizes have changed so now we can check that they have been -# updated to have the expected size ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: auto-grow-volume - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 1461Mi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound diff --git a/testing/kuttl/e2e-other/autogrow-volume/05-check-event.yaml b/testing/kuttl/e2e-other/autogrow-volume/05-check-event.yaml deleted file mode 100644 index 475177d242..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/05-check-event.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Verify expected event has occurred - - script: | - EVENT=$( - kubectl get events --namespace="${NAMESPACE}" \ - --field-selector reason="VolumeAutoGrow" --output=jsonpath={.items..message} - ) - - if [[ "${EVENT}" != "pgData volume expansion to 1461Mi requested for auto-grow-volume/instance1." ]]; then exit 1; fi diff --git a/testing/kuttl/e2e-other/autogrow-volume/README.md b/testing/kuttl/e2e-other/autogrow-volume/README.md deleted file mode 100644 index 674bc69b40..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/README.md +++ /dev/null @@ -1,9 +0,0 @@ -### AutoGrow Volume - -* 00: Assert the storage class allows volume expansion -* 01: Create and verify PostgresCluster and PVC -* 02: Add data to trigger growth and verify Job completes -* 03: Verify annotation on the instance Pod -* 04: Verify the PVC request has been set and the PVC has grown -* 05: Verify the expansion request Event has been created - Note: This Event should be created between steps 03 and 04 but is checked at the end for timing purposes. diff --git a/testing/kuttl/e2e-other/autogrow-volume/files/01-cluster-and-pvc-created.yaml b/testing/kuttl/e2e-other/autogrow-volume/files/01-cluster-and-pvc-created.yaml deleted file mode 100644 index 17804b8205..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/files/01-cluster-and-pvc-created.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: auto-grow-volume -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: auto-grow-volume - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 1Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 1Gi - phase: Bound diff --git a/testing/kuttl/e2e-other/autogrow-volume/files/01-create-cluster.yaml b/testing/kuttl/e2e-other/autogrow-volume/files/01-create-cluster.yaml deleted file mode 100644 index 01eaf7a684..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/files/01-create-cluster.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: auto-grow-volume -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - limits: - storage: 2Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data-completed.yaml b/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data-completed.yaml deleted file mode 100644 index fdb42e68f5..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data-completed.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: create-data -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data.yaml b/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data.yaml deleted file mode 100644 index c42f0dec10..0000000000 --- a/testing/kuttl/e2e-other/autogrow-volume/files/02-create-data.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# Create some data that should be present after resizing. -apiVersion: batch/v1 -kind: Job -metadata: - name: create-data - labels: { postgres-operator-test: kuttl } -spec: - backoffLimit: 3 - template: - metadata: - labels: { postgres-operator-test: kuttl } - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - env: - - name: PGURI - valueFrom: { secretKeyRef: { name: auto-grow-volume-pguser-auto-grow-volume, key: uri } } - - # Do not wait indefinitely, but leave enough time to create the data. - - { name: PGCONNECT_TIMEOUT, value: '60' } - - command: - - psql - - $(PGURI) - - --set=ON_ERROR_STOP=1 - - --command - - | # create schema for user and add enough data to get over 75% usage - CREATE SCHEMA "auto-grow-volume" AUTHORIZATION "auto-grow-volume"; - CREATE TABLE big_table AS SELECT 'data' || s AS mydata FROM generate_series(1,6000000) AS s; diff --git a/testing/kuttl/e2e-other/cluster-migrate/01--non-crunchy-cluster.yaml b/testing/kuttl/e2e-other/cluster-migrate/01--non-crunchy-cluster.yaml deleted file mode 100644 index 1ccceb7098..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/01--non-crunchy-cluster.yaml +++ /dev/null @@ -1,193 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: non-crunchy-cluster - labels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster -type: Opaque -stringData: - postgres-password: "SR6kNAFXvX" ---- -apiVersion: v1 -kind: Service -metadata: - name: non-crunchy-cluster-hl - labels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" -spec: - type: ClusterIP - clusterIP: None - publishNotReadyAddresses: true - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - selector: - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary ---- -apiVersion: v1 -kind: Service -metadata: - name: non-crunchy-cluster - labels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary -spec: - type: ClusterIP - sessionAffinity: None - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - nodePort: null - selector: - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: non-crunchy-cluster - labels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary -spec: - replicas: 1 - serviceName: non-crunchy-cluster-hl - updateStrategy: - rollingUpdate: {} - type: RollingUpdate - selector: - matchLabels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary - template: - metadata: - name: non-crunchy-cluster - labels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary - spec: - serviceAccountName: default - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchLabels: - postgres-operator-test: kuttl - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: non-crunchy-cluster - app.kubernetes.io/component: primary - namespaces: - - "default" - topologyKey: kubernetes.io/hostname - weight: 1 - securityContext: - fsGroup: 1001 - hostNetwork: false - hostIPC: false - containers: - - name: postgresql - image: docker.io/bitnami/postgresql:${KUTTL_BITNAMI_IMAGE_TAG} - imagePullPolicy: "IfNotPresent" - securityContext: - runAsUser: 1001 - env: - - name: BITNAMI_DEBUG - value: "false" - - name: POSTGRESQL_PORT_NUMBER - value: "5432" - - name: POSTGRESQL_VOLUME_DIR - value: "/bitnami/postgresql" - - name: PGDATA - value: "/bitnami/postgresql/data" - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: non-crunchy-cluster - key: postgres-password - - name: POSTGRESQL_ENABLE_LDAP - value: "no" - - name: POSTGRESQL_ENABLE_TLS - value: "no" - - name: POSTGRESQL_LOG_HOSTNAME - value: "false" - - name: POSTGRESQL_LOG_CONNECTIONS - value: "false" - - name: POSTGRESQL_LOG_DISCONNECTIONS - value: "false" - - name: POSTGRESQL_PGAUDIT_LOG_CATALOG - value: "off" - - name: POSTGRESQL_CLIENT_MIN_MESSAGES - value: "error" - - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES - value: "pgaudit" - ports: - - name: tcp-postgresql - containerPort: 5432 - livenessProbe: - failureThreshold: 6 - initialDelaySeconds: 30 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - exec pg_isready -U "postgres" -h localhost -p 5432 - readinessProbe: - failureThreshold: 6 - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - -e - - | - exec pg_isready -U "postgres" -h localhost -p 5432 - [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] - resources: - limits: {} - requests: - cpu: 250m - memory: 256Mi - volumeMounts: - - name: dshm - mountPath: /dev/shm - - name: data - mountPath: /bitnami/postgresql - volumes: - - name: dshm - emptyDir: - medium: Memory - volumeClaimTemplates: - - metadata: - name: data - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "1Gi" diff --git a/testing/kuttl/e2e-other/cluster-migrate/01-assert.yaml b/testing/kuttl/e2e-other/cluster-migrate/01-assert.yaml deleted file mode 100644 index c45fe79261..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/01-assert.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: non-crunchy-cluster -status: - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 diff --git a/testing/kuttl/e2e-other/cluster-migrate/02--create-data.yaml b/testing/kuttl/e2e-other/cluster-migrate/02--create-data.yaml deleted file mode 100644 index a9b7ebf152..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/02--create-data.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -# Create some data that will be preserved after migration. -apiVersion: batch/v1 -kind: Job -metadata: - name: original-data - labels: { postgres-operator-test: kuttl } -spec: - backoffLimit: 3 - template: - metadata: - labels: { postgres-operator-test: kuttl } - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - env: - - { name: PGHOST, value: "non-crunchy-cluster" } - # Do not wait indefinitely. - - { name: PGCONNECT_TIMEOUT, value: '5' } - - { name: PGPASSWORD, valueFrom: { secretKeyRef: { name: non-crunchy-cluster, key: postgres-password } } } - command: - - psql - - --username=postgres - - --dbname=postgres - - --set=ON_ERROR_STOP=1 - - --command - - | - CREATE TABLE IF NOT EXISTS important (data) AS VALUES ('treasure'); diff --git a/testing/kuttl/e2e-other/cluster-migrate/02-assert.yaml b/testing/kuttl/e2e-other/cluster-migrate/02-assert.yaml deleted file mode 100644 index 5115ba97c9..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/02-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: original-data -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/cluster-migrate/03--alter-pv.yaml b/testing/kuttl/e2e-other/cluster-migrate/03--alter-pv.yaml deleted file mode 100644 index 64fa700297..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/03--alter-pv.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - set -e - VOLUME_NAME=$( - kubectl get pvc --namespace "${NAMESPACE}" \ - --output=jsonpath={.items..spec.volumeName} - ) - - ORIGINAL_POLICY=$( - kubectl get pv "${VOLUME_NAME}" \ - --output=jsonpath={.spec.persistentVolumeReclaimPolicy} - ) - - kubectl create configmap persistent-volume-reclaim-policy --namespace "${NAMESPACE}" \ - --from-literal=ORIGINAL_POLICY="${ORIGINAL_POLICY}" \ - --from-literal=VOLUME_NAME="${VOLUME_NAME}" - - kubectl patch pv "${VOLUME_NAME}" -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' - - kubectl label pv "${VOLUME_NAME}" postgres-operator-test=kuttl app.kubernetes.io/name=postgresql app.kubernetes.io/instance=non-crunchy-cluster test-namespace="${NAMESPACE}" diff --git a/testing/kuttl/e2e-other/cluster-migrate/04--delete.yaml b/testing/kuttl/e2e-other/cluster-migrate/04--delete.yaml deleted file mode 100644 index ed38b23d9f..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/04--delete.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: -- apiVersion: apps/v1 - kind: StatefulSet - name: non-crunchy-cluster -- apiVersion: v1 - kind: Service - name: non-crunchy-cluster -- apiVersion: v1 - kind: Service - name: non-crunchy-cluster-hl -- apiVersion: v1 - kind: Secret - name: non-crunchy-cluster diff --git a/testing/kuttl/e2e-other/cluster-migrate/04-errors.yaml b/testing/kuttl/e2e-other/cluster-migrate/04-errors.yaml deleted file mode 100644 index 1767e8040f..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/04-errors.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: non-crunchy-cluster-0 diff --git a/testing/kuttl/e2e-other/cluster-migrate/05--cluster.yaml b/testing/kuttl/e2e-other/cluster-migrate/05--cluster.yaml deleted file mode 100644 index a81666ed01..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/05--cluster.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: cluster-migrate -spec: - dataSource: - volumes: - pgDataVolume: - pvcName: data-non-crunchy-cluster-0 - directory: data - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/cluster-migrate/06-assert.yaml b/testing/kuttl/e2e-other/cluster-migrate/06-assert.yaml deleted file mode 100644 index 1a25966abb..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/06-assert.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: cluster-migrate -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: cluster-migrate - postgres-operator.crunchydata.com/data: postgres - postgres-operator.crunchydata.com/instance-set: instance1 - postgres-operator.crunchydata.com/role: master -status: - phase: Running diff --git a/testing/kuttl/e2e-other/cluster-migrate/07--set-collation.yaml b/testing/kuttl/e2e-other/cluster-migrate/07--set-collation.yaml deleted file mode 100644 index 00eb741f80..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/07--set-collation.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - set -e - if [[ ${KUTTL_PG_VERSION} -ge 15 ]]; then - PRIMARY= - while [[ -z "${PRIMARY}" ]]; do - PRIMARY=$( - kubectl get pod --namespace "${NAMESPACE}" \ - --output name --selector ' - postgres-operator.crunchydata.com/cluster=cluster-migrate, - postgres-operator.crunchydata.com/role=master' - ) - done - - # Ignore warnings about collation changes. This is DANGEROUS on real data! - # Only do this automatic step in test conditions; with real data, this may cause - # more problems as you may need to reindex. - kubectl exec --namespace "${NAMESPACE}" "${PRIMARY}" -c database \ - -- psql -qAt --command \ - 'ALTER DATABASE postgres REFRESH COLLATION VERSION; ALTER DATABASE template1 REFRESH COLLATION VERSION;' - fi diff --git a/testing/kuttl/e2e-other/cluster-migrate/08--alter-pv.yaml b/testing/kuttl/e2e-other/cluster-migrate/08--alter-pv.yaml deleted file mode 100644 index c5edfb4c99..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/08--alter-pv.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - set -e - SAVED_DATA=$( - kubectl get configmap persistent-volume-reclaim-policy --namespace "${NAMESPACE}" \ - --output=jsonpath="{.data..['ORIGINAL_POLICY','VOLUME_NAME']}" - ) - - IFS=' ' - read ORIGINAL_POLICY VOLUME_NAME <<< "${SAVED_DATA}" - - kubectl patch pv "${VOLUME_NAME}" -p '{"spec":{"persistentVolumeReclaimPolicy":"'${ORIGINAL_POLICY}'"}}' - diff --git a/testing/kuttl/e2e-other/cluster-migrate/09--check-data.yaml b/testing/kuttl/e2e-other/cluster-migrate/09--check-data.yaml deleted file mode 100644 index 6a46bd8e9a..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/09--check-data.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - set -e - PRIMARY=$( - kubectl get pod --namespace "${NAMESPACE}" \ - --output name --selector ' - postgres-operator.crunchydata.com/cluster=cluster-migrate, - postgres-operator.crunchydata.com/role=master' - ) - - TREASURE=$( - kubectl exec "${PRIMARY}" --namespace "${NAMESPACE}" \ - --container database \ - -- psql -U postgres -qt -c "select data from important" - ) - - if [[ "${TREASURE}" != " treasure" ]]; then - echo "Migration from 3rd-party PG pod failed, result from query: ${TREASURE}" - exit 1 - fi diff --git a/testing/kuttl/e2e-other/cluster-migrate/README.md b/testing/kuttl/e2e-other/cluster-migrate/README.md deleted file mode 100644 index 09026f9e8b..0000000000 --- a/testing/kuttl/e2e-other/cluster-migrate/README.md +++ /dev/null @@ -1,45 +0,0 @@ -## Cluster Migrate - -This test was developed to check that users could bypass some known problems when -migrating from a non-Crunchy PostgreSQL image to a Crunchy PostgreSQL image: - -1) it changes the ownership of the data directory (which depends on fsGroup -behavior to change group ownership which is not available in all providers); -2) it makes sure a postgresql.conf file is available, as required by Patroni. - -Important note on *environment*: -As noted above, this work relies on fsGroup, so this test will not work in the current -form in all environments. For instance, this creates a PG cluster with fsGroup set, -which will result in an error in OpenShift. - -Important note on *PV permissions*: -This test involves changing permissions on PersistentVolumes, which may not be available -in all environments to all users (since this is a cluster-wide permission). - -Important note on migrating between different builds of *Postgres 15*: -PG 15 introduced new behavior around database collation versions, which result in errors like: - -``` -WARNING: database \"postgres\" has a collation version mismatch -DETAIL: The database was created using collation version 2.31, but the operating system provides version 2.28 -``` - -This error occurred in `reconcilePostgresDatabases` and prevented PGO from finishing the reconcile -loop. For _testing purposes_, this problem is worked around in steps 06 and 07, which wait for -the PG pod to be ready and then send a command to `REFRESH COLLATION VERSION` on the `postgres` -and `template1` databases (which were the only databases where this error was observed during -testing). - -This solution is fine for testing purposes, but is not a solution that should be done in production -as an automatic step. User intervention and supervision is recommended in that case. - -### Steps - -* 01: Create a non-Crunchy PostgreSQL cluster and wait for it to be ready -* 02: Create data on that cluster -* 03: Alter the Reclaim policy of the PV so that it will survive deletion of the cluster -* 04: Delete the original cluster, leaving the PV -* 05: Create a PGO-managed `postgrescluster` with the remaining PV as the datasource -* 06-07: Wait for the PG pod to be ready and alter the collation (PG 15 only, see above) -* 08: Alter the PV to the original Reclaim policy -* 09: Check that the data successfully migrated diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10--cluster.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10--cluster.yaml deleted file mode 100644 index a3236da358..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10--cluster.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: delete-switchover-with-timestamp -spec: - postgresVersion: ${KUTTL_PG_VERSION} - patroni: - switchover: - enabled: true - instances: - - name: instance1 - replicas: 2 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10-assert.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10-assert.yaml deleted file mode 100644 index d77e27e307..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/10-assert.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: delete-switchover-with-timestamp -status: - instances: - - name: instance1 - readyReplicas: 2 - replicas: 2 - updatedReplicas: 2 ---- -# Patroni labels and readiness happen separately. -# The next step expects to find pods by their role label; wait for them here. -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp - postgres-operator.crunchydata.com/role: master ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp - postgres-operator.crunchydata.com/role: replica ---- -apiVersion: batch/v1 -kind: Job -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp - postgres-operator.crunchydata.com/pgbackrest-backup: replica-create -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/11-annotate.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/11-annotate.yaml deleted file mode 100644 index 844d5f1336..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/11-annotate.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Label instance pods with their current role. These labels will stick around - # because switchover does not recreate any pods. - - script: | - kubectl label --namespace="${NAMESPACE}" pods \ - --selector='postgres-operator.crunchydata.com/role=master' \ - 'testing/role-before=master' - - script: | - kubectl label --namespace="${NAMESPACE}" pods \ - --selector='postgres-operator.crunchydata.com/role=replica' \ - 'testing/role-before=replica' - - # Annotate the cluster to trigger a switchover. - - script: | - kubectl annotate --namespace="${NAMESPACE}" postgrescluster/delete-switchover-with-timestamp \ - "postgres-operator.crunchydata.com/trigger-switchover=$(date)" diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/12-assert.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/12-assert.yaml deleted file mode 100644 index 76f0f8dff6..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/12-assert.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# Wait for switchover to finish. A former replica should now be the primary. -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp - postgres-operator.crunchydata.com/data: postgres - postgres-operator.crunchydata.com/role: master - testing/role-before: replica ---- -# The former primary should now be a replica. -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp - postgres-operator.crunchydata.com/data: postgres - postgres-operator.crunchydata.com/role: replica - testing/role-before: master ---- -# All instances should be healthy. -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: delete-switchover-with-timestamp -status: - instances: - - name: instance1 - replicas: 2 - readyReplicas: 2 - updatedReplicas: 2 diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/13-delete-cluster-and-check.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/13-delete-cluster-and-check.yaml deleted file mode 100644 index 45352cca2e..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/13-delete-cluster-and-check.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Get the names of the current primary and replica -- error if either is blank - # Delete the cluster - # Get the delete event for the pods - # Verify that the replica delete event is greater than the primary delete event - - script: | - PRIMARY=$( - kubectl get pods --namespace="${NAMESPACE}" \ - --selector='postgres-operator.crunchydata.com/role=master' \ - --output=jsonpath={.items..metadata.name} - ) - - REPLICA=$( - kubectl get pods --namespace="${NAMESPACE}" \ - --selector='postgres-operator.crunchydata.com/role=replica' \ - --output=jsonpath={.items..metadata.name} - ) - - echo "DELETE: Found primary ${PRIMARY} and replica ${REPLICA} pods" - - if [ -z "$PRIMARY" ]; then exit 1; fi - if [ -z "$REPLICA" ]; then exit 1; fi - - kubectl delete postgrescluster -n "${NAMESPACE}" delete-switchover-with-timestamp - - kubectl wait "pod/${REPLICA}" --namespace "${NAMESPACE}" --for=delete --timeout=180s - - KILLING_REPLICA_TIMESTAMP=$( - kubectl get events --namespace="${NAMESPACE}" \ - --field-selector reason="Killing",involvedObject.fieldPath="spec.containers{database}",involvedObject.name="${REPLICA}" \ - --output=jsonpath={.items..firstTimestamp} - ) - - kubectl wait "pod/${PRIMARY}" --namespace "${NAMESPACE}" --for=delete --timeout=180s - - KILLING_PRIMARY_TIMESTAMP=$( - kubectl get events --namespace="${NAMESPACE}" \ - --field-selector reason="Killing",involvedObject.fieldPath="spec.containers{database}",involvedObject.name="${PRIMARY}" \ - --output=jsonpath={.items..firstTimestamp} - ) - - echo "DELETE: Found primary ${KILLING_PRIMARY_TIMESTAMP} and replica ${KILLING_REPLICA_TIMESTAMP} timestamps" - - if [[ "${KILLING_PRIMARY_TIMESTAMP}" < "${KILLING_REPLICA_TIMESTAMP}" ]]; then exit 1; fi diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/14-errors.yaml b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/14-errors.yaml deleted file mode 100644 index 2a1015824b..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/14-errors.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: delete-switchover-with-timestamp ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp ---- -# Patroni DCS objects are not owned by the PostgresCluster. -apiVersion: v1 -kind: Endpoints -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp ---- -apiVersion: v1 -kind: Service -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp ---- -apiVersion: v1 -kind: ConfigMap -metadata: - labels: - postgres-operator.crunchydata.com/cluster: delete-switchover-with-timestamp diff --git a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/README.md b/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/README.md deleted file mode 100644 index bf914aa6cf..0000000000 --- a/testing/kuttl/e2e-other/delete-with-replica-and-check-timestamps/README.md +++ /dev/null @@ -1,7 +0,0 @@ -This test originally existed as the second test-case in the `delete` KUTTL test. -The test as written was prone to occasional flakes, sometimes due to missing events -(which were being used to check the timestamp of the container delete event). - -After discussion, we decided that this behavior (replica deleting before the primary) -was no longer required in v5, and the decision was made to sequester this test-case for -further testing and refinement. \ No newline at end of file diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/00--create-cluster.yaml b/testing/kuttl/e2e-other/exporter-append-custom-queries/00--create-cluster.yaml deleted file mode 100644 index bc515e3534..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/00--create-cluster.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/exporter-append-queries-configmap.yaml -- files/exporter-append-queries-cluster.yaml -assert: -- files/exporter-append-queries-cluster-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/00-assert.yaml b/testing/kuttl/e2e-other/exporter-append-custom-queries/00-assert.yaml deleted file mode 100644 index 2655841597..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/00-assert.yaml +++ /dev/null @@ -1,50 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -# First, check that all containers in the instance pod are ready -# Then, list the query files mounted to the exporter and check for expected files -# Finally, check the contents of the queries to ensure queries.yml was generated correctly -- script: | - retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; } - check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; } - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - - pod=$(kubectl get pods -o name -n "${NAMESPACE}" \ - -l postgres-operator.crunchydata.com/cluster=exporter-append-queries \ - -l postgres-operator.crunchydata.com/crunchy-postgres-exporter=true) - [ "$pod" = "" ] && retry "Pod not found" && exit 1 - - condition_json=$(kubectl get "${pod}" -n "${NAMESPACE}" -o jsonpath="{.status.conditions}") - [ "$condition_json" = "" ] && retry "conditions not found" && exit 1 - { check_containers_ready "$condition_json"; } || { - retry "containers not ready" - exit 1 - } - - queries_files=$( - kubectl exec --namespace "${NAMESPACE}" "${pod}" -c exporter \ - -- ls /conf - ) - - { - contains "${queries_files}" "queries.yml" && - contains "${queries_files}" "defaultQueries.yml" - } || { - echo >&2 'The /conf directory should contain queries.yml and defaultQueries.yml. Instead it has:' - echo "${queries_files}" - exit 1 - } - - master_queries_contents=$( - kubectl exec --namespace "${NAMESPACE}" "${pod}" -c exporter \ - -- cat /tmp/queries.yml - ) - - { - contains "${master_queries_contents}" "# This is a test." && - contains "${master_queries_contents}" "ccp_postgresql_version" - } || { - echo >&2 'The master queries.yml file should contain the contents of both defaultQueries.yml and the custom queries.yml file. Instead it contains:' - echo "${master_queries_contents}" - exit 1 - } diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/README.md b/testing/kuttl/e2e-other/exporter-append-custom-queries/README.md deleted file mode 100644 index a24aa444c7..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Exporter - AppendCustomQueries Enabled - -Note: This series of tests depends on PGO being deployed with the AppendCustomQueries feature gate ON. There is a separate set of tests in e2e that tests exporter functionality without the AppendCustomQueries feature. - -When running this test, make sure that the PGO_FEATURE_GATES environment variable is set to "AppendCustomQueries=true" on the PGO Deployment. diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster-checks.yaml b/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster-checks.yaml deleted file mode 100644 index 459356ddfc..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster-checks.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter-append-queries -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: exporter-append-queries - postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true" -status: - phase: Running ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: exporter-append-queries-exporter-queries-config ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: custom-queries-test diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster.yaml b/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster.yaml deleted file mode 100644 index c4f75771aa..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-cluster.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter-append-queries -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - monitoring: - pgmonitor: - exporter: - configuration: - - configMap: - name: custom-queries-test diff --git a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-configmap.yaml b/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-configmap.yaml deleted file mode 100644 index 9964d6bc1e..0000000000 --- a/testing/kuttl/e2e-other/exporter-append-custom-queries/files/exporter-append-queries-configmap.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: custom-queries-test -data: - queries.yml: "# This is a test." diff --git a/testing/kuttl/e2e-other/exporter-replica/00--create-cluster.yaml b/testing/kuttl/e2e-other/exporter-replica/00--create-cluster.yaml deleted file mode 100644 index 2abec0814e..0000000000 --- a/testing/kuttl/e2e-other/exporter-replica/00--create-cluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/exporter-replica-cluster.yaml -assert: -- files/exporter-replica-cluster-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-replica/00-assert.yaml b/testing/kuttl/e2e-other/exporter-replica/00-assert.yaml deleted file mode 100644 index 280be2d395..0000000000 --- a/testing/kuttl/e2e-other/exporter-replica/00-assert.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -# First, check that all containers in the instance(s) pod are ready -# Then, grab the exporter metrics output and check that there were no scrape errors -# Finally, ensure the monitoring user exists and is configured -- script: | - retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; } - check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; } - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - - replica=$(kubectl get pods -o name -n "${NAMESPACE}" \ - -l postgres-operator.crunchydata.com/cluster=exporter-replica \ - -l postgres-operator.crunchydata.com/crunchy-postgres-exporter=true \ - -l postgres-operator.crunchydata.com/role=replica) - [ "$replica" = "" ] && retry "Replica Pod not found" && exit 1 - - replica_condition_json=$(kubectl get "${replica}" -n "${NAMESPACE}" -o jsonpath="{.status.conditions}") - [ "$replica_condition_json" = "" ] && retry "Replica conditions not found" && exit 1 - { - check_containers_ready "$replica_condition_json" - } || { - retry "containers not ready" - exit 1 - } - - scrape_metrics=$(kubectl exec ${replica} -c exporter -n ${NAMESPACE} -- \ - curl --silent http://localhost:9187/metrics | grep "pg_exporter_last_scrape_error") - { - contains "${scrape_metrics}" 'pg_exporter_last_scrape_error 0'; - } || { - retry "${scrape_metrics}" - exit 1 - } - - kubectl exec --stdin "${replica}" --namespace "${NAMESPACE}" -c database \ - -- psql -qb --set ON_ERROR_STOP=1 --file=- <<'SQL' - DO $$ - DECLARE - result record; - BEGIN - SELECT * INTO result FROM pg_catalog.pg_roles WHERE rolname = 'ccp_monitoring'; - ASSERT FOUND, 'user not found'; - END $$ - SQL diff --git a/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster-checks.yaml b/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster-checks.yaml deleted file mode 100644 index 7c775b47b1..0000000000 --- a/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster-checks.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter-replica -status: - instances: - - name: instance1 - readyReplicas: 2 - replicas: 2 - updatedReplicas: 2 ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: exporter-replica - postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true" -status: - phase: Running ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: exporter-replica-exporter-queries-config diff --git a/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster.yaml b/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster.yaml deleted file mode 100644 index 504d33bc3a..0000000000 --- a/testing/kuttl/e2e-other/exporter-replica/files/exporter-replica-cluster.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter-replica -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - replicas: 2 - dataVolumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - monitoring: - pgmonitor: - exporter: {} diff --git a/testing/kuttl/e2e-other/exporter-standby/00--create-certs.yaml b/testing/kuttl/e2e-other/exporter-standby/00--create-certs.yaml deleted file mode 100644 index 9c9cd140ac..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/00--create-certs.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/cluster-certs.yaml diff --git a/testing/kuttl/e2e-other/exporter-standby/01--create-primary.yaml b/testing/kuttl/e2e-other/exporter-standby/01--create-primary.yaml deleted file mode 100644 index 6b5b721d4e..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/01--create-primary.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/primary-cluster.yaml -assert: -- files/primary-cluster-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-standby/01-assert.yaml b/testing/kuttl/e2e-other/exporter-standby/01-assert.yaml deleted file mode 100644 index cd2d16c783..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/01-assert.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -# Store the exporter pid as an annotation on the pod -- script: | - retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; } - check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; } - - pod=$(kubectl get pods -o name -n $NAMESPACE \ - -l postgres-operator.crunchydata.com/cluster=primary-cluster \ - -l postgres-operator.crunchydata.com/crunchy-postgres-exporter=true) - [ "$pod" = "" ] && retry "Pod not found" && exit 1 - - condition_json=$(kubectl get ${pod} -n ${NAMESPACE} -o jsonpath="{.status.conditions}") - [ "$condition_json" = "" ] && retry "conditions not found" && exit 1 - { check_containers_ready "$condition_json"; } || { - retry "containers not ready" - exit 1 - } - - pid=$(kubectl exec ${pod} -n ${NAMESPACE} -c exporter -- cat /tmp/postgres_exporter.pid) - kubectl annotate --overwrite -n ${NAMESPACE} ${pod} oldpid=${pid} diff --git a/testing/kuttl/e2e-other/exporter-standby/02--set-primary-password.yaml b/testing/kuttl/e2e-other/exporter-standby/02--set-primary-password.yaml deleted file mode 100644 index 4e613a277f..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/02--set-primary-password.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/update-primary-password.yaml -assert: -- files/update-primary-password-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-standby/03--create-standby.yaml b/testing/kuttl/e2e-other/exporter-standby/03--create-standby.yaml deleted file mode 100644 index fa2e653353..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/03--create-standby.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/standby-cluster.yaml -assert: -- files/standby-cluster-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-standby/03-assert.yaml b/testing/kuttl/e2e-other/exporter-standby/03-assert.yaml deleted file mode 100644 index 327e5562fa..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/03-assert.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -# Grab the exporter pod -# Check that the postgres_exporter pid is running -# Store the exporter pid as an annotation on the pod -- script: | - retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; } - check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; } - - pod=$(kubectl get pods -o name -n $NAMESPACE \ - -l postgres-operator.crunchydata.com/cluster=standby-cluster,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true) - [ "$pod" = "" ] && retry "Pod not found" && exit 1 - - pid=$(kubectl exec ${pod} -n ${NAMESPACE} -c exporter -- cat /tmp/postgres_exporter.pid) - kubectl annotate --overwrite -n ${NAMESPACE} ${pod} oldpid=${pid} diff --git a/testing/kuttl/e2e-other/exporter-standby/04--set-standby-password.yaml b/testing/kuttl/e2e-other/exporter-standby/04--set-standby-password.yaml deleted file mode 100644 index 18c98e423e..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/04--set-standby-password.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/update-standby-password.yaml -assert: -- files/update-standby-password-checks.yaml diff --git a/testing/kuttl/e2e-other/exporter-standby/04-assert.yaml b/testing/kuttl/e2e-other/exporter-standby/04-assert.yaml deleted file mode 100644 index 7e77784a65..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/04-assert.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -# Grab the exporter pod -# Check that the postgres_exporter pid is running -# Store the exporter pid as an annotation on the pod -- script: | - retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; } - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - check_containers_ready() { bash -ceu ' echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@";} - - pod=$(kubectl get pods -o name -n $NAMESPACE \ - -l postgres-operator.crunchydata.com/cluster=standby-cluster,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true) - [ "$pod" = "" ] && retry "Pod not found" && exit 1 - - oldPid=$(kubectl get ${pod} -n ${NAMESPACE} -o jsonpath="{.metadata.annotations.oldpid}") - newPid=$(kubectl exec ${pod} -n ${NAMESPACE} -c exporter -- cat /tmp/postgres_exporter.pid) - [ "${oldPid}" -eq "${newPid}" ] && retry "pid should have changed" && exit 1 - - password=$(kubectl exec -n ${NAMESPACE} ${pod} -c exporter -- bash -c 'cat /opt/crunchy/password') - { contains "${password}" "password"; } || { - retry "unexpected password: ${password}" - exit 1 - } - - condition_json=$(kubectl get ${pod} -n ${NAMESPACE} -o jsonpath="{.status.conditions}") - [ "$condition_json" = "" ] && retry "conditions not found" && exit 1 - { check_containers_ready "$condition_json"; } || { - retry "containers not ready" - exit 1 - } - - scrape_metrics=$(kubectl exec ${pod} -c exporter -n ${NAMESPACE} -- \ - curl --silent http://localhost:9187/metrics | grep "pg_exporter_last_scrape_error") - { contains "${scrape_metrics}" 'pg_exporter_last_scrape_error 0'; } || { - retry "${scrape_metrics}" - exit 1 - } diff --git a/testing/kuttl/e2e-other/exporter-standby/README.md b/testing/kuttl/e2e-other/exporter-standby/README.md deleted file mode 100644 index 34df4e5b7a..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Exporter connection on standby cluster - -The exporter standby test will deploy two clusters, one primary and one standby. -Both clusters have monitoring enabled and are created in the same namespace to -allow for easy connections over the network. - -The `ccp_monitoring` password for both clusters are updated to match allowing -the exporter on the standby cluster to query postgres using the proper `ccp_monitoring` -password. diff --git a/testing/kuttl/e2e-other/exporter-standby/files/cluster-certs.yaml b/testing/kuttl/e2e-other/exporter-standby/files/cluster-certs.yaml deleted file mode 100644 index 1f8dd06ccf..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/cluster-certs.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -data: - ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJnakNDQVNlZ0F3SUJBZ0lRZUpacWMxMmR3TDh6cDNRVjZVMzg0ekFLQmdncWhrak9QUVFEQXpBZk1SMHcKR3dZRFZRUURFeFJ3YjNOMFozSmxjeTF2Y0dWeVlYUnZjaTFqWVRBZUZ3MHlNekEwTVRFeE56UTFNemhhRncwegpNekEwTURneE9EUTFNemhhTUI4eEhUQWJCZ05WQkFNVEZIQnZjM1JuY21WekxXOXdaWEpoZEc5eUxXTmhNRmt3CkV3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFWEZwMU1nOFQ0aWxFRFlleVh4Nm5hRU0weEtNUStNZU0KWnM3dUtockdmTnY1cVd3N0puNzJEMEZNWE9raVNTN1BsZUhtN1lwYk1lelZ4UytjLzV6a2NLTkZNRU13RGdZRApWUjBQQVFIL0JBUURBZ0VHTUJJR0ExVWRFd0VCL3dRSU1BWUJBZjhDQVFBd0hRWURWUjBPQkJZRUZGU2JSZzdXCnpIZFdIODN2aEtTcld3dGV4K2FtTUFvR0NDcUdTTTQ5QkFNREEwa0FNRVlDSVFDK3pXTHh4bmpna1ZYYzBFOVAKbWlmZm9jeTIrM3AxREZMUkJRcHlZNFE0RVFJaEFPSDhQVEtvWnRZUWlobVlqTkd3Q1J3aTgvVFRaYWIxSnVIMAo2YnpodHZobgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== - tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNQakNDQWVXZ0F3SUJBZ0lSQU93NURHaGVVZnVNY25KYVdKNkllall3Q2dZSUtvWkl6ajBFQXdNd0h6RWQKTUJzR0ExVUVBeE1VY0c5emRHZHlaWE10YjNCbGNtRjBiM0l0WTJFd0hoY05Nak13TkRFeE1UYzBOVE01V2hjTgpNek13TkRBNE1UZzBOVE01V2pBOU1Uc3dPUVlEVlFRREV6SndjbWx0WVhKNUxXTnNkWE4wWlhJdGNISnBiV0Z5CmVTNWtaV1poZFd4MExuTjJZeTVqYkhWemRHVnlMbXh2WTJGc0xqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDkKQXdFSEEwSUFCT3RlNytQWFlDci9RQVJkcHlwYTFHcEpkbW5wOFN3ZG9FOTIzUXoraWt4UllTalgwUHBXcytqUQpVNXlKZ0NDdGxyZmxFZVZ4S2YzaVpiVHdadFlIaHVxamdlTXdnZUF3RGdZRFZSMFBBUUgvQkFRREFnV2dNQXdHCkExVWRFd0VCL3dRQ01BQXdId1lEVlIwakJCZ3dGb0FVVkp0R0R0Yk1kMVlmemUrRXBLdGJDMTdINXFZd2daNEcKQTFVZEVRU0JsakNCazRJeWNISnBiV0Z5ZVMxamJIVnpkR1Z5TFhCeWFXMWhjbmt1WkdWbVlYVnNkQzV6ZG1NdQpZMngxYzNSbGNpNXNiMk5oYkM2Q0kzQnlhVzFoY25rdFkyeDFjM1JsY2kxd2NtbHRZWEo1TG1SbFptRjFiSFF1CmMzWmpnaDl3Y21sdFlYSjVMV05zZFhOMFpYSXRjSEpwYldGeWVTNWtaV1poZFd4MGdoZHdjbWx0WVhKNUxXTnMKZFhOMFpYSXRjSEpwYldGeWVUQUtCZ2dxaGtqT1BRUURBd05IQURCRUFpQjA3Q3YzRHJTNXUxRFdaek1MQjdvbAppcjFFWEpQTnFaOXZWQUF5ZTdDMGJRSWdWQVlDM2F0ekl4a0syNHlQUU1TSjU1OGFaN3JEdkZGZXdOaVpmdSt0CjdETT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUoxYkNXMTByR3o2VWQ1K2R3WmZWcGNUNFlqck9XVG1iVW9XNXRxYTA2b1ZvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFNjE3djQ5ZGdLdjlBQkYybktsclVha2wyYWVueExCMmdUM2JkRFA2S1RGRmhLTmZRK2xhego2TkJUbkltQUlLMld0K1VSNVhFcC9lSmx0UEJtMWdlRzZnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= -kind: Secret -metadata: - name: cluster-cert -type: Opaque ---- -apiVersion: v1 -data: - ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJnakNDQVNlZ0F3SUJBZ0lRZUpacWMxMmR3TDh6cDNRVjZVMzg0ekFLQmdncWhrak9QUVFEQXpBZk1SMHcKR3dZRFZRUURFeFJ3YjNOMFozSmxjeTF2Y0dWeVlYUnZjaTFqWVRBZUZ3MHlNekEwTVRFeE56UTFNemhhRncwegpNekEwTURneE9EUTFNemhhTUI4eEhUQWJCZ05WQkFNVEZIQnZjM1JuY21WekxXOXdaWEpoZEc5eUxXTmhNRmt3CkV3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFWEZwMU1nOFQ0aWxFRFlleVh4Nm5hRU0weEtNUStNZU0KWnM3dUtockdmTnY1cVd3N0puNzJEMEZNWE9raVNTN1BsZUhtN1lwYk1lelZ4UytjLzV6a2NLTkZNRU13RGdZRApWUjBQQVFIL0JBUURBZ0VHTUJJR0ExVWRFd0VCL3dRSU1BWUJBZjhDQVFBd0hRWURWUjBPQkJZRUZGU2JSZzdXCnpIZFdIODN2aEtTcld3dGV4K2FtTUFvR0NDcUdTTTQ5QkFNREEwa0FNRVlDSVFDK3pXTHh4bmpna1ZYYzBFOVAKbWlmZm9jeTIrM3AxREZMUkJRcHlZNFE0RVFJaEFPSDhQVEtvWnRZUWlobVlqTkd3Q1J3aTgvVFRaYWIxSnVIMAo2YnpodHZobgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== - tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJqekNDQVRTZ0F3SUJBZ0lRRzA0MEprWjYwZkZtanpaVG1SekhyakFLQmdncWhrak9QUVFEQXpBZk1SMHcKR3dZRFZRUURFeFJ3YjNOMFozSmxjeTF2Y0dWeVlYUnZjaTFqWVRBZUZ3MHlNekEwTVRFeE56UTFNemhhRncwegpNekEwTURneE9EUTFNemhhTUJjeEZUQVRCZ05WQkFNTURGOWpjblZ1WTJoNWNtVndiREJaTUJNR0J5cUdTTTQ5CkFnRUdDQ3FHU000OUF3RUhBMElBQk5HVHcvSmVtaGxGK28xUlRBb0VXSndzdjJ6WjIyc1p4N2NjT2VmL1NXdjYKeXphYkpaUmkvREFyK0kwUHNyTlhmand3a0xMa3hERGZsTklvcFZMNVYwT2pXakJZTUE0R0ExVWREd0VCL3dRRQpBd0lGb0RBTUJnTlZIUk1CQWY4RUFqQUFNQjhHQTFVZEl3UVlNQmFBRkZTYlJnN1d6SGRXSDgzdmhLU3JXd3RlCngrYW1NQmNHQTFVZEVRUVFNQTZDREY5amNuVnVZMmg1Y21Wd2JEQUtCZ2dxaGtqT1BRUURBd05KQURCR0FpRUEKcWVsYmUvdTQzRFRPWFdlell1b3Nva0dUbHg1U2ljUFRkNk05Q3pwU2VoWUNJUUNOOS91Znc0SUZzdDZOM1RtYQo4MmZpSElKSUpQY0RjM2ZKUnFna01RQmF0QT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K - tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSVBxeTVzNVJxWThKUmdycjJreE9zaG9hc25yTWhUUkJPYjZ0alI3T2ZqTFlvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFMFpQRDhsNmFHVVg2alZGTUNnUlluQ3kvYk5uYmF4bkh0eHc1NS85SmEvckxOcHNsbEdMOApNQ3Y0alEreXMxZCtQRENRc3VURU1OK1UwaWlsVXZsWFF3PT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= -kind: Secret -metadata: - name: replication-cert -type: Opaque diff --git a/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster-checks.yaml b/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster-checks.yaml deleted file mode 100644 index c2a59244a5..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster-checks.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: primary-cluster -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: primary-cluster - postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true" -status: - phase: Running diff --git a/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster.yaml b/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster.yaml deleted file mode 100644 index 8f51632f5b..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/primary-cluster.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: primary-cluster -spec: - postgresVersion: ${KUTTL_PG_VERSION} - customTLSSecret: - name: cluster-cert - customReplicationTLSSecret: - name: replication-cert - instances: - - name: instance1 - dataVolumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - monitoring: - pgmonitor: - exporter: {} diff --git a/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster-checks.yaml b/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster-checks.yaml deleted file mode 100644 index 237dec721e..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster-checks.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: standby-cluster -status: - instances: - - name: instance1 - replicas: 1 - updatedReplicas: 1 - # The cluster should not become fully ready in this step, the ccp_monitoring password - # on the standby does not match the primary ---- -apiVersion: v1 -kind: Pod -metadata: - labels: - postgres-operator.crunchydata.com/cluster: standby-cluster - postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true" -status: - phase: Running diff --git a/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster.yaml b/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster.yaml deleted file mode 100644 index 33e9ec2c2c..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/standby-cluster.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: standby-cluster -spec: - postgresVersion: ${KUTTL_PG_VERSION} - standby: - enabled: true - host: primary-cluster-primary - customTLSSecret: - name: cluster-cert - customReplicationTLSSecret: - name: replication-cert - instances: - - name: instance1 - dataVolumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: { accessModes: [ReadWriteOnce], resources: { requests: { storage: 1Gi } } } - monitoring: - pgmonitor: - exporter: {} diff --git a/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password-checks.yaml b/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password-checks.yaml deleted file mode 100644 index 1ef72b49c9..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password-checks.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: primary-cluster-monitoring - labels: - postgres-operator.crunchydata.com/cluster: primary-cluster - postgres-operator.crunchydata.com/role: monitoring - ownerReferences: - - apiVersion: postgres-operator.crunchydata.com/v1beta1 - blockOwnerDeletion: true - controller: true - kind: PostgresCluster - name: primary-cluster -data: - # ensure the password is encoded to 'password' - password: cGFzc3dvcmQ= ---- -# TODO: Check that password is set as a file diff --git a/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password.yaml b/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password.yaml deleted file mode 100644 index a66450b103..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/update-primary-password.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: primary-cluster-monitoring - labels: - postgres-operator.crunchydata.com/cluster: primary-cluster - postgres-operator.crunchydata.com/role: monitoring -stringData: - password: password -data: -# Ensure data field is deleted so that password/verifier will be regenerated diff --git a/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password-checks.yaml b/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password-checks.yaml deleted file mode 100644 index 34d5357318..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password-checks.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: standby-cluster-monitoring - labels: - postgres-operator.crunchydata.com/cluster: standby-cluster - postgres-operator.crunchydata.com/role: monitoring - ownerReferences: - - apiVersion: postgres-operator.crunchydata.com/v1beta1 - blockOwnerDeletion: true - controller: true - kind: PostgresCluster - name: standby-cluster -data: - # ensure the password is encoded to 'password' - password: cGFzc3dvcmQ= ---- -# TODO: Check that password is set as a file diff --git a/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password.yaml b/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password.yaml deleted file mode 100644 index 57371fce93..0000000000 --- a/testing/kuttl/e2e-other/exporter-standby/files/update-standby-password.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: standby-cluster-monitoring - labels: - postgres-operator.crunchydata.com/cluster: standby-cluster - postgres-operator.crunchydata.com/role: monitoring -stringData: - password: password -data: -# Ensure data field is deleted so that password/verifier will be regenerated diff --git a/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml b/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml deleted file mode 100644 index 0e53eab2de..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter -spec: - postgresVersion: 14 - image: us.gcr.io/container-suite/crunchy-postgres:ubi8-14.0-5.0.3-0 - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - monitoring: - pgmonitor: - exporter: - image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.3.1-0 diff --git a/testing/kuttl/e2e-other/exporter-upgrade/00-assert.yaml b/testing/kuttl/e2e-other/exporter-upgrade/00-assert.yaml deleted file mode 100644 index c569c97454..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/00-assert.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 diff --git a/testing/kuttl/e2e-other/exporter-upgrade/01--check-exporter.yaml b/testing/kuttl/e2e-other/exporter-upgrade/01--check-exporter.yaml deleted file mode 100644 index 0e72f2a0bf..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/01--check-exporter.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - set -e - PRIMARY=$( - kubectl get pod --namespace "${NAMESPACE}" \ - --output name --selector ' - postgres-operator.crunchydata.com/cluster=exporter, - postgres-operator.crunchydata.com/role=master' - ) - - # Ensure that the metrics endpoint is available from inside the exporter container - for i in {1..5}; do - kubectl exec --namespace "${NAMESPACE}" "${PRIMARY}" -c exporter -- curl http://localhost:9187/metrics - sleep 2 - done - - # Ensure that the monitoring user exists and is configured. - kubectl exec --stdin --namespace "${NAMESPACE}" "${PRIMARY}" \ - -- psql -qb --set ON_ERROR_STOP=1 --file=- <<'SQL' - DO $$ - DECLARE - result record; - BEGIN - SELECT * INTO result FROM pg_catalog.pg_roles WHERE rolname = 'ccp_monitoring'; - ASSERT FOUND, 'user not found'; - ASSERT result.rolconfig @> '{jit=off}', format('got config: %L', result.rolconfig); - END $$ - SQL diff --git a/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml b/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml deleted file mode 100644 index cde17d80b4..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter -spec: - postgresVersion: 14 - image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.5-1 diff --git a/testing/kuttl/e2e-other/exporter-upgrade/02-assert.yaml b/testing/kuttl/e2e-other/exporter-upgrade/02-assert.yaml deleted file mode 100644 index 9ad238b944..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/02-assert.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: exporter -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: batch/v1 -kind: Job -metadata: - labels: - postgres-operator.crunchydata.com/cluster: exporter - postgres-operator.crunchydata.com/pgbackrest-backup: replica-create -status: - succeeded: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: exporter-primary diff --git a/testing/kuttl/e2e-other/exporter-upgrade/03--check-exporter.yaml b/testing/kuttl/e2e-other/exporter-upgrade/03--check-exporter.yaml deleted file mode 100644 index 8161e463fc..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/03--check-exporter.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - PRIMARY=$( - kubectl get pod --namespace "${NAMESPACE}" \ - --output name --selector ' - postgres-operator.crunchydata.com/cluster=exporter, - postgres-operator.crunchydata.com/role=master' - ) - - # Get errors from the exporter - # See the README.md for a discussion of these errors - ERR=$(kubectl logs --namespace "${NAMESPACE}" "${PRIMARY}" -c exporter | grep -e "Error running query on database") - ERR_COUNT=$(echo "$ERR" | wc -l) - - if [[ "$ERR_COUNT" -gt 2 ]]; then - echo "Errors in log from exporter: ${ERR}" - exit 1 - fi diff --git a/testing/kuttl/e2e-other/exporter-upgrade/README.md b/testing/kuttl/e2e-other/exporter-upgrade/README.md deleted file mode 100644 index fefe28a95c..0000000000 --- a/testing/kuttl/e2e-other/exporter-upgrade/README.md +++ /dev/null @@ -1,31 +0,0 @@ -The exporter-upgrade test makes sure that PGO updates an extension used for monitoring. This -avoids an error where a user might update to a new PG image with a newer extension, but with an -older extension operative. - -Note: This test relies on two `crunchy-postgres` images with known, different `pgnodemx` extensions: -the image created in 00--cluster.yaml has `pgnodemx` 1.1; the image we update the cluster to in -02--update-cluster.yaml has `pgnodemx` 1.3. - -00-01 -This starts up a cluster with a purposely outdated `pgnodemx` extension. Because we want a specific -extension, the image used here is hard-coded (and so outdated it's not publicly available). - -(This image is so outdated that it doesn't finish creating a backup with the current PGO, which is -why the 00-assert.yaml only checks that the pod is ready; and why 01--check-exporter.yaml wraps the -call in a retry loop.) - -02-03 -The cluster is updated with a newer (and hardcoded) image with a newer version of `pgnodemx`. Due -to the change made in https://github.com/CrunchyData/postgres-operator/pull/3400, this should no -longer produce multiple errors. - -Note: a few errors may be logged after the `exporter` container attempts to run the `pgnodemx` -functions but before the extension is updated. So this checks that there are no more than 2 errors, -since that was the observed maximum number of printed errors during manual tests of the check. - -For instance, using these hardcoded images (with `pgnodemx` versions 1.1 and 1.3), those errors were: - -``` -Error running query on database \"localhost:5432\": ccp_nodemx_disk_activity pq: query-specified return tuple and function return type are not compatible" -Error running query on database \"localhost:5432\": ccp_nodemx_data_disk pq: query-specified return tuple and function return type are not compatible -``` diff --git a/testing/kuttl/e2e-other/gssapi/00-assert.yaml b/testing/kuttl/e2e-other/gssapi/00-assert.yaml deleted file mode 100644 index ea828be0c4..0000000000 --- a/testing/kuttl/e2e-other/gssapi/00-assert.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: krb5 ---- -apiVersion: v1 -kind: Secret -metadata: - name: krb5-keytab diff --git a/testing/kuttl/e2e-other/gssapi/00-krb5-keytab.yaml b/testing/kuttl/e2e-other/gssapi/00-krb5-keytab.yaml deleted file mode 100644 index 6311193d55..0000000000 --- a/testing/kuttl/e2e-other/gssapi/00-krb5-keytab.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- command: kubectl exec -n krb5 -it krb5-kdc-0 -- /krb5-scripts/krb5.sh "${NAMESPACE}" diff --git a/testing/kuttl/e2e-other/gssapi/01-assert.yaml b/testing/kuttl/e2e-other/gssapi/01-assert.yaml deleted file mode 100644 index dbda953ead..0000000000 --- a/testing/kuttl/e2e-other/gssapi/01-assert.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: gssapi -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: gssapi-primary diff --git a/testing/kuttl/e2e-other/gssapi/01-cluster.yaml b/testing/kuttl/e2e-other/gssapi/01-cluster.yaml deleted file mode 100644 index 8acfe46c4d..0000000000 --- a/testing/kuttl/e2e-other/gssapi/01-cluster.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: gssapi -spec: - config: - files: - - secret: - name: krb5-keytab - - configMap: - name: krb5 - patroni: - dynamicConfiguration: - postgresql: - pg_hba: - - host postgres postgres 0.0.0.0/0 scram-sha-256 - - host all krb5hippo@PGO.CRUNCHYDATA.COM 0.0.0.0/0 gss - parameters: - krb_server_keyfile: /etc/postgres/krb5.keytab - users: - - name: postgres - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/gssapi/02-assert.yaml b/testing/kuttl/e2e-other/gssapi/02-assert.yaml deleted file mode 100644 index 36f85d95d4..0000000000 --- a/testing/kuttl/e2e-other/gssapi/02-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: psql-connect-gssapi -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/gssapi/02-psql-connect.yaml b/testing/kuttl/e2e-other/gssapi/02-psql-connect.yaml deleted file mode 100644 index 30f02b3b19..0000000000 --- a/testing/kuttl/e2e-other/gssapi/02-psql-connect.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: psql-connect-gssapi -spec: - backoffLimit: 6 - template: - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - command: - - bash - - -c - - -- - - |- - psql -c 'create user "krb5hippo@PGO.CRUNCHYDATA.COM";' - kinit -k -t /krb5-conf/krb5.keytab krb5hippo@PGO.CRUNCHYDATA.COM - psql -U krb5hippo@PGO.CRUNCHYDATA.COM -h gssapi-primary.$(NAMESPACE).svc.cluster.local -d postgres \ - -c 'select version();' - env: - - name: NAMESPACE - valueFrom: { fieldRef: { fieldPath: metadata.namespace } } - - name: PGHOST - valueFrom: { secretKeyRef: { name: gssapi-pguser-postgres, key: host } } - - name: PGPORT - valueFrom: { secretKeyRef: { name: gssapi-pguser-postgres, key: port } } - - name: PGUSER - valueFrom: { secretKeyRef: { name: gssapi-pguser-postgres, key: user } } - - name: PGPASSWORD - valueFrom: { secretKeyRef: { name: gssapi-pguser-postgres, key: password } } - - name: PGDATABASE - value: postgres - - name: KRB5_CONFIG - value: /krb5-conf/krb5.conf - volumeMounts: - - name: krb5-conf - mountPath: /krb5-conf - volumes: - - name: krb5-conf - projected: - sources: - - configMap: - name: krb5 - - secret: - name: krb5-keytab diff --git a/testing/kuttl/e2e-other/gssapi/README.md b/testing/kuttl/e2e-other/gssapi/README.md deleted file mode 100644 index 72d8d2b997..0000000000 --- a/testing/kuttl/e2e-other/gssapi/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# GSSAPI Authentication - -This test verifies that it is possible to properly configure PostgreSQL for GSSAPI -authentication. This is done by configuring a PostgresCluster for GSSAPI authentication, -and then utilizing a Kerberos ticket that has been issued by a Kerberos KDC server to log into -PostgreSQL. - -## Assumptions - -- A Kerberos Key Distribution Center (KDC) Pod named `krb5-kdc-0` is deployed inside of a `krb5` -namespace within the Kubernetes cluster -- The KDC server (`krb5-kdc-0`) contains a `/krb5-conf/krb5.sh` script that can be run as part -of the test to create the Kerberos principals, keytab secret and client configuration needed to -successfully run the test diff --git a/testing/kuttl/e2e-other/postgis-cluster/00--cluster.yaml b/testing/kuttl/e2e-other/postgis-cluster/00--cluster.yaml deleted file mode 100644 index 8dc88788bc..0000000000 --- a/testing/kuttl/e2e-other/postgis-cluster/00--cluster.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: postgis -spec: - postgresVersion: ${KUTTL_PG_VERSION} - postGISVersion: "${KUTTL_POSTGIS_VERSION}" - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/postgis-cluster/00-assert.yaml b/testing/kuttl/e2e-other/postgis-cluster/00-assert.yaml deleted file mode 100644 index b0bda7753f..0000000000 --- a/testing/kuttl/e2e-other/postgis-cluster/00-assert.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: postgis -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: batch/v1 -kind: Job -metadata: - labels: - postgres-operator.crunchydata.com/cluster: postgis - postgres-operator.crunchydata.com/pgbackrest-backup: replica-create -status: - succeeded: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: postgis-primary diff --git a/testing/kuttl/e2e-other/postgis-cluster/01--psql-connect.yaml b/testing/kuttl/e2e-other/postgis-cluster/01--psql-connect.yaml deleted file mode 100644 index 814958a9f6..0000000000 --- a/testing/kuttl/e2e-other/postgis-cluster/01--psql-connect.yaml +++ /dev/null @@ -1,132 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: psql-postgis-connect -spec: - backoffLimit: 6 - template: - metadata: - labels: { postgres-operator-test: kuttl } - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - env: - - name: PGHOST - valueFrom: { secretKeyRef: { name: postgis-pguser-postgis, key: host } } - - name: PGPORT - valueFrom: { secretKeyRef: { name: postgis-pguser-postgis, key: port } } - - name: PGDATABASE - valueFrom: { secretKeyRef: { name: postgis-pguser-postgis, key: dbname } } - - name: PGUSER - valueFrom: { secretKeyRef: { name: postgis-pguser-postgis, key: user } } - - name: PGPASSWORD - valueFrom: { secretKeyRef: { name: postgis-pguser-postgis, key: password } } - - { name: GIS_VERSION, value: "${KUTTL_POSTGIS_VERSION}" } - # Do not wait indefinitely. - - { name: PGCONNECT_TIMEOUT, value: '5' } - command: - - bash - - -c - - | - # Ensure PostGIS version is set - GIS_VERSION=${KUTTL_POSTGIS_VERSION} - GIS_VERSION=${GIS_VERSION:-notset} - - # check version - RESULT=$(psql -c "DO \$\$ - DECLARE - result boolean; - BEGIN - SELECT postgis_version() LIKE '%${GIS_VERSION}%' INTO result; - ASSERT result = 't', 'PostGIS version incorrect'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - # check full version - RESULT=$(psql -c "DO \$\$ - DECLARE - result boolean; - BEGIN - SELECT postgis_full_version() LIKE 'POSTGIS=\"%${GIS_VERSION}%' INTO result; - ASSERT result = 't', 'PostGIS full version incorrect'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - # check expected schemas (tiger, tiger_data and topology) - # - https://www.postgresql.org/docs/current/catalog-pg-namespace.html - RESULT=$(psql -c "DO \$\$ - DECLARE - result text; - BEGIN - SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname='tiger' INTO result; - ASSERT result = 'tiger', 'PostGIS tiger schema missing'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - RESULT=$(psql -c "DO \$\$ - DECLARE - result text; - BEGIN - SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname='tiger_data' INTO result; - ASSERT result = 'tiger_data', 'PostGIS tiger_data schema missing'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - RESULT=$(psql -c "DO \$\$ - DECLARE - result text; - BEGIN - SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname='topology' INTO result; - ASSERT result = 'topology', 'PostGIS topology schema missing'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - # check point creation - RESULT=$(psql -c "DO \$\$ - DECLARE - result text; - BEGIN - SELECT pg_typeof(ST_MakePoint(28.385200,-81.563900)) INTO result; - ASSERT result = 'geometry', 'Unable to create PostGIS point'; - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi - - # check GeoJSON function - RESULT=$(psql -c "DO \$\$ - DECLARE - result text; - BEGIN - SELECT ST_AsGeoJSON('SRID=4326;POINT(-118.4079 33.9434)'::geography) INTO result; - ASSERT result = '{\"type\":\"Point\",\"coordinates\":[-118.4079,33.9434]}', FORMAT('GeoJSON check failed, got %L', result); - END \$\$;" 2>&1) - - if [[ "$RESULT" == *"ERROR"* ]]; then - echo "$RESULT" - exit 1 - fi diff --git a/testing/kuttl/e2e-other/postgis-cluster/01-assert.yaml b/testing/kuttl/e2e-other/postgis-cluster/01-assert.yaml deleted file mode 100644 index 22e9e6f9de..0000000000 --- a/testing/kuttl/e2e-other/postgis-cluster/01-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: psql-postgis-connect -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/replica-service/00-base-cluster.yaml b/testing/kuttl/e2e-other/replica-service/00-base-cluster.yaml deleted file mode 100644 index 725f40de14..0000000000 --- a/testing/kuttl/e2e-other/replica-service/00-base-cluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/base-cluster.yaml -assert: -- files/base-check.yaml diff --git a/testing/kuttl/e2e-other/replica-service/01-node-port.yaml b/testing/kuttl/e2e-other/replica-service/01-node-port.yaml deleted file mode 100644 index c80e947e40..0000000000 --- a/testing/kuttl/e2e-other/replica-service/01-node-port.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/np-cluster.yaml -assert: -- files/np-check.yaml diff --git a/testing/kuttl/e2e-other/replica-service/02-loadbalancer.yaml b/testing/kuttl/e2e-other/replica-service/02-loadbalancer.yaml deleted file mode 100644 index f1433111db..0000000000 --- a/testing/kuttl/e2e-other/replica-service/02-loadbalancer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/lb-cluster.yaml -assert: -- files/lb-check.yaml diff --git a/testing/kuttl/e2e-other/replica-service/03-cluster-ip.yaml b/testing/kuttl/e2e-other/replica-service/03-cluster-ip.yaml deleted file mode 100644 index de6055ea6b..0000000000 --- a/testing/kuttl/e2e-other/replica-service/03-cluster-ip.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/cip-cluster.yaml -assert: -- files/cip-check.yaml diff --git a/testing/kuttl/e2e-other/replica-service/files/base-check.yaml b/testing/kuttl/e2e-other/replica-service/files/base-check.yaml deleted file mode 100644 index a83fce0f57..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/base-check.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: service -status: - instances: - - name: instance1 - readyReplicas: 2 - replicas: 2 - updatedReplicas: 2 ---- -apiVersion: v1 -kind: Service -metadata: - name: service-replicas diff --git a/testing/kuttl/e2e-other/replica-service/files/base-cluster.yaml b/testing/kuttl/e2e-other/replica-service/files/base-cluster.yaml deleted file mode 100644 index 67c4481d2f..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/base-cluster.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: service -spec: - postgresVersion: ${KUTTL_PG_VERSION} - replicaService: - type: ClusterIP - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 0.5Gi - replicas: 2 - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 0.5Gi diff --git a/testing/kuttl/e2e-other/replica-service/files/cip-check.yaml b/testing/kuttl/e2e-other/replica-service/files/cip-check.yaml deleted file mode 100644 index 5bf5422bb8..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/cip-check.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: service-replicas -spec: - type: ClusterIP - selector: - postgres-operator.crunchydata.com/cluster: service - postgres-operator.crunchydata.com/role: replica diff --git a/testing/kuttl/e2e-other/replica-service/files/cip-cluster.yaml b/testing/kuttl/e2e-other/replica-service/files/cip-cluster.yaml deleted file mode 100644 index 8545aa8223..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/cip-cluster.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: service -spec: - replicaService: - type: ClusterIP - nodePort: null diff --git a/testing/kuttl/e2e-other/replica-service/files/lb-check.yaml b/testing/kuttl/e2e-other/replica-service/files/lb-check.yaml deleted file mode 100644 index b8519491c7..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/lb-check.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: service-replicas -spec: - type: LoadBalancer - selector: - postgres-operator.crunchydata.com/cluster: service - postgres-operator.crunchydata.com/role: replica diff --git a/testing/kuttl/e2e-other/replica-service/files/lb-cluster.yaml b/testing/kuttl/e2e-other/replica-service/files/lb-cluster.yaml deleted file mode 100644 index 5e18f71dcd..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/lb-cluster.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: service -spec: - replicaService: - type: LoadBalancer - nodePort: null diff --git a/testing/kuttl/e2e-other/replica-service/files/np-check.yaml b/testing/kuttl/e2e-other/replica-service/files/np-check.yaml deleted file mode 100644 index c7d791e36a..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/np-check.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: service-replicas -spec: - type: NodePort - ports: - - name: postgres - port: 5432 - protocol: TCP - targetPort: postgres - selector: - postgres-operator.crunchydata.com/cluster: service - postgres-operator.crunchydata.com/role: replica diff --git a/testing/kuttl/e2e-other/replica-service/files/np-cluster.yaml b/testing/kuttl/e2e-other/replica-service/files/np-cluster.yaml deleted file mode 100644 index 0b20ae63ad..0000000000 --- a/testing/kuttl/e2e-other/replica-service/files/np-cluster.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: service -spec: - replicaService: - type: NodePort diff --git a/testing/kuttl/e2e-other/resize-volume/00-assert.yaml b/testing/kuttl/e2e-other/resize-volume/00-assert.yaml deleted file mode 100644 index b4372b75e7..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/00-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Ensure that the default StorageClass supports VolumeExpansion -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - annotations: - storageclass.kubernetes.io/is-default-class: "true" -allowVolumeExpansion: true diff --git a/testing/kuttl/e2e-other/resize-volume/01--cluster.yaml b/testing/kuttl/e2e-other/resize-volume/01--cluster.yaml deleted file mode 100644 index 4737fb25f4..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/01--cluster.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-up -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/resize-volume/01-assert.yaml b/testing/kuttl/e2e-other/resize-volume/01-assert.yaml deleted file mode 100644 index ea72af469c..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/01-assert.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-up -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: batch/v1 -kind: Job -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-up - postgres-operator.crunchydata.com/pgbackrest-backup: replica-create -status: - succeeded: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: resize-volume-up-primary ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-up - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 1Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 1Gi - phase: Bound ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-up - postgres-operator.crunchydata.com/data: pgbackrest - postgres-operator.crunchydata.com/pgbackrest-repo: repo1 -spec: - resources: - requests: - storage: 1Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 1Gi - phase: Bound diff --git a/testing/kuttl/e2e-other/resize-volume/02--create-data.yaml b/testing/kuttl/e2e-other/resize-volume/02--create-data.yaml deleted file mode 100644 index c41a6f80c4..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/02--create-data.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -# Create some data that should be present after resizing. -apiVersion: batch/v1 -kind: Job -metadata: - name: create-data - labels: { postgres-operator-test: kuttl } -spec: - backoffLimit: 3 - template: - metadata: - labels: { postgres-operator-test: kuttl } - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - env: - - name: PGURI - valueFrom: { secretKeyRef: { name: resize-volume-up-pguser-resize-volume-up, key: uri } } - - # Do not wait indefinitely. - - { name: PGCONNECT_TIMEOUT, value: '5' } - - command: - - psql - - $(PGURI) - - --set=ON_ERROR_STOP=1 - - --command - - | - CREATE TABLE important (data) AS VALUES ('treasure'); diff --git a/testing/kuttl/e2e-other/resize-volume/02-assert.yaml b/testing/kuttl/e2e-other/resize-volume/02-assert.yaml deleted file mode 100644 index fdb42e68f5..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/02-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: create-data -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/resize-volume/03--resize.yaml b/testing/kuttl/e2e-other/resize-volume/03--resize.yaml deleted file mode 100644 index dd7c96901f..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/03--resize.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-up -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 2Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 2Gi diff --git a/testing/kuttl/e2e-other/resize-volume/03-assert.yaml b/testing/kuttl/e2e-other/resize-volume/03-assert.yaml deleted file mode 100644 index 11aa230cd4..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/03-assert.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# We know that the PVC sizes have change so now we can check that they have been -# updated to have the expected size ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-up - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-up - postgres-operator.crunchydata.com/data: pgbackrest - postgres-operator.crunchydata.com/pgbackrest-repo: repo1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound diff --git a/testing/kuttl/e2e-other/resize-volume/06--check-data.yaml b/testing/kuttl/e2e-other/resize-volume/06--check-data.yaml deleted file mode 100644 index 682a46ef4d..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/06--check-data.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -# Confirm that all the data still exists. -apiVersion: batch/v1 -kind: Job -metadata: - name: check-data - labels: { postgres-operator-test: kuttl } -spec: - backoffLimit: 3 - template: - metadata: - labels: { postgres-operator-test: kuttl } - spec: - restartPolicy: Never - containers: - - name: psql - image: ${KUTTL_PSQL_IMAGE} - env: - - name: PGURI - valueFrom: { secretKeyRef: { name: resize-volume-up-pguser-resize-volume-up, key: uri } } - - # Do not wait indefinitely. - - { name: PGCONNECT_TIMEOUT, value: '5' } - - # Confirm that all the data still exists. - # Note: the `$$$$` is reduced to `$$` by Kubernetes. - # - https://kubernetes.io/docs/tasks/inject-data-application/ - command: - - psql - - $(PGURI) - - --set=ON_ERROR_STOP=1 - - --command - - | - DO $$$$ - DECLARE - keep_data jsonb; - BEGIN - SELECT jsonb_agg(important) INTO keep_data FROM important; - ASSERT keep_data = '[{"data":"treasure"}]', format('got %L', keep_data); - END $$$$; diff --git a/testing/kuttl/e2e-other/resize-volume/06-assert.yaml b/testing/kuttl/e2e-other/resize-volume/06-assert.yaml deleted file mode 100644 index cf743b8701..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/06-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: check-data -status: - succeeded: 1 diff --git a/testing/kuttl/e2e-other/resize-volume/11--cluster.yaml b/testing/kuttl/e2e-other/resize-volume/11--cluster.yaml deleted file mode 100644 index 8d2d602ca6..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/11--cluster.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-down -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 2Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 2Gi diff --git a/testing/kuttl/e2e-other/resize-volume/11-assert.yaml b/testing/kuttl/e2e-other/resize-volume/11-assert.yaml deleted file mode 100644 index 666b4a85c7..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/11-assert.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-down -status: - instances: - - name: instance1 - readyReplicas: 1 - replicas: 1 - updatedReplicas: 1 ---- -apiVersion: batch/v1 -kind: Job -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-down - postgres-operator.crunchydata.com/pgbackrest-backup: replica-create -status: - succeeded: 1 ---- -apiVersion: v1 -kind: Service -metadata: - name: resize-volume-down-primary ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-down - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-down - postgres-operator.crunchydata.com/data: pgbackrest - postgres-operator.crunchydata.com/pgbackrest-repo: repo1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound diff --git a/testing/kuttl/e2e-other/resize-volume/13--resize.yaml b/testing/kuttl/e2e-other/resize-volume/13--resize.yaml deleted file mode 100644 index 77af2f2aa3..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/13--resize.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: postgres-operator.crunchydata.com/v1beta1 -kind: PostgresCluster -metadata: - name: resize-volume-down -spec: - postgresVersion: ${KUTTL_PG_VERSION} - instances: - - name: instance1 - dataVolumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi - backups: - pgbackrest: - repos: - - name: repo1 - volume: - volumeClaimSpec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/testing/kuttl/e2e-other/resize-volume/13-assert.yaml b/testing/kuttl/e2e-other/resize-volume/13-assert.yaml deleted file mode 100644 index 4210214fd6..0000000000 --- a/testing/kuttl/e2e-other/resize-volume/13-assert.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Event -type: Warning -involvedObject: - apiVersion: postgres-operator.crunchydata.com/v1beta1 - kind: PostgresCluster - name: resize-volume-down -reason: PersistentVolumeError ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-down - postgres-operator.crunchydata.com/instance-set: instance1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - postgres-operator.crunchydata.com/cluster: resize-volume-down - postgres-operator.crunchydata.com/data: pgbackrest - postgres-operator.crunchydata.com/pgbackrest-repo: repo1 -spec: - resources: - requests: - storage: 2Gi -status: - accessModes: - - ReadWriteOnce - capacity: - storage: 2Gi - phase: Bound diff --git a/testing/kuttl/e2e/exporter-custom-queries/README.md b/testing/kuttl/e2e/exporter-custom-queries/README.md index 801b6d02a8..6ec7462628 100644 --- a/testing/kuttl/e2e/exporter-custom-queries/README.md +++ b/testing/kuttl/e2e/exporter-custom-queries/README.md @@ -1,3 +1,3 @@ # Exporter -**Note**: This series of tests depends on PGO being deployed with the `AppendCustomQueries` feature gate OFF. There is a separate set of tests in `e2e-other` that tests the `AppendCustomQueries` functionality. +**Note**: This series of tests depends on PGO being deployed with the `AppendCustomQueries` feature gate OFF. diff --git a/testing/kuttl/e2e/standalone-pgadmin/00--create-pgadmin.yaml b/testing/kuttl/e2e/standalone-pgadmin/00--create-pgadmin.yaml deleted file mode 100644 index ee1a03ec64..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/00--create-pgadmin.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/00-pgadmin.yaml -assert: -- files/00-pgadmin-check.yaml diff --git a/testing/kuttl/e2e/standalone-pgadmin/00-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/00-assert.yaml deleted file mode 100644 index 5b95b46964..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/00-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: -- type: command - command: kubectl -n $NAMESPACE describe pods --selector postgres-operator.crunchydata.com/pgadmin=pgadmin -- namespace: $NAMESPACE - selector: postgres-operator.crunchydata.com/pgadmin=pgadmin diff --git a/testing/kuttl/e2e/standalone-pgadmin/01-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/01-assert.yaml deleted file mode 100644 index 6b7c8c8794..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/01-assert.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - - pod_name=$(kubectl get pod -n "${NAMESPACE}" -l postgres-operator.crunchydata.com/pgadmin=pgadmin -o name) - - clusters_actual=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json") - - clusters_expected="\"Servers\": {}" - { - contains "${clusters_actual}" "${clusters_expected}" - } || { - echo "Wrong servers dumped: got ${clusters_actual}" - exit 1 - } diff --git a/testing/kuttl/e2e/standalone-pgadmin/02--create-cluster.yaml b/testing/kuttl/e2e/standalone-pgadmin/02--create-cluster.yaml deleted file mode 100644 index bee91ce0a4..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/02--create-cluster.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/02-cluster.yaml -- files/02-pgadmin.yaml -assert: -- files/02-cluster-check.yaml diff --git a/testing/kuttl/e2e/standalone-pgadmin/03-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/03-assert.yaml deleted file mode 100644 index 169a8261eb..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/03-assert.yaml +++ /dev/null @@ -1,76 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -# Check the configmap is updated; -# Check the file is updated on the pod; -# Check the server dump is accurate. -# Because we have to wait for the configmap reload, make sure we have enough time. -timeout: 120 -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - diff_comp() { bash -ceu 'diff <(echo "$1" ) <(echo "$2")' - "$@"; } - - data_expected='"pgadmin-shared-clusters.json": "{\n \"Servers\": {\n \"1\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin1-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin1\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin1\"\n }\n }\n}\n"' - - data_actual=$(kubectl get cm -l postgres-operator.crunchydata.com/pgadmin=pgadmin -n "${NAMESPACE}" -o json | jq .items[0].data) - - { - contains "${data_actual}" "${data_expected}" - } || { - echo "Wrong configmap: got ${data_actual}" - exit 1 - } - - pod_name=$(kubectl get pod -n "${NAMESPACE}" -l postgres-operator.crunchydata.com/pgadmin=pgadmin -o name) - - config_updated=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c 'cat /etc/pgadmin/conf.d/~postgres-operator/pgadmin-shared-clusters.json') - config_expected='"Servers": { - "1": { - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin1", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin1" - } - }' - { - contains "${config_updated}" "${config_expected}" - } || { - echo "Wrong file mounted: got ${config_updated}" - echo "Wrong file mounted: expected ${config_expected}" - sleep 10 - exit 1 - } - - clusters_actual=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json") - - clusters_expected=' - { - "Servers": { - "1": { - "Name": "pgadmin1", - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin1", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - } - } - }' - { - contains "${clusters_actual}" "${clusters_expected}" - } || { - echo "Wrong servers dumped: got ${clusters_actual}" - echo "Wrong servers dumped: expected ${clusters_expected}" - diff_comp "${clusters_actual}" "${clusters_expected}" - exit 1 - } diff --git a/testing/kuttl/e2e/standalone-pgadmin/04--create-cluster.yaml b/testing/kuttl/e2e/standalone-pgadmin/04--create-cluster.yaml deleted file mode 100644 index 5701678501..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/04--create-cluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/04-cluster.yaml -assert: -- files/04-cluster-check.yaml diff --git a/testing/kuttl/e2e/standalone-pgadmin/05-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/05-assert.yaml deleted file mode 100644 index 7fe5b69dc2..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/05-assert.yaml +++ /dev/null @@ -1,102 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -# Check the configmap is updated; -# Check the file is updated on the pod; -# Check the server dump is accurate. -# Because we have to wait for the configmap reload, make sure we have enough time. -timeout: 120 -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - diff_comp() { bash -ceu 'diff <(echo "$1" ) <(echo "$2")' - "$@"; } - - data_expected='"pgadmin-shared-clusters.json": "{\n \"Servers\": {\n \"1\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin1-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin1\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin1\"\n },\n \"2\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin2-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin2\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin2\"\n }\n }\n}\n"' - - data_actual=$(kubectl get cm -l postgres-operator.crunchydata.com/pgadmin=pgadmin -n "${NAMESPACE}" -o json | jq .items[0].data) - - { - contains "${data_actual}" "${data_expected}" - } || { - echo "Wrong configmap: got ${data_actual}" - diff_comp "${data_actual}" "${data_expected}" - exit 1 - } - - pod_name=$(kubectl get pod -n "${NAMESPACE}" -l postgres-operator.crunchydata.com/pgadmin=pgadmin -o name) - - config_updated=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c 'cat /etc/pgadmin/conf.d/~postgres-operator/pgadmin-shared-clusters.json') - config_expected='"Servers": { - "1": { - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin1", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin1" - }, - "2": { - "Group": "groupOne", - "Host": "pgadmin2-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin2", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin2" - } - }' - { - contains "${config_updated}" "${config_expected}" - } || { - echo "Wrong file mounted: got ${config_updated}" - echo "Wrong file mounted: expected ${config_expected}" - diff_comp "${config_updated}" "${config_expected}" - sleep 10 - exit 1 - } - - clusters_actual=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json") - - clusters_expected=' - { - "Servers": { - "1": { - "Name": "pgadmin1", - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin1", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - }, - "2": { - "Name": "pgadmin2", - "Group": "groupOne", - "Host": "pgadmin2-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin2", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - } - } - }' - { - contains "${clusters_actual}" "${clusters_expected}" - } || { - echo "Wrong servers dumped: got ${clusters_actual}" - echo "Wrong servers dumped: expected ${clusters_expected}" - diff_comp "${clusters_actual}" "${clusters_expected}" - exit 1 - } diff --git a/testing/kuttl/e2e/standalone-pgadmin/06--create-cluster.yaml b/testing/kuttl/e2e/standalone-pgadmin/06--create-cluster.yaml deleted file mode 100644 index 86b5f8bf04..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/06--create-cluster.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -apply: -- files/06-cluster.yaml -- files/06-pgadmin.yaml -assert: -- files/06-cluster-check.yaml diff --git a/testing/kuttl/e2e/standalone-pgadmin/07-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/07-assert.yaml deleted file mode 100644 index 323237cad4..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/07-assert.yaml +++ /dev/null @@ -1,126 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -# Check the configmap is updated; -# Check the file is updated on the pod; -# Check the server dump is accurate. -# Because we have to wait for the configmap reload, make sure we have enough time. -timeout: 120 -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - diff_comp() { bash -ceu 'diff <(echo "$1" ) <(echo "$2")' - "$@"; } - - data_expected='"pgadmin-shared-clusters.json": "{\n \"Servers\": {\n \"1\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin1-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin1\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin1\"\n },\n \"2\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin2-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin2\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin2\"\n },\n \"3\": {\n \"Group\": \"groupTwo\",\n \"Host\": \"pgadmin3-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin3\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin3\"\n }\n }\n}\n"' - - data_actual=$(kubectl get cm -l postgres-operator.crunchydata.com/pgadmin=pgadmin -n "${NAMESPACE}" -o json | jq .items[0].data) - - { - contains "${data_actual}" "${data_expected}" - } || { - echo "Wrong configmap: got ${data_actual}" - diff_comp "${data_actual}" "${data_expected}" - exit 1 - } - - pod_name=$(kubectl get pod -n "${NAMESPACE}" -l postgres-operator.crunchydata.com/pgadmin=pgadmin -o name) - - config_updated=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c 'cat /etc/pgadmin/conf.d/~postgres-operator/pgadmin-shared-clusters.json') - config_expected='"Servers": { - "1": { - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin1", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin1" - }, - "2": { - "Group": "groupOne", - "Host": "pgadmin2-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin2", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin2" - }, - "3": { - "Group": "groupTwo", - "Host": "pgadmin3-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin3", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin3" - } - }' - { - contains "${config_updated}" "${config_expected}" - } || { - echo "Wrong file mounted: got ${config_updated}" - echo "Wrong file mounted: expected ${config_expected}" - diff_comp "${config_updated}" "${config_expected}" - sleep 10 - exit 1 - } - - clusters_actual=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json") - - clusters_expected=' - { - "Servers": { - "1": { - "Name": "pgadmin1", - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin1", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - }, - "2": { - "Name": "pgadmin2", - "Group": "groupOne", - "Host": "pgadmin2-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin2", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - }, - "3": { - "Name": "pgadmin3", - "Group": "groupTwo", - "Host": "pgadmin3-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin3", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - } - } - }' - { - contains "${clusters_actual}" "${clusters_expected}" - } || { - echo "Wrong servers dumped: got ${clusters_actual}" - echo "Wrong servers dumped: expected ${clusters_expected}" - diff_comp "${clusters_actual}" "${clusters_expected}" - exit 1 - } diff --git a/testing/kuttl/e2e/standalone-pgadmin/08--delete-cluster.yaml b/testing/kuttl/e2e/standalone-pgadmin/08--delete-cluster.yaml deleted file mode 100644 index bc11ea62f4..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/08--delete-cluster.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: - - apiVersion: postgres-operator.crunchydata.com/v1beta1 - kind: PostgresCluster - name: pgadmin2 -error: -- files/04-cluster-check.yaml diff --git a/testing/kuttl/e2e/standalone-pgadmin/09-assert.yaml b/testing/kuttl/e2e/standalone-pgadmin/09-assert.yaml deleted file mode 100644 index eca5581cb7..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/09-assert.yaml +++ /dev/null @@ -1,102 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -# Check the configmap is updated; -# Check the file is updated on the pod; -# Check the server dump is accurate. -# Because we have to wait for the configmap reload, make sure we have enough time. -timeout: 120 -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - diff_comp() { bash -ceu 'diff <(echo "$1" ) <(echo "$2")' - "$@"; } - - data_expected='"pgadmin-shared-clusters.json": "{\n \"Servers\": {\n \"1\": {\n \"Group\": \"groupOne\",\n \"Host\": \"pgadmin1-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin1\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin1\"\n },\n \"2\": {\n \"Group\": \"groupTwo\",\n \"Host\": \"pgadmin3-primary.'${NAMESPACE}.svc'\",\n \"MaintenanceDB\": \"postgres\",\n \"Name\": \"pgadmin3\",\n \"Port\": 5432,\n \"SSLMode\": \"prefer\",\n \"Shared\": true,\n \"Username\": \"pgadmin3\"\n }\n }\n}\n"' - - data_actual=$(kubectl get cm -l postgres-operator.crunchydata.com/pgadmin=pgadmin -n "${NAMESPACE}" -o json | jq .items[0].data) - - { - contains "${data_actual}" "${data_expected}" - } || { - echo "Wrong configmap: got ${data_actual}" - diff_comp "${data_actual}" "${data_expected}" - exit 1 - } - - pod_name=$(kubectl get pod -n "${NAMESPACE}" -l postgres-operator.crunchydata.com/pgadmin=pgadmin -o name) - - config_updated=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c 'cat /etc/pgadmin/conf.d/~postgres-operator/pgadmin-shared-clusters.json') - config_expected='"Servers": { - "1": { - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin1", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin1" - }, - "2": { - "Group": "groupTwo", - "Host": "pgadmin3-primary.'${NAMESPACE}.svc'", - "MaintenanceDB": "postgres", - "Name": "pgadmin3", - "Port": 5432, - "SSLMode": "prefer", - "Shared": true, - "Username": "pgadmin3" - } - }' - { - contains "${config_updated}" "${config_expected}" - } || { - echo "Wrong file mounted: got ${config_updated}" - echo "Wrong file mounted: expected ${config_expected}" - diff_comp "${config_updated}" "${config_expected}" - sleep 10 - exit 1 - } - - clusters_actual=$(kubectl exec -n "${NAMESPACE}" "${pod_name}" -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json") - - clusters_expected=' - { - "Servers": { - "1": { - "Name": "pgadmin1", - "Group": "groupOne", - "Host": "pgadmin1-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin1", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - }, - "2": { - "Name": "pgadmin3", - "Group": "groupTwo", - "Host": "pgadmin3-primary.'${NAMESPACE}.svc'", - "Port": 5432, - "MaintenanceDB": "postgres", - "Username": "pgadmin3", - "Shared": true, - "TunnelPort": "22", - "KerberosAuthentication": false, - "ConnectionParameters": { - "sslmode": "prefer" - } - } - } - }' - { - contains "${clusters_actual}" "${clusters_expected}" - } || { - echo "Wrong servers dumped: got ${clusters_actual}" - echo "Wrong servers dumped: expected ${clusters_expected}" - diff_comp "${clusters_actual}" "${clusters_expected}" - exit 1 - } diff --git a/testing/kuttl/e2e/standalone-pgadmin/10-invalid-pgadmin.yaml b/testing/kuttl/e2e/standalone-pgadmin/10-invalid-pgadmin.yaml deleted file mode 100644 index 118b8d06ef..0000000000 --- a/testing/kuttl/e2e/standalone-pgadmin/10-invalid-pgadmin.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -# Check that invalid spec cannot be applied. -commands: -- script: | - contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; } - diff_comp() { bash -ceu 'diff <(echo "$1" ) <(echo "$2")' - "$@"; } - - data_expected='"pgadmin2" is invalid: spec.serverGroups[0]: Invalid value: "object": exactly one of "postgresClusterName" or "postgresClusterSelector" is required' - - data_actual=$(kubectl apply -f - 2>&1 <