Skip to content

Commit 76dffae

Browse files
Merge pull request #83 from bluebrown/fix/computed-redis-url
2 parents 223702f + 70f5761 commit 76dffae

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

helm/oauth2-proxy/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 6.1.0
2+
version: 6.1.1
33
apiVersion: v2
44
appVersion: 7.2.0
55
home: https://oauth2-proxy.github.io/oauth2-proxy/

helm/oauth2-proxy/templates/_helpers.tpl

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

81+
{{/*
82+
Redis subcharts fullname
83+
*/}}
84+
{{- define "oauth2-proxy.redis.fullname" -}}
85+
{{- if .Values.redis.enabled -}}
86+
{{- include "common.names.fullname" (dict "Chart" (dict "Name" "redis") "Release" .Release "Values" .Values.redis) -}}
87+
{{- else -}}
88+
{{ fail "attempting to use redis subcharts fullname, even though the subchart is not enabled. This will lead to misconfiguration" }}
89+
{{- end -}}
90+
{{- end -}}
8191

82-
{{- define "oauth2-proxy.redisStandaloneUrl" -}}
92+
{{/*
93+
Compute the redis url if not set explicitly.
94+
*/}}
95+
{{- define "oauth2-proxy.redis.StandaloneUrl" -}}
8396
{{- if .Values.sessionStorage.redis.standalone.connectionUrl -}}
8497
{{ .Values.sessionStorage.redis.standalone.connectionUrl }}
98+
{{- else if .Values.redis.enabled -}}
99+
{{- printf "redis://%s-master:%.0f" (include "oauth2-proxy.redis.fullname" .) .Values.redis.master.service.ports.redis -}}
85100
{{- else -}}
86-
{{- printf "redis://%s-redis-master:6379" (include "oauth2-proxy.fullname" .) -}}
101+
{{ fail "please set sessionStorage.redis.standalone.connectionUrl or enable the redis subchart via redis.enabled" }}
102+
{{- end -}}
87103
{{- end -}}
88-
{{- end -}}

helm/oauth2-proxy/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ spec:
121121
{{- end }}
122122
{{- if eq (default "" .Values.sessionStorage.redis.clientType) "standalone" }}
123123
- name: OAUTH2_PROXY_REDIS_CONNECTION_URL
124-
value: {{ include "oauth2-proxy.redisStandaloneUrl" . }}
124+
value: {{ include "oauth2-proxy.redis.StandaloneUrl" . }}
125125
{{- else if eq (default "" .Values.sessionStorage.redis.clientType) "cluster" }}
126126
- name: OAUTH2_PROXY_REDIS_USE_CLUSTER
127127
value: "true"

0 commit comments

Comments
 (0)