Skip to content

Commit acadfb4

Browse files
authored
Feat/UI nginx configmap (#206)
* feat: add configurable nginx for UI with large JWT support - Add ConfigMap-based nginx configuration for Helm deployments - Increase buffer sizes for JWT tokens with many OIDC groups (up to 180) - Support both Helm (ConfigMap) and standalone (envsubst) modes - Configure proxy timeouts and headers * new helm package
1 parent 56d1639 commit acadfb4

File tree

8 files changed

+266
-119
lines changed

8 files changed

+266
-119
lines changed

helm/charts/envoy-xds-controller/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: "0.82"
18+
version: "0.83.0"
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "v0.14.0"
24+
appVersion: "v0.15.0"
2525

2626
home: https://github.com/kaasops/envoy-xds-controller
2727
sources:
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{{- if and .Values.ui.enabled .Values.ui.nginxConfigMap.enabled -}}
2+
{{- $nginx := .Values.ui.nginxConfigMap | default dict -}}
3+
{{- $proxySetHeader := $nginx.proxySetHeader | default dict -}}
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: {{ include "chart.fullname" . }}-ui-nginx-config
8+
namespace: {{ .Release.Namespace }}
9+
labels:
10+
{{- include "chart.labels-ui" . | nindent 4 }}
11+
data:
12+
template.conf: |
13+
server {
14+
# Dynamic config
15+
listen {{ .Values.ui.port }};
16+
server_name _;
17+
root /usr/share/nginx/html;
18+
19+
# Increase buffer sizes for large JWT tokens (users with many OIDC groups)
20+
# Default is 4 8k, but tokens with 100+ groups can exceed 8KB
21+
large_client_header_buffers {{ $nginx.largeClientHeaderBuffers | default "8 32k" }};
22+
proxy_buffer_size {{ $nginx.proxyBufferSize | default "32k" }};
23+
proxy_buffers {{ $nginx.proxyBuffers | default "8 32k" }};
24+
proxy_busy_buffers_size {{ $nginx.proxyBusyBuffersSize | default "64k" }};
25+
26+
# Proxy timeouts
27+
proxy_connect_timeout {{ $nginx.proxyConnectTimeout | default "60s" }};
28+
proxy_read_timeout {{ $nginx.proxyReadTimeout | default "60s" }};
29+
proxy_send_timeout {{ $nginx.proxySendTimeout | default "60s" }};
30+
31+
location = / {
32+
return 301 /nodeIDs;
33+
}
34+
location /nodeIDs {
35+
index index.html index.htm;
36+
try_files $uri $uri/ /index.html;
37+
}
38+
location /accessGroups {
39+
index index.html index.htm;
40+
try_files $uri $uri/ /index.html;
41+
}
42+
location /callback {
43+
index index.html index.htm;
44+
try_files $uri $uri/ /index.html;
45+
}
46+
location /api/v1 {
47+
{{- if $proxySetHeader.xRealIP | default false }}
48+
proxy_set_header X-Real-IP $remote_addr;
49+
{{- end }}
50+
{{- if $proxySetHeader.xForwardedFor | default false }}
51+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
52+
{{- end }}
53+
{{- if $proxySetHeader.xForwardedProto | default false }}
54+
proxy_set_header X-Forwarded-Proto $scheme;
55+
{{- end }}
56+
proxy_pass {{ .Values.ui.cacheAPI }};
57+
}
58+
location /grpc-api/ {
59+
{{- if $proxySetHeader.xRealIP | default false }}
60+
proxy_set_header X-Real-IP $remote_addr;
61+
{{- end }}
62+
{{- if $proxySetHeader.xForwardedFor | default false }}
63+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
64+
{{- end }}
65+
{{- if $proxySetHeader.xForwardedProto | default false }}
66+
proxy_set_header X-Forwarded-Proto $scheme;
67+
{{- end }}
68+
proxy_pass {{ .Values.ui.resourceAPI }}/;
69+
}
70+
}
71+
{{- end }}

helm/charts/envoy-xds-controller/templates/ui/deployment.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ spec:
3636
{{- toYaml . | nindent 8 }}
3737
{{- end }}
3838
serviceAccountName: {{ include "chart.serviceAccountName" . }}
39+
{{- if .Values.ui.nginxConfigMap.enabled }}
40+
volumes:
41+
- name: nginx-config
42+
configMap:
43+
name: {{ include "chart.fullname" . }}-ui-nginx-config
44+
{{- end }}
3945
containers:
4046
- image: {{ .Values.ui.image.repository }}:{{ default .Chart.AppVersion .Values.ui.image.tag }}
41-
{{- if .Values.ui.args }}
42-
args:
43-
{{- toYaml .Values.ui.args | nindent 10 }}
47+
name: envoy-xds-controller-ui
48+
imagePullPolicy: {{ .Values.image.pullPolicy }}
49+
{{- if .Values.ui.nginxConfigMap.enabled }}
50+
volumeMounts:
51+
- name: nginx-config
52+
mountPath: /etc/nginx/templates/nginx.conf
53+
subPath: template.conf
4454
{{- end }}
4555
env:
4656
- name: API_PROXY_PASS
@@ -85,8 +95,6 @@ spec:
8595
- name: http
8696
containerPort: {{ .Values.ui.port }}
8797
protocol: TCP
88-
imagePullPolicy: {{ .Values.image.pullPolicy }}
89-
name: envoy-xds-controller-ui
9098
resources:
9199
{{ toYaml .Values.ui.resources | indent 12 }}
92100
{{- end }}

helm/charts/envoy-xds-controller/values.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ ui:
4646
repository: kaasops/envoy-xds-controller-ui
4747
tag: "" # rewrites Chart.AppVersion
4848
pullPolicy: IfNotPresent
49-
args: []
5049
envs: {}
5150
cacheAPI: "http://exc-envoy-xds-controller-cache-api:9999"
5251
resourceAPI: "http://exc-envoy-xds-controller-resource-api:10000"
@@ -58,6 +57,30 @@ ui:
5857
cpu: 100m
5958
memory: 50Mi
6059
port: 8080
60+
# Nginx configuration via ConfigMap
61+
# When enabled: nginx config is managed via ConfigMap (allows runtime configuration)
62+
# When disabled: uses embedded config from Docker image (default)
63+
nginxConfigMap:
64+
enabled: false
65+
# Buffer sizes for large client headers (e.g., JWT tokens with many OIDC groups)
66+
# Format: <number> <size> where size is the max size of ONE header line
67+
# Each header line (e.g., Cookie with JWT) must fit in ONE buffer!
68+
# For 180 groups × 40 chars = ~7KB groups → JWT token ~15-25KB → need 32k per buffer
69+
# Default nginx: 4 8k (each header max 8KB)
70+
largeClientHeaderBuffers: "8 32k"
71+
proxyBufferSize: "32k"
72+
proxyBuffers: "8 32k"
73+
74+
proxyBusyBuffersSize: "64k"
75+
# Proxy timeouts for backend API requests
76+
proxyConnectTimeout: "60s"
77+
proxyReadTimeout: "60s"
78+
proxySendTimeout: "60s"
79+
# Proxy headers (useful when UI is behind Ingress/Load Balancer)
80+
proxySetHeader:
81+
xRealIP: true
82+
xForwardedFor: true
83+
xForwardedProto: true
6184
ingress:
6285
enabled: false
6386
annotations:

0 commit comments

Comments
 (0)