Skip to content

Commit d5b8199

Browse files
committed
Solve the problem with upstreams
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. Fixes #226
1 parent 3582a79 commit d5b8199

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
@@ -43,10 +43,18 @@ config:
4343
# Example:
4444
4545
46+
47+
# these exist only because if alphaConfig.enabled is not set then the
48+
# defaults there need to be present here. If it is set, then the defaults can
49+
# not be here because they're not valid. This should go away when alphaConfig
50+
# is default on.
51+
# https://github.com/oauth2-proxy/manifests/issues/226
52+
legacyDefaults: |-
53+
upstreams = [ "file:///dev/null" ]
54+
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)