From 82dda7a13692382bdec2d78bfde3069131422919 Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Mon, 13 Sep 2021 21:38:13 +0100 Subject: [PATCH 1/3] Add Bitnami Postgresql subchart --- charts/funkwhale/Chart.yaml | 6 ++++- charts/funkwhale/templates/_helpers.tpl | 10 ++++++++- charts/funkwhale/values.yaml | 29 ++++++++++++++++--------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/charts/funkwhale/Chart.yaml b/charts/funkwhale/Chart.yaml index f789b18..0b9dda7 100644 --- a/charts/funkwhale/Chart.yaml +++ b/charts/funkwhale/Chart.yaml @@ -4,10 +4,14 @@ appVersion: "1.1.2" description: A social platform to enjoy and share music icon: https://funkwhale.audio/favicon.png name: funkwhale -version: 0.3.10 +version: 0.4.0 dependencies: - name: redis version: ~10.6.10 repository: https://charts.bitnami.com/bitnami condition: redis.enabled +- name: postgresql + version: ~10.9.4 + repository: https://charts.bitnami.com/bitnami + condition: postgresql.enabled diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index 5bf807d..20b9f81 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -7,7 +7,15 @@ Expand the name of the chart. {{- end -}} {{- define "funkwhale.dbUrl" -}} -postgres://{{ .Values.database.user }}:{{ .Values.database.password }}@{{ .Values.database.host }}:{{ .Values.database.port }}/{{ .Values.database.database }} +{{- if and .Values.postgresql.enabled .Values.postgresql.host -}} +{{ fail "Setting both postgresql.enabled and postgresql.host will deploy an internal Postgres service and attempt to use an external one - please set only one of the two!" }} +{{- else if .Values.postgresql.enabled -}} +postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "funkwhale.fullname" . }}-postgresql:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }} +{{- else if .Values.postgresql.host -}} +postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ .Values.postgresql.host }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }} +{{- else -}} +{{ fail "Either postgresql.enabled or postgresql.host are required!" }} +{{- end -}} {{- end -}} {{/* diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index c2b06f6..5f9d3b8 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -30,21 +30,31 @@ ingress: # hosts: # - chart-example.local -database: +postgresql: + # If you already have a Postgresql service you'd like to use, set + # this to false and adjust the host to use your existing service. + enabled: true + ## Database host - host: - - ## Database port - port: 5432 + host: "" ## Database user - user: funkwhale + postgresqlUsername: postgres ## Database password - password: + postgresqlPassword: funkwhale + + ## Database password + postgresqlDatabase: funkwhale + + ## Database port + service: + port: 5432 - ## Database name - database: funkwhale + persistence: + enabled: false + # storageClass: "" + # size: 8Gi redis: # If you already have a Redis service you'd like to use, set @@ -240,4 +250,3 @@ celery: # operator: In # values: # - app - From c5e4f2b22899d6e00aec2a8b4f600cba0ea8391b Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Tue, 14 Sep 2021 20:49:09 +0100 Subject: [PATCH 2/3] Catch legacy config keys --- charts/funkwhale/templates/_helpers.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index 20b9f81..ed5479f 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -18,6 +18,10 @@ postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.pos {{- end -}} {{- end -}} +{{- if .Values.database.user -}} +{{ fail "You are using the old database config key - please migrate to the new postgresql config key" }} +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). From 63e5c120731204758db5151e588c3e1143629d1a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 25 Sep 2021 20:57:37 +0000 Subject: [PATCH 3/3] Default to persistent database --- charts/funkwhale/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 5f9d3b8..80ffe6a 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -52,7 +52,7 @@ postgresql: port: 5432 persistence: - enabled: false + enabled: true # storageClass: "" # size: 8Gi