Skip to content

Commit 72ce6c2

Browse files
committed
fix(e2e): make postgres fixture compatible with OpenShift
Signed-off-by: Seth Jennings <sjenning@redhat.com>
1 parent c7879a0 commit 72ce6c2

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

e2e/kubernetes/postgres-fixture.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ metadata:
1616
type: Opaque
1717
stringData:
1818
password: openshell-e2e-postgres
19+
uri: postgresql://openshell:openshell-e2e-postgres@openshell-e2e-postgres.openshell.svc/openshell
1920
---
2021
apiVersion: apps/v1
2122
kind: Deployment
@@ -48,6 +49,13 @@ spec:
4849
key: password
4950
- name: POSTGRES_DB
5051
value: openshell
52+
# OpenShift assigns a random UID from the namespace range instead of
53+
# running as the image's "postgres" user (UID 70). The postgres
54+
# entrypoint fails to chmod /var/lib/postgresql/data because it is
55+
# owned by UID 70. Setting PGDATA to a subdirectory causes postgres
56+
# to mkdir+chmod a new directory it owns, which succeeds.
57+
- name: PGDATA
58+
value: /var/lib/postgresql/data/pgdata
5159
ports:
5260
- name: postgres
5361
containerPort: 5432
@@ -61,6 +69,16 @@ spec:
6169
periodSeconds: 3
6270
timeoutSeconds: 2
6371
failureThreshold: 20
72+
volumeMounts:
73+
- name: postgres-data
74+
mountPath: /var/lib/postgresql/data
75+
- name: postgres-run
76+
mountPath: /var/run/postgresql
77+
volumes:
78+
- name: postgres-data
79+
emptyDir: {}
80+
- name: postgres-run
81+
emptyDir: {}
6482
---
6583
apiVersion: v1
6684
kind: Service

0 commit comments

Comments
 (0)