From 33718211b3bfda072742d56b2a2a74d1c1b841f6 Mon Sep 17 00:00:00 2001 From: Eloy Coto Date: Fri, 2 Jun 2023 12:00:23 +0200 Subject: [PATCH] feat: backstage with all postgres instances Signed-off-by: Eloy Coto --- hack/manifests/backstage/app-config.yaml | 1 + hack/manifests/backstage/backstage.yaml | 2 +- hack/manifests/backstage/kustomization.yaml | 13 ++++ hack/manifests/backstage/parodos-patch.yaml | 23 +++++++ .../manifests/backstage/postgres-parodos.yaml | 65 +++++++++++++++++++ hack/manifests/backstage/postgres.yaml | 29 +++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 hack/manifests/backstage/parodos-patch.yaml create mode 100644 hack/manifests/backstage/postgres-parodos.yaml diff --git a/hack/manifests/backstage/app-config.yaml b/hack/manifests/backstage/app-config.yaml index 3abf66a7d..9c13a7a1e 100644 --- a/hack/manifests/backstage/app-config.yaml +++ b/hack/manifests/backstage/app-config.yaml @@ -5,6 +5,7 @@ parodos: workflows: assessment: 'onboardingAssessment_ASSESSMENT_WORKFLOW' assessmentTask: 'onboardingAssessmentTask' + pollingInterval: 10000 organization: name: My Company diff --git a/hack/manifests/backstage/backstage.yaml b/hack/manifests/backstage/backstage.yaml index 1f487b27f..937a3e3b0 100644 --- a/hack/manifests/backstage/backstage.yaml +++ b/hack/manifests/backstage/backstage.yaml @@ -26,7 +26,7 @@ spec: - "packages/backend" - "--config" - "/app/app-config.yaml" - image: quay.io/parodos-dev/backstage-parodos:latest + image: quay.io/parodos-dev/backstage-parodos:latest-openshift imagePullPolicy: Always ports: - name: backend diff --git a/hack/manifests/backstage/kustomization.yaml b/hack/manifests/backstage/kustomization.yaml index 3e9ec030c..1b44ff6d7 100644 --- a/hack/manifests/backstage/kustomization.yaml +++ b/hack/manifests/backstage/kustomization.yaml @@ -4,8 +4,12 @@ bases: resources: - namespace.yaml - postgres.yaml +- postgres-parodos.yaml - backstage.yaml +patchesStrategicMerge: +- parodos-patch.yaml + configMapGenerator: - name: app-config namespace: backstage @@ -18,3 +22,12 @@ secretGenerator: literals: - POSTGRES_USER=admin - POSTGRES_PASSWORD=admin + - PGDATA=/var/lib/postgresql/data/mydata + +- name: postgres-secrets-default + namespace: default + literals: + - POSTGRES_USER=parodos + - POSTGRES_PASSWORD=parodos + - POSTGRES_DB=parodos + - PGDATA=/var/lib/postgresql/data/mydata diff --git a/hack/manifests/backstage/parodos-patch.yaml b/hack/manifests/backstage/parodos-patch.yaml new file mode 100644 index 000000000..357e0325d --- /dev/null +++ b/hack/manifests/backstage/parodos-patch.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: workflow-service-config +data: + DATASOURCE_URL: "jdbc:postgresql://postgres:5432/parodos" + DATASOURCE_DRIVER: "org.postgresql.Driver" + DATASOURCE_USERNAME: "parodos" + DATASOURCE_PASSWORD: "parodos" + SPRING_PROFILES_ACTIVE: "local" + NOTIFICATION_SERVER_ADDRESS: "notification-service.default.svc.cluster.local" +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: notification-service-config +data: + DATASOURCE_URL: "jdbc:postgresql://postgres:5432/parodos" + DATASOURCE_DRIVER: "org.postgresql.Driver" + DATASOURCE_USERNAME: "parodos" + DATASOURCE_PASSWORD: "parodos" + SPRING_PROFILES_ACTIVE: "local" diff --git a/hack/manifests/backstage/postgres-parodos.yaml b/hack/manifests/backstage/postgres-parodos.yaml new file mode 100644 index 000000000..46913f226 --- /dev/null +++ b/hack/manifests/backstage/postgres-parodos.yaml @@ -0,0 +1,65 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pvc + namespace: default +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 8Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgres + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + containers: + - name: postgres + image: postgres:13.2-alpine + imagePullPolicy: 'IfNotPresent' + ports: + - containerPort: 5432 + volumeMounts: + - name: storage + mountPath: /var/lib/postgresql/data + envFrom: + - secretRef: + name: postgres-secrets-default + readinessProbe: + exec: + command: ["pg_isready"] + initialDelaySeconds: 15 + timeoutSeconds: 2 + livenessProbe: + exec: + command: ["pg_isready"] + initialDelaySeconds: 15 + timeoutSeconds: 2 + volumes: + - name: storage + persistentVolumeClaim: + claimName: postgres-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: postgres + namespace: default +spec: + selector: + app: postgres + ports: + - port: 5432 diff --git a/hack/manifests/backstage/postgres.yaml b/hack/manifests/backstage/postgres.yaml index 18ce11038..87185a7dc 100644 --- a/hack/manifests/backstage/postgres.yaml +++ b/hack/manifests/backstage/postgres.yaml @@ -1,4 +1,16 @@ --- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pvc + namespace: backstage +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 8Gi +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -20,9 +32,26 @@ spec: imagePullPolicy: 'IfNotPresent' ports: - containerPort: 5432 + volumeMounts: + - name: storage + mountPath: /var/lib/postgresql/data envFrom: - secretRef: name: postgres-secrets + readinessProbe: + exec: + command: ["pg_isready"] + initialDelaySeconds: 15 + timeoutSeconds: 2 + livenessProbe: + exec: + command: ["pg_isready"] + initialDelaySeconds: 15 + timeoutSeconds: 2 + volumes: + - name: storage + persistentVolumeClaim: + claimName: postgres-pvc --- apiVersion: v1 kind: Service