From 4272e9cc23ed615595cb4ccc71987fcceb5442ae Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Wed, 26 Jul 2023 13:51:47 +0200 Subject: [PATCH] refactor(db): Migrate to CloudNativePG operator --- manifests/database.yaml | 40 +++++++++++++++++++-------------------- manifests/deployment.yaml | 4 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manifests/database.yaml b/manifests/database.yaml index bc149d1..ae24be9 100644 --- a/manifests/database.yaml +++ b/manifests/database.yaml @@ -1,26 +1,26 @@ -kind: "postgresql" -apiVersion: "acid.zalan.do/v1" - +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster metadata: - name: "vaultwarden" - namespace: "vaultwarden" - labels: - team: acid - + name: vaultwarden-db + namespace: vaultwarden spec: - teamId: "acid" + instances: 1 + + storage: + size: 1Gi + storageClass: flat-storage-class + + bootstrap: + initdb: + database: vaultwarden + owner: vaultwarden + secret: + name: vaultwarden-db + postgresql: - version: "15" - numberOfInstances: 1 - volume: - size: "1Gi" - storageClass: "flat-storage-class" - users: - vaultwarden: [] - databases: - vaultwarden: vaultwarden - allowedSourceRanges: - # IP ranges to access your cluster go here + pg_hba: + - host all all all md5 + resources: requests: cpu: 100m diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml index 51d9413..7589574 100644 --- a/manifests/deployment.yaml +++ b/manifests/deployment.yaml @@ -24,12 +24,12 @@ spec: - name: DB_PASSWORD valueFrom: secretKeyRef: - name: vaultwarden.vaultwarden.credentials.postgresql.acid.zalan.do + name: vaultwarden-db key: password - name: SIGNUPS_ALLOWED value: "true" - name: DATABASE_URL - value: "postgresql://vaultwarden:$(DB_PASSWORD)@vaultwarden.vaultwarden.svc.cluster.local:5432/vaultwarden" + value: "postgresql://vaultwarden:$(DB_PASSWORD)@vaultwarden-db-rw.vaultwarden.svc.cluster.local:5432/vaultwarden" - name: ADMIN_TOKEN valueFrom: secretKeyRef: