feat(db): Add backup and refine ingress

This commit is contained in:
Tanguy Herbron 2024-12-19 11:12:02 +01:00
parent dd74c00888
commit b3484f22f1
7 changed files with 69 additions and 49 deletions

View File

@ -0,0 +1,10 @@
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: vaultwarden-db-backup
namespace: vaultwarden
spec:
schedule: "0 0 0 * * *"
backupOwnerReference: self
cluster:
name: vaultwarden-db

View File

@ -5,11 +5,11 @@ metadata:
namespace: vaultwarden
spec:
instances: 2
instances: 3
storage:
size: 1Gi
storageClass: redundant-storage-class
storageClass: local-path
bootstrap:
initdb:
@ -22,6 +22,24 @@ spec:
pg_hba:
- host all all all md5
backup:
barmanObjectStore:
destinationPath: "s3://halis/cloudnativepg"
endpointURL: https://s3.halia.dev
s3Credentials:
accessKeyId:
name: s3-secret
key: AWS_ACCESS_KEY_ID
secretAccessKey:
name: s3-secret
key: AWS_SECRET_ACCESS_KEY
region:
name: s3-secret
key: AWS_REGION
wal:
compression: gzip
maxParallel: 8
resources:
requests:
cpu: 100m
@ -30,23 +48,5 @@ spec:
cpu: 500m
memory: 500Mi
backup:
barmanObjectStore:
destinationPath: s3://cluster-example-full-backup
endpointURL: http://10.10.0.32:9000
s3Credentials:
accessKeyId:
name: backup-creds
key: ACCESS_KEY_ID
secretAccessKey:
name: backup-creds
key: ACCESS_SECRET_KEY
region:
name: backup-creds
key: REGION
wal:
compression: gzip
data:
compression: gzip
jobs: 2
retentionPolicy: "30d"
monitoring:
enablePodMonitor: true

View File

@ -4,7 +4,7 @@ metadata:
name: vaultwarden
namespace: vaultwarden
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: vaultwarden
@ -17,7 +17,7 @@ spec:
subdomain: vaultwarden
containers:
- name: vaultwarden
image: vaultwarden/server
image: vaultwarden/server:1.32.6
ports:
- containerPort: 80
env:
@ -35,7 +35,10 @@ spec:
secretKeyRef:
name: vaultwarden-admin
key: token
volumeMounts:
- mountPath: "/data"
name: vaultwarden-data
volumes:
- name: vaultwarden-pv
hostPath:
path: "/mnt/vaultwarden"
- name: vaultwarden-data
persistentVolumeClaim:
claimName: vaultwarden-pvc

View File

@ -4,14 +4,17 @@ metadata:
name: vaultwarden-ingress
namespace: vaultwarden
annotations:
kubernetes.io/ingress.class: "traefik"
cert-manager.io/cluster-issuer: letsencrypt-production
kubernetes.io/ingress.class: nginx-external
acme.cert-manager.io/http01-edit-in-place: "true"
spec:
tls:
- secretName: vaultwarden-beta-tls
hosts:
- bitwarden.beta.halia.dev
- hosts:
- bitwarden.halis.io
secretName: bitwarden-halis-io-tls
ingressClassName: nginx-external
rules:
- host: bitwarden.beta.halia.dev
- host: bitwarden.halis.io
http:
paths:
- path: /

View File

@ -5,6 +5,7 @@ resources:
- namespace.yaml
- secrets.yaml
- database.yaml
- database-backup.yaml
- service.yaml
- ingress.yaml
- pvc.yaml

View File

@ -3,10 +3,13 @@ kind: PersistentVolumeClaim
metadata:
name: vaultwarden-pvc
namespace: vaultwarden
labels:
recurring-job.longhorn.io/source: enabled
recurring-job-group.longhorn.io/standard-pvc: enabled
spec:
accessModes:
- ReadWriteMany
storageClassName: redundant-storage-class
resources:
requests:
storage: 1Gi
storage: 5Gi
storageClassName: redundant-storage-class

View File

@ -9,7 +9,7 @@ spec:
project: default
source:
repoURL: https://git.halis.io/athens-school/k3s-secrets.git
targetRevision: dev
targetRevision: prod-migration
path: vaultwarden
syncPolicy:
automated: