Skip to content

Commit ce41794

Browse files
committed
clientKeysHashedRoutes
1 parent add156f commit ce41794

7 files changed

Lines changed: 213 additions & 29 deletions

File tree

charts/synapse/Chart.yaml

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

charts/synapse/templates/envoy-configmap.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,23 @@ data:
287287
cluster: httpd-client-keys
288288
{{- end }}
289289
290+
{{- range $route := .Values.ingress.clientKeysHashedRoutes }}
291+
- match:
292+
safe_regex:
293+
regex: {{ printf "^%s" $route | squote }}
294+
route:
295+
timeout: 300s
296+
auto_host_rewrite: true
297+
cluster: httpd-client-keys-user-ring-hash
298+
hash_policy:
299+
- header:
300+
header_name: X-Hash-Key
301+
typed_per_filter_config:
302+
envoy.filters.http.lua:
303+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
304+
name: whoami_hash
305+
{{- end }}
306+
290307
{{- range $route := .Values.ingress.clientEventsRoomRoutes }}
291308
- match:
292309
safe_regex:
@@ -476,6 +493,31 @@ data:
476493
socket_address:
477494
address: synapse-client-keys-headless
478495
port_value: 8008
496+
- name: httpd-client-keys-user-ring-hash
497+
connect_timeout: 1.00s
498+
type: STRICT_DNS
499+
dns_lookup_family: V4_ONLY
500+
ignore_health_on_host_removal: true
501+
lb_policy: RING_HASH
502+
circuit_breakers:
503+
thresholds:
504+
- priority: DEFAULT
505+
max_connections: 30000
506+
max_requests: 8192
507+
max_retries: 3
508+
- priority: HIGH
509+
max_connections: 30000
510+
max_requests: 8192
511+
max_retries: 3
512+
load_assignment:
513+
cluster_name: httpd-client-keys-user-ring-hash
514+
endpoints:
515+
- lb_endpoints:
516+
- endpoint:
517+
address:
518+
socket_address:
519+
address: synapse-client-keys-headless
520+
port_value: 8008
479521
- name: httpd-federation-ip-hash
480522
connect_timeout: 1.00s
481523
type: STRICT_DNS

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

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ data:
211211
name: whoami_hash
212212
- match:
213213
safe_regex:
214-
regex: '^/_matrix/client/unstable/org.matrix.simplified_msc3575/sync'
214+
regex: '^/_matrix/client/unstable/org\.matrix\.simplified_msc3575/sync'
215215
route:
216216
timeout: 300s
217217
auto_host_rewrite: true
@@ -606,39 +606,60 @@ data:
606606
cluster: httpd-matrix-auth
607607
- match:
608608
safe_regex:
609-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/query$'
609+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/changes$'
610610
route:
611611
timeout: 300s
612612
auto_host_rewrite: true
613613
cluster: httpd-client-keys
614614
- match:
615615
safe_regex:
616-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/changes$'
616+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/claim$'
617617
route:
618618
timeout: 300s
619619
auto_host_rewrite: true
620620
cluster: httpd-client-keys
621621
- match:
622622
safe_regex:
623-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/claim$'
623+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/query$'
624624
route:
625625
timeout: 300s
626626
auto_host_rewrite: true
627-
cluster: httpd-client-keys
627+
cluster: httpd-client-keys-user-ring-hash
628+
hash_policy:
629+
- header:
630+
header_name: X-Hash-Key
631+
typed_per_filter_config:
632+
envoy.filters.http.lua:
633+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
634+
name: whoami_hash
628635
- match:
629636
safe_regex:
630637
regex: '^/_matrix/client/(r0|v3|unstable)/room_keys/'
631638
route:
632639
timeout: 300s
633640
auto_host_rewrite: true
634-
cluster: httpd-client-keys
641+
cluster: httpd-client-keys-user-ring-hash
642+
hash_policy:
643+
- header:
644+
header_name: X-Hash-Key
645+
typed_per_filter_config:
646+
envoy.filters.http.lua:
647+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
648+
name: whoami_hash
635649
- match:
636650
safe_regex:
637651
regex: '^/_matrix/client/(r0|v3|unstable)/room_keys/.*'
638652
route:
639653
timeout: 300s
640654
auto_host_rewrite: true
641-
cluster: httpd-client-keys
655+
cluster: httpd-client-keys-user-ring-hash
656+
hash_policy:
657+
- header:
658+
header_name: X-Hash-Key
659+
typed_per_filter_config:
660+
envoy.filters.http.lua:
661+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
662+
name: whoami_hash
642663
- match:
643664
safe_regex:
644665
regex: '^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact.*'
@@ -928,7 +949,7 @@ data:
928949
cluster: httpd-client-reader
929950
- match:
930951
safe_regex:
931-
regex: '^/_matrix/client/unstable/org.matrix.msc4140/delayed_events(/.*/restart)?$'
952+
regex: '^/_matrix/client/unstable/org\.matrix\.msc4140/delayed_events(/.*/restart)?$'
932953
route:
933954
timeout: 300s
934955
auto_host_rewrite: true
@@ -1090,6 +1111,31 @@ data:
10901111
socket_address:
10911112
address: synapse-client-keys-headless
10921113
port_value: 8008
1114+
- name: httpd-client-keys-user-ring-hash
1115+
connect_timeout: 1.00s
1116+
type: STRICT_DNS
1117+
dns_lookup_family: V4_ONLY
1118+
ignore_health_on_host_removal: true
1119+
lb_policy: RING_HASH
1120+
circuit_breakers:
1121+
thresholds:
1122+
- priority: DEFAULT
1123+
max_connections: 30000
1124+
max_requests: 8192
1125+
max_retries: 3
1126+
- priority: HIGH
1127+
max_connections: 30000
1128+
max_requests: 8192
1129+
max_retries: 3
1130+
load_assignment:
1131+
cluster_name: httpd-client-keys-user-ring-hash
1132+
endpoints:
1133+
- lb_endpoints:
1134+
- endpoint:
1135+
address:
1136+
socket_address:
1137+
address: synapse-client-keys-headless
1138+
port_value: 8008
10931139
- name: httpd-federation-ip-hash
10941140
connect_timeout: 1.00s
10951141
type: STRICT_DNS

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

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ data:
232232
name: whoami_hash
233233
- match:
234234
safe_regex:
235-
regex: '^/_matrix/client/unstable/org.matrix.simplified_msc3575/sync'
235+
regex: '^/_matrix/client/unstable/org\.matrix\.simplified_msc3575/sync'
236236
route:
237237
timeout: 300s
238238
auto_host_rewrite: true
@@ -620,39 +620,60 @@ data:
620620
cluster: httpd-user-dir
621621
- match:
622622
safe_regex:
623-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/query$'
623+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/changes$'
624624
route:
625625
timeout: 300s
626626
auto_host_rewrite: true
627627
cluster: httpd-client-keys
628628
- match:
629629
safe_regex:
630-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/changes$'
630+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/claim$'
631631
route:
632632
timeout: 300s
633633
auto_host_rewrite: true
634634
cluster: httpd-client-keys
635635
- match:
636636
safe_regex:
637-
regex: '^/_matrix/client/(r0|v3|unstable)/keys/claim$'
637+
regex: '^/_matrix/client/(r0|v3|unstable)/keys/query$'
638638
route:
639639
timeout: 300s
640640
auto_host_rewrite: true
641-
cluster: httpd-client-keys
641+
cluster: httpd-client-keys-user-ring-hash
642+
hash_policy:
643+
- header:
644+
header_name: X-Hash-Key
645+
typed_per_filter_config:
646+
envoy.filters.http.lua:
647+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
648+
name: whoami_hash
642649
- match:
643650
safe_regex:
644651
regex: '^/_matrix/client/(r0|v3|unstable)/room_keys/'
645652
route:
646653
timeout: 300s
647654
auto_host_rewrite: true
648-
cluster: httpd-client-keys
655+
cluster: httpd-client-keys-user-ring-hash
656+
hash_policy:
657+
- header:
658+
header_name: X-Hash-Key
659+
typed_per_filter_config:
660+
envoy.filters.http.lua:
661+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
662+
name: whoami_hash
649663
- match:
650664
safe_regex:
651665
regex: '^/_matrix/client/(r0|v3|unstable)/room_keys/.*'
652666
route:
653667
timeout: 300s
654668
auto_host_rewrite: true
655-
cluster: httpd-client-keys
669+
cluster: httpd-client-keys-user-ring-hash
670+
hash_policy:
671+
- header:
672+
header_name: X-Hash-Key
673+
typed_per_filter_config:
674+
envoy.filters.http.lua:
675+
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
676+
name: whoami_hash
656677
- match:
657678
safe_regex:
658679
regex: '^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact.*'
@@ -942,7 +963,7 @@ data:
942963
cluster: httpd-client-reader
943964
- match:
944965
safe_regex:
945-
regex: '^/_matrix/client/unstable/org.matrix.msc4140/delayed_events(/.*/restart)?$'
966+
regex: '^/_matrix/client/unstable/org\.matrix\.msc4140/delayed_events(/.*/restart)?$'
946967
route:
947968
timeout: 300s
948969
auto_host_rewrite: true
@@ -1104,6 +1125,31 @@ data:
11041125
socket_address:
11051126
address: synapse-client-keys-headless
11061127
port_value: 8008
1128+
- name: httpd-client-keys-user-ring-hash
1129+
connect_timeout: 1.00s
1130+
type: STRICT_DNS
1131+
dns_lookup_family: V4_ONLY
1132+
ignore_health_on_host_removal: true
1133+
lb_policy: RING_HASH
1134+
circuit_breakers:
1135+
thresholds:
1136+
- priority: DEFAULT
1137+
max_connections: 30000
1138+
max_requests: 8192
1139+
max_retries: 3
1140+
- priority: HIGH
1141+
max_connections: 30000
1142+
max_requests: 8192
1143+
max_retries: 3
1144+
load_assignment:
1145+
cluster_name: httpd-client-keys-user-ring-hash
1146+
endpoints:
1147+
- lb_endpoints:
1148+
- endpoint:
1149+
address:
1150+
socket_address:
1151+
address: synapse-client-keys-headless
1152+
port_value: 8008
11071153
- name: httpd-federation-ip-hash
11081154
connect_timeout: 1.00s
11091155
type: STRICT_DNS

0 commit comments

Comments
 (0)