From 558b488ac4939905d3cac397cb0317919d740ea1 Mon Sep 17 00:00:00 2001 From: Marco Cadetg Date: Mon, 6 May 2024 12:32:23 +0200 Subject: [PATCH] adding missing postgres e2e test files --- ...crd_v1alpha1_databaserequest_postgres.yaml | 14 ++++++ ...1_relationaldatabaseprovider_postgres.yaml | 19 ++++++++ test/e2e/testdata/postgre-client-pod.yaml | 14 ++++++ test/e2e/testdata/postgres.yaml | 44 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 config/samples/crd_v1alpha1_databaserequest_postgres.yaml create mode 100644 config/samples/crd_v1alpha1_relationaldatabaseprovider_postgres.yaml create mode 100644 test/e2e/testdata/postgre-client-pod.yaml create mode 100644 test/e2e/testdata/postgres.yaml diff --git a/config/samples/crd_v1alpha1_databaserequest_postgres.yaml b/config/samples/crd_v1alpha1_databaserequest_postgres.yaml new file mode 100644 index 0000000..a1c6c0b --- /dev/null +++ b/config/samples/crd_v1alpha1_databaserequest_postgres.yaml @@ -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 \ No newline at end of file diff --git a/config/samples/crd_v1alpha1_relationaldatabaseprovider_postgres.yaml b/config/samples/crd_v1alpha1_relationaldatabaseprovider_postgres.yaml new file mode 100644 index 0000000..2e0a1de --- /dev/null +++ b/config/samples/crd_v1alpha1_relationaldatabaseprovider_postgres.yaml @@ -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 diff --git a/test/e2e/testdata/postgre-client-pod.yaml b/test/e2e/testdata/postgre-client-pod.yaml new file mode 100644 index 0000000..3b87bd5 --- /dev/null +++ b/test/e2e/testdata/postgre-client-pod.yaml @@ -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;" \ No newline at end of file diff --git a/test/e2e/testdata/postgres.yaml b/test/e2e/testdata/postgres.yaml new file mode 100644 index 0000000..375442b --- /dev/null +++ b/test/e2e/testdata/postgres.yaml @@ -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 \ No newline at end of file