Skip to content

Commit d857566

Browse files
committed
Solve the problem with upstreams Fix #226
Upstreams is no longer allowed if you have alphaConfig enabled, because the option is available in alphaConfig. However, setting the default in alphaConfig won't work, because people may have it disabled, and it's disabled by default. This means we need this value to remain in configFile as a default if alphaConfig isn't enabled.
1 parent 09bd6a6 commit d857566

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

helm/oauth2-proxy/templates/configmap.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ metadata:
1313
name: {{ template "oauth2-proxy.fullname" . }}
1414
namespace: {{ template "oauth2-proxy.namespace" $ }}
1515
data:
16+
{{- if and (not .Values.alphaConfig.enabled) .Values.config.legacyDefaults }}
17+
oauth2_proxy.cfg: |-
18+
{{ tpl .Values.config.legacyDefaults $ | indent 4 }}
19+
20+
{{ tpl .Values.config.configFile $ | indent 4 }}
21+
{{- else }}
1622
oauth2_proxy.cfg: {{ tpl .Values.config.configFile $ | quote }}
23+
{{- end }}
1724
{{- end }}
1825
{{- end }}

helm/oauth2-proxy/values.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ config:
3232
# If left empty, it will default to the release name
3333
cookieName: ""
3434
google: {}
35+
36+
# these exist only because if alphaConfig.enabled is not set then the
37+
# defaults there need to be present here. If it is set, then the defaults can
38+
# not be here because they're not valid. This should go away when alphaConfig
39+
# is default on.
40+
# https://github.com/oauth2-proxy/manifests/issues/226
41+
legacyDefaults: |-
42+
upstreams = [ "file:///dev/null" ]
43+
3544
# adminEmail: xxxx
3645
# useApplicationDefaultCredentials: true
3746
# targetPrincipal: xxxx
@@ -46,7 +55,6 @@ config:
4655
# Default configuration, to be overridden
4756
configFile: |-
4857
email_domains = [ "*" ]
49-
upstreams = [ "file:///dev/null" ]
5058
# Custom configuration file: oauth2_proxy.cfg
5159
# configFile: |-
5260
# pass_basic_auth = false
@@ -64,7 +72,9 @@ alphaConfig:
6472
# Arbitrary configuration data to append to the metrics section
6573
metricsConfigData: {}
6674
# Arbitrary configuration data to append
67-
configData: {}
75+
configData:
76+
upstreams:
77+
- "file:///dev/null"
6878
# Arbitrary configuration to append
6979
# This is treated as a Go template and rendered with the root context
7080
configFile: ""

0 commit comments

Comments
 (0)