From d7e3a77f739f83079b75a3ed4c4b7425d0275fcb Mon Sep 17 00:00:00 2001 From: Lumpiasty Date: Sat, 21 Feb 2026 14:27:08 +0100 Subject: [PATCH] add new postgres cluster --- apps/immich/kustomization.yaml | 1 + apps/immich/postgres-cluster.yaml | 56 +++++++++++++++++++++++++++++++ apps/immich/postgres-volume.yaml | 33 ++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 apps/immich/postgres-volume.yaml diff --git a/apps/immich/kustomization.yaml b/apps/immich/kustomization.yaml index 711db86..21b7d4a 100644 --- a/apps/immich/kustomization.yaml +++ b/apps/immich/kustomization.yaml @@ -5,6 +5,7 @@ resources: - volume.yaml - redis.yaml - postgres-password.yaml + - postgres-volume.yaml - postgres-cluster.yaml - immich-library.yaml - release.yaml diff --git a/apps/immich/postgres-cluster.yaml b/apps/immich/postgres-cluster.yaml index 5830916..59512cc 100644 --- a/apps/immich/postgres-cluster.yaml +++ b/apps/immich/postgres-cluster.yaml @@ -30,3 +30,59 @@ spec: # https://github.com/cloudnative-pg/cloudnative-pg/issues/3788 passwordSecret: name: immich-db-immich + + backup: + volumeSnapshot: + className: csi-mayastor-snapshotclass +--- +apiVersion: postgresql.cnpg.io/v1 +kind: Backup +metadata: + name: backup-migration + namespace: immich +spec: + method: volumeSnapshot + cluster: + name: immich-db +--- +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: immich-db-lvmhdd + namespace: immich +spec: + # TODO: Configure renovate to handle imageName + imageName: ghcr.io/tensorchord/cloudnative-vectorchord:14-0.4.3 + + instances: 1 + + storage: + pvcTemplate: + storageClassName: hdd-lvmpv + resources: + requests: + storage: 10Gi + volumeName: immich-db-lvmhdd-1 + + # Just to avoid bootstrapping the instance again + # I migrated data manually using pv_migrate because this feature is broken + # when source and target volumes are in different storage classes + # CNPG just sets dataSource to the PVC and expects the underlying storage + # to handle the migration, but it doesn't work here + bootstrap: + recovery: + backup: + name: backup-migration + + # We need to create custom role because default one does not allow to set up + # vectorchord extension + managed: + roles: + - name: immich + createdb: true + login: true + superuser: true + # We need to manually create secret + # https://github.com/cloudnative-pg/cloudnative-pg/issues/3788 + passwordSecret: + name: immich-db-immich diff --git a/apps/immich/postgres-volume.yaml b/apps/immich/postgres-volume.yaml new file mode 100644 index 0000000..7453f01 --- /dev/null +++ b/apps/immich/postgres-volume.yaml @@ -0,0 +1,33 @@ +apiVersion: local.openebs.io/v1alpha1 +kind: LVMVolume +metadata: + labels: + kubernetes.io/nodename: anapistula-delrosalae + name: immich-db-lvmhdd-1 + namespace: openebs +spec: + capacity: 10Gi + ownerNodeID: anapistula-delrosalae + shared: "yes" + thinProvision: "no" + vgPattern: ^openebs-hdd$ + volGroup: openebs-hdd +--- +kind: PersistentVolume +apiVersion: v1 +metadata: + name: immich-db-lvmhdd-1 +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: hdd-lvmpv + volumeMode: Filesystem + csi: + driver: local.csi.openebs.io + fsType: btrfs + volumeHandle: immich-db-lvmhdd-1 +--- +# PVCs are dynamically created by the Postgres operator