From f3ab4594599a7158d1b87ee9da1c3d80172a3c61 Mon Sep 17 00:00:00 2001 From: OdooSky Bot Date: Sat, 2 May 2026 22:06:03 +0300 Subject: [PATCH] Phase 3b: PVC dataSource + storageClassName plumbing (#347) --- templates/odoo-pvc.yaml | 19 +++++++++++++++++++ templates/postgres-statefulset.yaml | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/templates/odoo-pvc.yaml b/templates/odoo-pvc.yaml index 9504ac0..e4f52c7 100644 --- a/templates/odoo-pvc.yaml +++ b/templates/odoo-pvc.yaml @@ -6,6 +6,25 @@ metadata: {{- include "instance.labels" . | nindent 4 }} spec: accessModes: [ReadWriteOnce] + {{- if .Values.instance.storageClassName }} + # Tower stamps storageClassName when the destination cluster has + # Longhorn (or another snapshot-capable CSI). Empty here means + # bind to the cluster's default StorageClass — k3s default is + # local-path which doesn't support snapshots, so spawn-env / + # Refresh ↓ on those instances falls back to the S3 path. + # ADR 0003 phase 6. + storageClassName: {{ .Values.instance.storageClassName | quote }} + {{- end }} + {{- if and .Values.instance.dataSource .Values.instance.dataSource.filestore .Values.instance.dataSource.filestore.snapshotName }} + # Seed from VolumeSnapshot — Tower's VolumeClone path for + # spawn-env / Refresh ↓ (ADR 0003 phase 3+4). The snapshot must + # exist in the same namespace before this PVC is provisioned; + # Tower creates it before triggering the chart sync. + dataSource: + apiGroup: snapshot.storage.k8s.io + kind: VolumeSnapshot + name: {{ .Values.instance.dataSource.filestore.snapshotName | quote }} + {{- end }} resources: requests: storage: {{ include "instance.storage" (dict "Values" .Values "layer" "filestore") | quote }} diff --git a/templates/postgres-statefulset.yaml b/templates/postgres-statefulset.yaml index 4a1ae7c..16f6f58 100644 --- a/templates/postgres-statefulset.yaml +++ b/templates/postgres-statefulset.yaml @@ -64,6 +64,18 @@ spec: name: pgdata spec: accessModes: [ReadWriteOnce] + {{- if .Values.instance.storageClassName }} + storageClassName: {{ .Values.instance.storageClassName | quote }} + {{- end }} + {{- if and .Values.instance.dataSource .Values.instance.dataSource.database .Values.instance.dataSource.database.snapshotName }} + # Seed from VolumeSnapshot — Tower's VolumeClone path + # (ADR 0003 phase 3+4). The snapshot is taken from the + # source instance's `pgdata--pg-0` PVC. + dataSource: + apiGroup: snapshot.storage.k8s.io + kind: VolumeSnapshot + name: {{ .Values.instance.dataSource.database.snapshotName | quote }} + {{- end }} resources: requests: storage: {{ include "instance.storage" (dict "Values" .Values "layer" "database") | quote }}