Skip to content

Commit a5b3c33

Browse files
committed
compute the redis url base on release name or name overrides instead of oauth2-proxy fullname
Signed-off-by: Nico Braun <[email protected]>
1 parent 2d7d7c9 commit a5b3c33

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

helm/oauth2-proxy/templates/_helpers.tpl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,21 @@ Create the name of the service account to use
7878
{{- end -}}
7979
{{- end -}}
8080

81-
81+
{{/*
82+
Compute the redis url if not set explicitly.
83+
*/}}
8284
{{- define "oauth2-proxy.redisStandaloneUrl" -}}
85+
{{- $masterPort := .Values.redis.master.service.ports.redis -}}
8386
{{- if .Values.sessionStorage.redis.standalone.connectionUrl -}}
8487
{{ .Values.sessionStorage.redis.standalone.connectionUrl }}
88+
{{- else if .Values.redis.fullnameOverride -}}
89+
{{- printf "redis://%s-master:%.0f" (.Values.redis.fullnameOverride | trunc 63 | trimSuffix "-") $masterPort -}}
8590
{{- else -}}
86-
{{- printf "redis://%s-redis-master:6379" (include "oauth2-proxy.fullname" .) -}}
91+
{{- $name := default "redis" .Values.redis.nameOverride -}}
92+
{{- if contains $name .Release.Name -}}
93+
{{- printf "redis://%s-master:%.0f" (.Release.Name | trunc 63 | trimSuffix "-") $masterPort -}}
94+
{{- else -}}
95+
{{- printf "redis://%s-master:%.0f" (printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-") $masterPort -}}
96+
{{- end -}}
97+
{{- end -}}
8798
{{- end -}}
88-
{{- end -}}

0 commit comments

Comments
 (0)