From 06e15afbacd20e0ea9914b6d2a44d00e7142e3ae Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Thu, 18 Mar 2021 08:58:50 +0000 Subject: [PATCH 1/6] Allow disabling the default Redis installation when a custom one is specified. --- charts/funkwhale/requirements.yaml | 1 + charts/funkwhale/values.yaml | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/charts/funkwhale/requirements.yaml b/charts/funkwhale/requirements.yaml index 153994b..d1d204e 100644 --- a/charts/funkwhale/requirements.yaml +++ b/charts/funkwhale/requirements.yaml @@ -2,3 +2,4 @@ dependencies: - name: redis version: ~10.6.10 repository: https://charts.bitnami.com/bitnami + condition: redis.internal.enabled diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 45e85c4..4ee0c07 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -47,6 +47,13 @@ database: database: funkwhale redis: + password: funkwhale + redisPort: 6379 + host: {{ template "funkwhale.fullname" . }}-redis-master + # If you already have a Redis service you'd like to use, set + # this to false and adjust the host to use your existing service. + internal: + enabled: true cluster: enabled: false master: @@ -55,9 +62,6 @@ redis: slave: persistence: enabled: false - password: funkwhale - redisPort: 6379 - host: {{ template "funkwhale.fullname" . }}-redis-master djangoSecret: '' From 7d86a26e14ff7d57eeb585eedc2821c69b2ff715 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sun, 21 Mar 2021 00:32:44 +0000 Subject: [PATCH 2/6] Update to using values.redis.enabled. --- charts/funkwhale/requirements.yaml | 2 +- charts/funkwhale/values.yaml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/charts/funkwhale/requirements.yaml b/charts/funkwhale/requirements.yaml index d1d204e..894419e 100644 --- a/charts/funkwhale/requirements.yaml +++ b/charts/funkwhale/requirements.yaml @@ -2,4 +2,4 @@ dependencies: - name: redis version: ~10.6.10 repository: https://charts.bitnami.com/bitnami - condition: redis.internal.enabled + condition: redis.enabled diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 4ee0c07..14d4006 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -47,13 +47,14 @@ database: database: funkwhale redis: - password: funkwhale - redisPort: 6379 - host: {{ template "funkwhale.fullname" . }}-redis-master # If you already have a Redis service you'd like to use, set # this to false and adjust the host to use your existing service. - internal: - enabled: true + enabled: true + + host: {{ template "funkwhale.fullname" . }}-redis-master + redisPort: 6379 + password: funkwhale + cluster: enabled: false master: From 8406f013d961bcbdf42174cf92f4b120dc245ca7 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sun, 21 Mar 2021 01:44:14 +0000 Subject: [PATCH 3/6] Fix disabling internal redis installation and validate state of redis.enabled and redis.host --- charts/funkwhale/templates/_helpers.tpl | 18 +++++++++++++----- charts/funkwhale/values.yaml | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index 46d57eb..200ebd8 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -7,11 +7,7 @@ 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 }} -{{- end -}} - -{{- define "funkwhale.redisUrl" -}} -redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.redisPort }}/0 +postgres://{{ .Values.database.user }}:{{ .Values.database.password }}@{{ .Values.database.host }}:{{ .Values.database.port }}/{{ .Values.database.database }} {{- end -}} {{/* @@ -45,3 +41,15 @@ Create the correct image tag name {{- define "funkwhale.imageTag" -}} {{- .Values.image.tag | default .Chart.AppVersion -}} {{- end -}} + +{{- define "funkwhale.redisUrl" -}} +{{- if and .Values.redis.enabled .Values.redis.host -}} +{{ fail "Setting both redis.enabled and redis.host will deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }} +{{- else if .Values.redis.enabled -}} +redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}:{{ .Values.redis.redisPort }}/0 +{{- else if .Values.redis.host -}} +redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.redisPort }}/0 +{{- else -}} +{{ fail "Either redis.enabled or redis.host are required!" }} +{{- end -}} +{{- end -}} diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 14d4006..3fc2efe 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -51,7 +51,7 @@ redis: # this to false and adjust the host to use your existing service. enabled: true - host: {{ template "funkwhale.fullname" . }}-redis-master + host: '' redisPort: 6379 password: funkwhale From dd260937ef63fa64a537c418a7948a285dc631fb Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sun, 21 Mar 2021 02:14:45 +0000 Subject: [PATCH 4/6] Add comment specfying how to override the Redis image --- charts/funkwhale/values.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 3fc2efe..d22bb2f 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -51,6 +51,13 @@ redis: # this to false and adjust the host to use your existing service. enabled: true + # If you wan to run Redis on a Raspbery Pi or another ARM-based + # system, use the official Docker image instead of the Bitnami one + # as the Bitnami images are only available as amd64. + # image: + # repository: redis + # tag: 6.0.12 + host: '' redisPort: 6379 password: funkwhale From 83e98fcde01261af64a2904c8950b0a145c59019 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sun, 21 Mar 2021 10:21:00 +0000 Subject: [PATCH 5/6] Remove comment about setting redis image to upstream for ARM compatibility for now. --- charts/funkwhale/values.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index d22bb2f..3fc2efe 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -51,13 +51,6 @@ redis: # this to false and adjust the host to use your existing service. enabled: true - # If you wan to run Redis on a Raspbery Pi or another ARM-based - # system, use the official Docker image instead of the Bitnami one - # as the Bitnami images are only available as amd64. - # image: - # repository: redis - # tag: 6.0.12 - host: '' redisPort: 6379 password: funkwhale From e5ec464e0905abb6291d48bce3abbcabdc974ca6 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sun, 21 Mar 2021 15:14:35 +0000 Subject: [PATCH 6/6] Fix merge. --- charts/funkwhale/templates/_helpers.tpl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index cc016dc..5bf807d 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -10,10 +10,6 @@ Expand the name of the chart. postgres://{{ .Values.database.user }}:{{ .Values.database.password }}@{{ .Values.database.host }}:{{ .Values.database.port }}/{{ .Values.database.database }} {{- end -}} -{{- define "funkwhale.redisUrl" -}} -redis://:{{ .Values.redis.password }}@{{ .Values.redis.host | default (printf "%s-%s" (include "funkwhale.fullname" .) "redis-master") }}:{{ .Values.redis.redisPort }}/0 -{{- 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). @@ -50,7 +46,7 @@ Create the correct image tag name {{- if and .Values.redis.enabled .Values.redis.host -}} {{ fail "Setting both redis.enabled and redis.host will deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }} {{- else if .Values.redis.enabled -}} -redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}:{{ .Values.redis.redisPort }}/0 +redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}-redis-master:{{ .Values.redis.redisPort }}/0 {{- else if .Values.redis.host -}} redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.redisPort }}/0 {{- else -}}