Skip to content

Commit 03f22c7

Browse files
committed
fix-regression
1 parent 4608ea3 commit 03f22c7

10 files changed

Lines changed: 2454 additions & 113 deletions

charts/synapse/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: v2
33
name: synapse
44
description: matrix synapse kubernetes deployment
5-
version: 3.0.0
5+
version: 3.0.1
66
appVersion: 1.151.0

charts/synapse/templates/envoy-configmap.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,37 +186,37 @@ data:
186186
cluster: httpd-thread-subscriptions
187187
{{- end }}
188188
{{- end }}
189-
{{- range $route := .Values.ingress.roomRoutes }}
189+
{{- range $route := .Values.ingress.syncRoutes }}
190190
- match:
191191
safe_regex:
192192
regex: {{ printf "^%s" $route | squote }}
193193
route:
194194
timeout: 300s
195195
auto_host_rewrite: true
196-
cluster: httpd-room-hash
196+
cluster: httpd-user-hash
197197
hash_policy:
198198
- header:
199199
header_name: X-Hash-Key
200200
typed_per_filter_config:
201201
envoy.filters.http.lua:
202202
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
203-
name: room_hash
203+
name: whoami_hash
204204
{{- end }}
205-
{{- range $route := .Values.ingress.syncRoutes }}
205+
{{- range $route := .Values.ingress.roomRoutes }}
206206
- match:
207207
safe_regex:
208208
regex: {{ printf "^%s" $route | squote }}
209209
route:
210210
timeout: 300s
211211
auto_host_rewrite: true
212-
cluster: httpd-user-hash
212+
cluster: httpd-room-hash
213213
hash_policy:
214214
- header:
215215
header_name: X-Hash-Key
216216
typed_per_filter_config:
217217
envoy.filters.http.lua:
218218
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
219-
name: whoami_hash
219+
name: room_hash
220220
{{- end }}
221221
{{- range $route := .Values.ingress.clientReaderRoutes }}
222222
- match:
@@ -227,6 +227,17 @@ data:
227227
auto_host_rewrite: true
228228
cluster: httpd-client-reader
229229
{{- end }}
230+
{{- if not .Values.matrixAuthentication.enabled }}
231+
{{- range $route := .Values.ingress.clientReaderRegister }}
232+
- match:
233+
safe_regex:
234+
regex: {{ printf "^%s" $route | squote }}
235+
route:
236+
timeout: 300s
237+
auto_host_rewrite: true
238+
cluster: httpd-client-reader
239+
{{- end }}
240+
{{- end }}
230241
{{- if .Values.matrixAuthentication.enabled }}
231242
{{- range $route := .Values.ingress.matrixAuthentication }}
232243
- match:

charts/synapse/tests/golden/fixtures/test-envoy-configmap-msc4306.golden.yaml

Lines changed: 1221 additions & 0 deletions
Large diffs are not rendered by default.

charts/synapse/tests/golden/fixtures/test-envoy-configmap-no-mas.golden.yaml

Lines changed: 1160 additions & 0 deletions
Large diffs are not rendered by default.

charts/synapse/tests/golden/fixtures/test-envoy-configmap.golden.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,21 @@ data:
218218
cluster: httpd-device-lists
219219
- match:
220220
safe_regex:
221-
regex: '^/_matrix/client/.*(?:%21|!)[A-Za-z0-9._=/-]+(?::|%3[Aa])[A-Za-z0-9.-]+.*$'
221+
regex: '^/_matrix/client/(api/v1|r0|v3|unstable)/(sync|events|initialSync|rooms/[^/]+/initialSync)$'
222222
route:
223223
timeout: 300s
224224
auto_host_rewrite: true
225-
cluster: httpd-room-hash
225+
cluster: httpd-user-hash
226226
hash_policy:
227227
- header:
228228
header_name: X-Hash-Key
229229
typed_per_filter_config:
230230
envoy.filters.http.lua:
231231
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
232-
name: room_hash
232+
name: whoami_hash
233233
- match:
234234
safe_regex:
235-
regex: '^/_matrix/client/(api/v1|r0|v3|unstable)/(sync|events|initialSync|rooms/[^/]+/initialSync)$'
235+
regex: '^/_matrix/client/unstable/org.matrix.simplified_msc3575/sync$'
236236
route:
237237
timeout: 300s
238238
auto_host_rewrite: true
@@ -246,18 +246,18 @@ data:
246246
name: whoami_hash
247247
- match:
248248
safe_regex:
249-
regex: '^/_matrix/client/unstable/org.matrix.simplified_msc3575/sync$'
249+
regex: '^/_matrix/client/.*(?:%21|!)[A-Za-z0-9._=/-]+(?::|%3[Aa])[A-Za-z0-9.-]+.*$'
250250
route:
251251
timeout: 300s
252252
auto_host_rewrite: true
253-
cluster: httpd-user-hash
253+
cluster: httpd-room-hash
254254
hash_policy:
255255
- header:
256256
header_name: X-Hash-Key
257257
typed_per_filter_config:
258258
envoy.filters.http.lua:
259259
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
260-
name: whoami_hash
260+
name: room_hash
261261
- match:
262262
safe_regex:
263263
regex: '^/_matrix/client/versions$'

charts/synapse/tests/golden/fixtures/test-envoy-deployment.golden.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
app: synapse
2525
component: synapse-client-reader-envoy
2626
annotations:
27-
checksum/config: 2f9946972844bc7bcf913a1450f0484608cb3367e1461fa0d6a1d1524b616567
27+
checksum/config: c49abf62618877e6211fd19eeddaf6bbcd84bf5c4643dc397826aa555c96a1c4
2828
spec:
2929
terminationGracePeriodSeconds: 60
3030
containers:

