From a8aa4ebecd0c0d68e0abe79d9a5763719bddac27 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <mail@justjanne.de>
Date: Sun, 23 Apr 2023 15:48:45 +0200
Subject: [PATCH] feat: make postgres chart use different storage directories
 per major version

---
 postgresql/Chart.yaml                 | 4 ++--
 postgresql/templates/statefulset.yaml | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/postgresql/Chart.yaml b/postgresql/Chart.yaml
index df85d37..06c6014 100644
--- a/postgresql/Chart.yaml
+++ b/postgresql/Chart.yaml
@@ -2,5 +2,5 @@ apiVersion: v2
 name: postgresql
 description: Helm Chart for postgresql
 type: application
-version: 1.1.0
-appVersion: "15.2-alpine"
+version: 1.2.0
+appVersion: "15"
diff --git a/postgresql/templates/statefulset.yaml b/postgresql/templates/statefulset.yaml
index 04e6d68..f1cc90f 100644
--- a/postgresql/templates/statefulset.yaml
+++ b/postgresql/templates/statefulset.yaml
@@ -44,7 +44,7 @@ spec:
         - name: postgresql
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "%s-alpine" .Chart.AppVersion) }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           env:
             - name: POSTGRES_PASSWORD
@@ -79,6 +79,7 @@ spec:
           volumeMounts:
             - mountPath: "/var/lib/postgresql/data"
               name: data
+              subPath: {{ .Chart.AppVersion }}
             - mountPath: "/configs"
               name: config
             - mountPath: "/dev/shm"
-- 
GitLab