diff --git a/charts/funkwhale/Chart.yaml b/charts/funkwhale/Chart.yaml index a8f4da4..209d84b 100644 --- a/charts/funkwhale/Chart.yaml +++ b/charts/funkwhale/Chart.yaml @@ -10,3 +10,4 @@ dependencies: - name: redis version: ~10.6.10 repository: https://charts.bitnami.com/bitnami + condition: redis.enabled diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index c3f3c9d..5bf807d 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 | default (printf "%s-%s" (include "funkwhale.fullname" .) "redis-master") }}:{{ .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" . }}-redis-master:{{ .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/templates/deployment.yaml b/charts/funkwhale/templates/deployment.yaml index 6fbf379..bd80a91 100644 --- a/charts/funkwhale/templates/deployment.yaml +++ b/charts/funkwhale/templates/deployment.yaml @@ -52,6 +52,17 @@ spec: command: - stat - /run/funkwhale/funkwhale.sock + failureThreshold: {{ .Values.api.readinessProbe.failureThreshold | default 3 }} + periodSeconds: {{ .Values.api.readinessProbe.periodSeconds | default 5 }} + initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds | default 5 }} + startupProbe: + exec: + command: + - stat + - /run/funkwhale/funkwhale.sock + failureThreshold: {{ .Values.api.startupProbe.failureThreshold | default 3 }} + periodSeconds: {{ .Values.api.startupProbe.periodSeconds | default 20 }} + initialDelaySeconds: {{ .Values.api.startupProbe.initialDelaySeconds | default 5 }} envFrom: - configMapRef: name: {{ include "funkwhale.fullname" . }} @@ -97,9 +108,21 @@ spec: httpGet: path: / port: http + failureThreshold: {{ .Values.front.livenessProbe.failureThreshold | default 3 }} + periodSeconds: {{ .Values.front.livenessProbe.periodSeconds | default 20 }} + initialDelaySeconds: {{ .Values.front.livenessProbe.initialDelaySeconds | default 15 }} readinessProbe: tcpSocket: port: http + failureThreshold: {{ .Values.front.readinessProbe.failureThreshold | default 3 }} + periodSeconds: {{ .Values.front.readinessProbe.periodSeconds | default 5 }} + initialDelaySeconds: {{ .Values.front.readinessProbe.initialDelaySeconds | default 5 }} + startupProbe: + tcpSocket: + port: http + failureThreshold: {{ .Values.front.startupProbe.failureThreshold | default 3 }} + periodSeconds: {{ .Values.front.startupProbe.periodSeconds | default 20 }} + initialDelaySeconds: {{ .Values.front.startupProbe.initialDelaySeconds | default 5 }} volumeMounts: - mountPath: /run/funkwhale name: funkwhale-sock diff --git a/charts/funkwhale/templates/secret.yaml b/charts/funkwhale/templates/secret.yaml index fbc05a1..77f68a6 100644 --- a/charts/funkwhale/templates/secret.yaml +++ b/charts/funkwhale/templates/secret.yaml @@ -1,3 +1,5 @@ +{{- $secret := (lookup "v1" "Secret" .Release.Namespace (include "funkwhale.fullname" .)) -}} + apiVersion: v1 kind: Secret metadata: @@ -10,7 +12,11 @@ metadata: data: CACHE_URL: {{ include "funkwhale.redisUrl" . | b64enc }} DATABASE_URL: {{ include "funkwhale.dbUrl" . | b64enc }} - DJANGO_SECRET_KEY: {{ .Values.djangoSecret | b64enc }} + {{ if $secret -}} + DJANGO_SECRET_KEY: {{ $secret.data.DJANGO_SECRET_KEY }} + {{ else -}} + DJANGO_SECRET_KEY: {{ (.Values.djangoSecret | default uuidv4) | b64enc }} + {{ end }} {{- range $key, $val := .Values.extraSecret }} {{ $key }}: {{ $val | b64enc }} diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index a0f9834..345ef6c 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -47,6 +47,14 @@ database: database: funkwhale redis: + # 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. + enabled: true + + host: '' + redisPort: 6379 + password: 'funkwhale' + cluster: enabled: false master: @@ -55,9 +63,6 @@ redis: slave: persistence: enabled: false - password: funkwhale - redisPort: 6379 - # host: {{ template "funkwhale.fullname" . }}-redis-master djangoSecret: '' @@ -122,6 +127,8 @@ api: tolerations: [] affinity: {} + readinessProbe: {} + startupProbe: {} front: image: @@ -153,6 +160,9 @@ front: tolerations: [] affinity: {} + readinessProbe: {} + livenessProbe: {} + startupProbe: {} celery: beat: diff --git a/charts/matrix-synapse/values.yaml b/charts/matrix-synapse/values.yaml index 54483a3..cb38ddb 100644 --- a/charts/matrix-synapse/values.yaml +++ b/charts/matrix-synapse/values.yaml @@ -159,8 +159,8 @@ synapse: ## Additional environment variables to apply to the main Synapse pod ## extraEnv: {} - # - name: USE_JEMALLOC - # value: "1" + # - name: LD_PRELOAD + # value: /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 # - name: SYNAPSE_CACHE_FACTOR # value: "2" @@ -263,8 +263,8 @@ workers: ## Additional environment variables to add to the worker. ## extraEnv: {} - # - name: USE_JEMALLOC - # value: "1" + # - name: LD_PRELOAD + # value: /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 # - name: SYNAPSE_CACHE_FACTOR # value: "1.0"