Skip to content

Commit

Permalink
adding missing postgres e2e test files
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Cadetg committed May 6, 2024
1 parent 8db6483 commit 558b488
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config/samples/crd_v1alpha1_databaserequest_postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: crd.lagoon.sh/v1alpha1
kind: DatabaseRequest
metadata:
labels:
app.kubernetes.io/name: databaserequest
app.kubernetes.io/instance: databaserequest-postgres-sample
app.kubernetes.io/part-of: dbaas-controller
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: dbaas-controller
name: databaserequest-postgres-sample
spec:
name: first-postgres-db
scope: development
type: postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: crd.lagoon.sh/v1alpha1
kind: RelationalDatabaseProvider
metadata:
labels:
app.kubernetes.io/name: dbaas-controller
app.kubernetes.io/managed-by: kustomize
name: relationaldatabaseprovider-postgres-sample
spec:
type: postgres
scope: development
connections:
- name: primary-test-postgres-connection
hostname: postgres-service.postgres
passwordSecretRef:
name: postgres-secret
namespace: postgres
port: 5432
username: postgres
enabled: true
14 changes: 14 additions & 0 deletions test/e2e/testdata/postgre-client-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: postgres-init-pod
namespace: postgres
spec:
restartPolicy: Never
containers:
- name: postgres-client
image: postgres:13
command: ["sh", "-c"]
args:
- |
PGPASSWORD=e2e-postgres-password psql -h postgres-service.postgres -U postgres -c "CREATE DATABASE IF NOT EXISTS seed-database;"
44 changes: 44 additions & 0 deletions test/e2e/testdata/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v1
kind: Namespace
metadata:
name: postgres
---
apiVersion: v1
kind: Pod
metadata:
name: postgres
namespace: postgres
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:13
env:
- name: POSTGRES_PASSWORD
value: "e2e-postgres-password"
ports:
- containerPort: 5432
name: postgres
---
apiVersion: v1
kind: Service
metadata:
name: postgres-service
namespace: postgres
spec:
selector:
app: postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
---
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
namespace: postgres
type: Opaque
data:
password: ZTJlLXBvc3RncmVzLXBhc3N3b3Jk

0 comments on commit 558b488

Please sign in to comment.