From 8c37a021ac579d11af6cd81f0e917ec0f6c1f64b Mon Sep 17 00:00:00 2001
From: ihiverlet <ines.hiverlet@insee.fr>
Date: Thu, 25 Jul 2024 10:37:09 +0000
Subject: [PATCH] fix and upgrade metabase to v0.50.15

---
 charts/metabase/Chart.yaml                |  2 +-
 charts/metabase/templates/deployment.yaml |  4 ++--
 charts/metabase/values.schema.json        | 11 +++++++++++
 charts/metabase/values.yaml               |  3 ++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/charts/metabase/Chart.yaml b/charts/metabase/Chart.yaml
index 3fed6a4..6c08362 100644
--- a/charts/metabase/Chart.yaml
+++ b/charts/metabase/Chart.yaml
@@ -34,6 +34,6 @@ dependencies:
     version: 1.5.23
     repository: https://inseefrlab.github.io/helm-charts-interactive-services
   - name: postgresql
-    version: 11.6.15
+    version: 15.5.19
     repository:  https://charts.bitnami.com/bitnami
     enabled: true
diff --git a/charts/metabase/templates/deployment.yaml b/charts/metabase/templates/deployment.yaml
index ae85c06..b259191 100644
--- a/charts/metabase/templates/deployment.yaml
+++ b/charts/metabase/templates/deployment.yaml
@@ -43,9 +43,9 @@ spec:
           - name: MB_DB_PORT
             value: "5432"
           - name: MB_DB_USER
-            value: {{ .Values.global.postgresql.auth.username }}
+            value: postgres
           - name: MB_DB_PASS
-            value: {{ .Values.global.postgresql.auth.password }}
+            value: {{ .Values.global.postgresql.auth.postgresPassword }}
           - name: MB_DB_HOST
             value: {{ .Values.postgresql.fullnameOverride }}
           - name: MB_ADMIN_EMAIL
diff --git a/charts/metabase/values.schema.json b/charts/metabase/values.schema.json
index 652f1be..09a0e71 100644
--- a/charts/metabase/values.schema.json
+++ b/charts/metabase/values.schema.json
@@ -195,6 +195,17 @@
                     "overwriteDefaultWith": "{{project.password}}"
                   }
                 },
+                "postgresPassword": {
+                  "type": "string",
+                  "title": "Password",
+                  "default": "changeme",
+                  "x-form": {
+                    "value": "{{project.password}}"
+                  },
+                  "x-onyxia": {
+                    "overwriteDefaultWith": "{{project.password}}"
+                  }
+                },
                 "database": {
                   "description": "Name for the default database that is created when the image is first started.",
                   "type": "string",
diff --git a/charts/metabase/values.yaml b/charts/metabase/values.yaml
index 8691b82..d14b344 100644
--- a/charts/metabase/values.yaml
+++ b/charts/metabase/values.yaml
@@ -5,7 +5,7 @@ service:
     repository: "metabase/metabase"
     pullPolicy: IfNotPresent
     # Overrides the image tag whose default is the chart appVersion.
-    tag: "v0.48.7"
+    tag: "v0.50.15"
 
 global:
   postgresql:
@@ -13,6 +13,7 @@ global:
       username: "admin"
       password: "changeme"
       database: "metabase-metadata"
+      postgresPassword: "changeme"
 
 postgresql:
   image: