Skip to content

Commit 223702f

Browse files
authored
add support for alpha configuration. (#71)
the alpha configuration provides access to experimental, as well as advanced features not available with the "regular" config. this change add support for either using an existing configmap or creating one using the provided values.
1 parent 2d7d7c9 commit 223702f

File tree

5 files changed

+71
-4
lines changed

5 files changed

+71
-4
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.0.1
2+
version: 6.1.0
33
apiVersion: v2
44
appVersion: 7.2.0
55
home: https://oauth2-proxy.github.io/oauth2-proxy/

helm/oauth2-proxy/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ For users who don't want downtime, you can perform these actions:
8080

8181
### To 6.0.0
8282

83-
Version 6.0.0 bumps the version of the redis subchart from ~10.6.0 to ~16.4.0. You probably need to adjust your redis config. See [here](https://github.com/bitnami/charts/tree/master/bitnami/redis#upgrading) for detailed upgrade instructions.
83+
Version 6.0.0 bumps the version of the redis subchart from ~10.6.0 to ~16.4.0. You probably need to adjust your redis config. See [here](https://github.com/bitnami/charts/tree/master/bitnami/redis#upgrading) for detailed upgrade instructions.
8484

8585
## Configuration
8686

@@ -102,6 +102,12 @@ Parameter | Description | Default
102102
`config.configFile` | custom [oauth2_proxy.cfg](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/oauth2-proxy.cfg.example) contents for settings not overridable via environment nor command line | `""`
103103
`config.existingConfig` | existing Kubernetes configmap to use for the configuration file. See [config template](https://github.com/oauth2-proxy/manifests/blob/master/helm/oauth2-proxy/templates/configmap.yaml) for the required values | `nil`
104104
`config.cookieName` | The name of the cookie that oauth2-proxy will create. | `""`
105+
`alphaConfig.enabled` | Flag to toggle any alpha config related logic | `false`
106+
`alphaConfig.annotations` | Configmap annotations | `{}`
107+
`alphaConfig.serverConfigData` | Arbitrary configuration data to append to the server section | `{}`
108+
`alphaConfig.metricsConfigData` | Arbitrary configuration data to append to the metrics section | `{}`
109+
`alphaConfig.configData` | Arbitrary configuration data to append | `{}`
110+
`alphaConfig.existingConfig` | existing Kubernetes configmap to use for the alpha configuration file. See [config template](https://github.com/oauth2-proxy/manifests/blob/master/helm/oauth2-proxy/templates/configmap-alpha.yaml) for the required values | `nil`
105111
`customLabels` | Custom labels to add into metadata | `{}` |
106112
`config.google.adminEmail` | user impersonated by the google service account | `""`
107113
`config.google.serviceAccountJson` | google service account json contents | `""`
@@ -179,7 +185,7 @@ Parameter | Description | Default
179185
`metrics.servicemonitor.scrapeTimeout` | Prometheus scrape timeout | `30s`
180186
`metrics.servicemonitor.labels` | Add custom labels to the ServiceMonitor resource| `{}`
181187
`extraObjects` | Extra K8s manifests to deploy | `[]`
182-
188+
183189
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
184190

185191
```console
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.alphaConfig.enabled }}
2+
{{- if not .Values.alphaConfig.existingConfig }}
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
{{- if .Values.alphaConfig.annotations }}
7+
annotations: {{- toYaml .Values.alphaConfig.annotations | nindent 4 }}
8+
{{- end }}
9+
labels:
10+
app: {{ template "oauth2-proxy.name" . }}
11+
{{- include "oauth2-proxy.labels" . | indent 4 }}
12+
name: {{ template "oauth2-proxy.fullname" . }}-alpha
13+
data:
14+
oauth2_proxy.yml: |
15+
---
16+
server:
17+
BindAddress: '0.0.0.0:4180'
18+
{{- if .Values.alphaConfig.serverConfigData }}
19+
{{- toYaml .Values.alphaConfig.serverConfigData | nindent 6 }}
20+
{{- end }}
21+
{{- if .Values.metrics.enabled }}
22+
metricsServer:
23+
BindAddress: '0.0.0.0:44180'
24+
{{- if .Values.alphaConfig.metricsConfigData }}
25+
{{- toYaml .Values.alphaConfig.metricsConfigData | nindent 6 }}
26+
{{- end }}
27+
{{- end }}
28+
{{- if .Values.alphaConfig.configData }}
29+
{{- toYaml .Values.alphaConfig.configData | nindent 4 }}
30+
{{- end }}
31+
{{- end }}
32+
{{- end }}

helm/oauth2-proxy/templates/deployment.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ spec:
5454
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
5555
imagePullPolicy: {{ .Values.image.pullPolicy }}
5656
args:
57+
{{- if .Values.alphaConfig.enabled }}
58+
- --alpha-config=/etc/oauth2_proxy/oauth2_proxy.yml
59+
{{- else }}
5760
- --http-address=0.0.0.0:4180
5861
{{- if .Values.metrics.enabled }}
5962
- --metrics-address=0.0.0.0:44180
6063
{{- end }}
64+
{{- end }}
6165
{{- if .Values.config.cookieName }}
6266
- --cookie-name={{ .Values.config.cookieName }}
6367
{{- end }}
@@ -182,8 +186,14 @@ spec:
182186
{{- end }}
183187
{{- end }}
184188
{{- if or .Values.config.existingConfig .Values.config.configFile }}
185-
- mountPath: /etc/oauth2_proxy
189+
- mountPath: /etc/oauth2_proxy/oauth2_proxy.cfg
186190
name: configmain
191+
subPath: oauth2_proxy.cfg
192+
{{- end }}
193+
{{- if .Values.alphaConfig.enabled }}
194+
- mountPath: /etc/oauth2_proxy/oauth2_proxy.yml
195+
name: configalpha
196+
subPath: oauth2_proxy.yml
187197
{{- end }}
188198
{{- if .Values.authenticatedEmailsFile.enabled }}
189199
- mountPath: /etc/oauth2-proxy
@@ -241,6 +251,12 @@ spec:
241251
name: {{ if .Values.config.existingConfig }}{{ .Values.config.existingConfig }}{{ else }}{{ template "oauth2-proxy.fullname" . }}{{ end }}
242252
name: configmain
243253
{{- end }}
254+
{{- if .Values.alphaConfig.enabled }}
255+
- configMap:
256+
defaultMode: 420
257+
name: {{ if .Values.alphaConfig.existingConfig }}{{ .Values.alphaConfig.existingConfig }}{{ else }}{{ template "oauth2-proxy.fullname" . }}-alpha{{ end }}
258+
name: configalpha
259+
{{- end }}
244260
{{- if ne (len .Values.extraVolumes) 0 }}
245261
{{ toYaml .Values.extraVolumes | indent 6 }}
246262
{{- end }}

helm/oauth2-proxy/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ config:
3838
# Example:
3939
# existingConfig: config
4040

41+
alphaConfig:
42+
enabled: false
43+
# Add config annotations
44+
annotations: {}
45+
# Arbitrary configuration data to append to the server section
46+
serverConfigData: {}
47+
# Arbitrary configuration data to append to the metrics section
48+
metricsConfigData: {}
49+
# Arbitrary configuration data to append
50+
configData: {}
51+
# Use an existing config map (see configmap-alpha.yaml for required fields)
52+
existingConfig: ~
53+
4154
image:
4255
repository: "quay.io/oauth2-proxy/oauth2-proxy"
4356
tag: "v7.2.0"

0 commit comments

Comments
 (0)