charts/synapse/tests/golden/fixtures/test-ingress-msc4306.golden.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

charts/synapse/tests/golden/fixtures/test-ingress-no-mas.golden.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

charts/synapse/tests/golden/unit/envoy_test.go

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import (
99
"github.com/stretchr/testify/suite"
1010
)
1111

12-
// TestGoldenEnvoyConfigmap covers the envoy configmap that embeds
13-
// scripts/envoy.yaml and scripts/synapse.lua from chart files.
12+
// TestGoldenEnvoyConfigmap covers the default routing configuration:
13+
// matrixAuthentication enabled, msc4306 disabled.
14+
// Verifies that MAS login/logout routes point to httpd-matrix-auth cluster
15+
// and threadSubscriptions routes are absent.
1416
func TestGoldenEnvoyConfigmap(t *testing.T) {
1517
t.Parallel()
1618

@@ -26,6 +28,45 @@ func TestGoldenEnvoyConfigmap(t *testing.T) {
2628
})
2729
}
2830

31+
// TestGoldenEnvoyConfigmapNoMAS covers routing when matrixAuthentication is
32+
// disabled: clientReaderRegister routes (login$, register$, password_policy$)
33+
// must appear and point to httpd-client-reader; httpd-matrix-auth cluster
34+
// must be absent.
35+
func TestGoldenEnvoyConfigmapNoMAS(t *testing.T) {
36+
t.Parallel()
37+
38+
chartPath, err := filepath.Abs("../../..")
39+
require.NoError(t, err)
40+
41+
suite.Run(t, &golden.TemplateGoldenTest{
42+
ChartPath: chartPath,
43+
Release: "golden-file-test",
44+
Namespace: "test-namespace",
45+
GoldenFileName: "test-envoy-configmap-no-mas",
46+
Templates: []string{"templates/envoy-configmap.yaml"},
47+
SetValues: map[string]string{"matrixAuthentication.enabled": "false"},
48+
})
49+
}
50+
51+
// TestGoldenEnvoyConfigmapMsc4306 covers routing when thread_subscriptions MSC
52+
// is enabled: threadSubscriptionsRoutes and httpd-thread-subscriptions cluster
53+
// must appear.
54+
func TestGoldenEnvoyConfigmapMsc4306(t *testing.T) {
55+
t.Parallel()
56+
57+
chartPath, err := filepath.Abs("../../..")
58+
require.NoError(t, err)
59+
60+
suite.Run(t, &golden.TemplateGoldenTest{
61+
ChartPath: chartPath,
62+
Release: "golden-file-test",
63+
Namespace: "test-namespace",
64+
GoldenFileName: "test-envoy-configmap-msc4306",
65+
Templates: []string{"templates/envoy-configmap.yaml"},
66+
SetValues: map[string]string{"experimentalFeatures.msc4306.enabled": "true"},
67+
})
68+
}
69+
2970
func TestGoldenEnvoyDeployment(t *testing.T) {
3071
t.Parallel()
3172

charts/synapse/tests/golden/unit/ingress_test.go

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import (
99
"github.com/stretchr/testify/suite"
1010
)
1111

12-
// TestGoldenIngressDefault covers the default routing configuration:
13-
// matrixAuthentication enabled, msc4306 disabled.
14-
// Verifies that MAS login/logout routes point to matrix-authentication service
15-
// and threadSubscriptions routes are absent.
16-
func TestGoldenIngressDefault(t *testing.T) {
12+
// TestGoldenIngress verifies the simplified ingress that routes all traffic to
13+
// synapse-client-reader-envoy (path: /, pathType: Prefix). All routing logic
14+
// now lives in the envoy configmap — see envoy_test.go for routing variants.
15+
func TestGoldenIngress(t *testing.T) {
1716
t.Parallel()
1817

1918
chartPath, err := filepath.Abs("../../..")
@@ -27,40 +26,3 @@ func TestGoldenIngressDefault(t *testing.T) {
2726
Templates: []string{"templates/synapse-ingress.yaml"},
2827
})
2928
}
30-
31-
// TestGoldenIngressWithoutMAS covers routing when matrixAuthentication is disabled:
32-
// clientReaderRegister routes (login, register) must appear and point to
33-
// synapse-client-reader-envoy instead of matrix-authentication.
34-
func TestGoldenIngressWithoutMAS(t *testing.T) {
35-
t.Parallel()
36-
37-
chartPath, err := filepath.Abs("../../..")
38-
require.NoError(t, err)
39-
40-
suite.Run(t, &golden.TemplateGoldenTest{
41-
ChartPath: chartPath,
42-
Release: "golden-file-test",
43-
Namespace: "test-namespace",
44-
GoldenFileName: "test-ingress-no-mas",
45-
Templates: []string{"templates/synapse-ingress.yaml"},
46-
SetValues: map[string]string{"matrixAuthentication.enabled": "false"},
47-
})
48-
}
49-
50-
// TestGoldenIngressWithMsc4306 covers routing when thread_subscriptions MSC is enabled:
51-
// threadSubscriptionsRoutes must appear and point to synapse-thread-subscriptions service.
52-
func TestGoldenIngressWithMsc4306(t *testing.T) {
53-
t.Parallel()
54-
55-
chartPath, err := filepath.Abs("../../..")
56-
require.NoError(t, err)
57-
58-
suite.Run(t, &golden.TemplateGoldenTest{
59-
ChartPath: chartPath,
60-
Release: "golden-file-test",
61-
Namespace: "test-namespace",
62-
GoldenFileName: "test-ingress-msc4306",
63-
Templates: []string{"templates/synapse-ingress.yaml"},
64-
SetValues: map[string]string{"experimentalFeatures.msc4306.enabled": "true"},
65-
})
66-
}

0 commit comments

Comments
 (0)