Skip to content

Commit 44d18d7

Browse files
committed
Add redis.fullname in _helpers.tpl
1 parent 25003b7 commit 44d18d7

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

charts/dify/templates/_helpers.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,23 @@ Create the name of the service account to use for the Dify Plugin Daemon
217217
{{ default "default" .Values.pluginDaemon.serviceAccount.name }}
218218
{{- end -}}
219219
{{- end -}}
220+
221+
{{/*
222+
Create the Redis fullname following the same logic as the Redis subchart's common.names.fullname.
223+
This matches the naming convention used by the Bitnami Redis chart.
224+
Note: This helper should only be called when redis.enabled is true.
225+
*/}}
226+
{{- define "dify.redis.fullname" -}}
227+
{{- if and .Values.redis .Values.redis.fullnameOverride -}}
228+
{{- .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-" -}}
229+
{{- else if .Values.redis -}}
230+
{{- $name := default "redis" .Values.redis.nameOverride -}}
231+
{{- if contains $name .Release.Name -}}
232+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
233+
{{- else -}}
234+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
235+
{{- end -}}
236+
{{- else -}}
237+
{{- printf "%s-redis" .Release.Name | trunc 63 | trimSuffix "-" -}}
238+
{{- end -}}
239+
{{- end -}}

charts/dify/templates/config.tpl

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,9 @@ REDIS_USE_SSL: {{ .useSSL | toString | quote }}
308308
REDIS_DB: {{ .db.app | default 0 | toString | quote }}
309309
{{- end }}
310310
{{- else if .Values.redis.enabled }}
311-
{{- $releaseName := printf "%s" .Release.Name -}}
312311
{{- $namespace := .Release.Namespace -}}
313312
{{- with .Values.redis }}
314-
{{- $redisFullname := "" }}
315-
{{- if .fullnameOverride }}
316-
{{- $redisFullname = .fullnameOverride }}
317-
{{- else }}
318-
{{- $redisFullname = printf "%s-redis" $releaseName }}
319-
{{- end }}
313+
{{- $redisFullname := include "dify.redis.fullname" $ }}
320314
{{- if .sentinel.enabled }}
321315
{{- $sentinelPort := .sentinel.service.ports.sentinel | int -}}
322316
{{- $masterSet := .sentinel.masterSet -}}
@@ -372,15 +366,9 @@ CELERY_USE_SENTINEL: "true"
372366
{{- end }}
373367
{{- end }}
374368
{{- else if .Values.redis.enabled }}
375-
{{- $releaseName := printf "%s" .Release.Name -}}
376369
{{- $namespace := .Release.Namespace -}}
377370
{{- with .Values.redis }}
378-
{{- $redisFullname := "" }}
379-
{{- if .fullnameOverride }}
380-
{{- $redisFullname = .fullnameOverride }}
381-
{{- else }}
382-
{{- $redisFullname = printf "%s-redis" $releaseName }}
383-
{{- end }}
371+
{{- $redisFullname := include "dify.redis.fullname" $ }}
384372
{{- if .sentinel.enabled }}
385373
{{- $sentinelPort := .sentinel.service.ports.sentinel | int -}}
386374
{{- $masterSet := .sentinel.masterSet -}}

charts/dify/templates/credentials.tpl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,9 @@ CELERY_BROKER_URL: {{ printf "%s://%s:%s@%s:%v/%v" $scheme .username .password .
137137
{{- end }}
138138
{{- end }}
139139
{{- else if .Values.redis.enabled }}
140-
{{- $releaseName := printf "%s" .Release.Name -}}
141140
{{- $namespace := .Release.Namespace -}}
142141
{{- with .Values.redis }}
143-
{{- $redisFullname := "" }}
144-
{{- if .fullnameOverride }}
145-
{{- $redisFullname = .fullnameOverride }}
146-
{{- else }}
147-
{{- $redisFullname = printf "%s-redis" $releaseName }}
148-
{{- end }}
142+
{{- $redisFullname := include "dify.redis.fullname" $ }}
149143
{{- if .sentinel.enabled }}
150144
{{- $sentinelPort := .sentinel.service.ports.sentinel | int -}}
151145
{{- $masterSet := .sentinel.masterSet -}}

0 commit comments

Comments
 (0)