diff --git a/helm/oauth2-proxy/Chart.yaml b/helm/oauth2-proxy/Chart.yaml index 106bc052..0502a1bf 100644 --- a/helm/oauth2-proxy/Chart.yaml +++ b/helm/oauth2-proxy/Chart.yaml @@ -1,5 +1,5 @@ name: oauth2-proxy -version: 6.1.0 +version: 6.1.1 apiVersion: v2 appVersion: 7.2.0 home: https://oauth2-proxy.github.io/oauth2-proxy/ diff --git a/helm/oauth2-proxy/templates/_helpers.tpl b/helm/oauth2-proxy/templates/_helpers.tpl index 30b982f7..017d0b80 100644 --- a/helm/oauth2-proxy/templates/_helpers.tpl +++ b/helm/oauth2-proxy/templates/_helpers.tpl @@ -78,11 +78,26 @@ Create the name of the service account to use {{- end -}} {{- end -}} +{{/* +Redis subcharts fullname +*/}} +{{- define "oauth2-proxy.redis.fullname" -}} +{{- if .Values.redis.enabled -}} +{{- include "common.names.fullname" (dict "Chart" (dict "Name" "redis") "Release" .Release "Values" .Values.redis) -}} +{{- else -}} +{{ fail "attempting to use redis subcharts fullname, even though the subchart is not enabled. This will lead to misconfiguration" }} +{{- end -}} +{{- end -}} -{{- define "oauth2-proxy.redisStandaloneUrl" -}} +{{/* +Compute the redis url if not set explicitly. +*/}} +{{- define "oauth2-proxy.redis.StandaloneUrl" -}} {{- if .Values.sessionStorage.redis.standalone.connectionUrl -}} {{ .Values.sessionStorage.redis.standalone.connectionUrl }} +{{- else if .Values.redis.enabled -}} +{{- printf "redis://%s-master:%.0f" (include "oauth2-proxy.redis.fullname" .) .Values.redis.master.service.ports.redis -}} {{- else -}} -{{- printf "redis://%s-redis-master:6379" (include "oauth2-proxy.fullname" .) -}} +{{ fail "please set sessionStorage.redis.standalone.connectionUrl or enable the redis subchart via redis.enabled" }} +{{- end -}} {{- end -}} -{{- end -}} \ No newline at end of file diff --git a/helm/oauth2-proxy/templates/deployment.yaml b/helm/oauth2-proxy/templates/deployment.yaml index 2fde68db..991ebf12 100644 --- a/helm/oauth2-proxy/templates/deployment.yaml +++ b/helm/oauth2-proxy/templates/deployment.yaml @@ -121,7 +121,7 @@ spec: {{- end }} {{- if eq (default "" .Values.sessionStorage.redis.clientType) "standalone" }} - name: OAUTH2_PROXY_REDIS_CONNECTION_URL - value: {{ include "oauth2-proxy.redisStandaloneUrl" . }} + value: {{ include "oauth2-proxy.redis.StandaloneUrl" . }} {{- else if eq (default "" .Values.sessionStorage.redis.clientType) "cluster" }} - name: OAUTH2_PROXY_REDIS_USE_CLUSTER value: "true"