Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions charts/synapse/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# additional files
README.md
# fix and remove
NOTES.txt
tests/
docker/
2 changes: 1 addition & 1 deletion charts/synapse/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
apiVersion: v2
name: synapse
description: matrix synapse kubernetes deployment
version: 2.2.1
version: 2.3.0
appVersion: 1.151.0
44 changes: 44 additions & 0 deletions charts/synapse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,50 @@ app: synapse
component: synapse-{{ . }}
{{- end }}

{{/*
Base helper for Synapse cache size limits.
Falls back to .fallback when no limit is configured or suffix is unrecognised.
Supported Kubernetes suffixes: Gi, Mi, G, M.
*/}}
{{- define "synapse.workerCacheMemory" -}}
{{- $resources := .options.resources | default .defaults -}}
{{- $memLimit := "" -}}
{{- if and $resources $resources.limits $resources.limits.memory -}}
{{- $memLimit = $resources.limits.memory | toString -}}
{{- end -}}
{{- $num := .num -}}
{{- $denom := .denom -}}
{{- if $memLimit -}}
{{- if hasSuffix "Gi" $memLimit -}}
{{- $val := trimSuffix "Gi" $memLimit | int64 -}}
{{- printf "%dM" (div (mul (mul $val 1024) $num) $denom) -}}
{{- else if hasSuffix "Mi" $memLimit -}}
{{- $val := trimSuffix "Mi" $memLimit | int64 -}}
{{- printf "%dM" (div (mul $val $num) $denom) -}}
{{- else if hasSuffix "G" $memLimit -}}
{{- $val := trimSuffix "G" $memLimit | int64 -}}
{{- printf "%dM" (div (mul (mul $val 1024) $num) $denom) -}}
{{- else if hasSuffix "M" $memLimit -}}
{{- $val := trimSuffix "M" $memLimit | int64 -}}
{{- printf "%dM" (div (mul $val $num) $denom) -}}
{{- else -}}
{{- .fallback -}}
{{- end -}}
{{- else -}}
{{- .fallback -}}
{{- end -}}
{{- end -}}

{{/* max_cache_memory_usage = 90% of memory limit */}}
{{- define "synapse.workerMaxCacheMemory" -}}
{{- include "synapse.workerCacheMemory" (merge (dict "num" 9 "denom" 10) .) -}}
{{- end -}}

{{/* target_cache_memory_usage = 80% of max = 72% of memory limit */}}
{{- define "synapse.workerTargetCacheMemory" -}}
{{- include "synapse.workerCacheMemory" (merge (dict "num" 72 "denom" 100) .) -}}
{{- end -}}

{{/*
Workers containers
*/}}
Expand Down
4 changes: 2 additions & 2 deletions charts/synapse/templates/synapse-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ stringData:
cache_entry_ttl: {{ $.Values.synapse.caches.cacheEntryTtl }}
sync_response_cache_duration: {{ $.Values.synapse.caches.syncResponseCacheDuration }}
cache_autotuning:
max_cache_memory_usage: {{ $.Values.synapse.cacheAutotuning.maxCacheMemoryUsage }}
target_cache_memory_usage: {{ $.Values.synapse.cacheAutotuning.targetCacheMemoryUsage }}
max_cache_memory_usage: {{ include "synapse.workerMaxCacheMemory" (dict "options" $options "defaults" $.Values.synapse.resourcesDefaults "fallback" $.Values.synapse.cacheAutotuning.maxCacheMemoryUsage) }}
target_cache_memory_usage: {{ include "synapse.workerTargetCacheMemory" (dict "options" $options "defaults" $.Values.synapse.resourcesDefaults "fallback" $.Values.synapse.cacheAutotuning.targetCacheMemoryUsage) }}
min_cache_ttl: {{ $.Values.synapse.cacheAutotuning.minCacheTtl }}
{{- if $.Values.synapse.opentracing.enabled }}
opentracing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
port:
number: 80
name: synapse-presence
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/
pathType: ImplementationSpecific
backend:
service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
port:
number: 80
name: synapse-presence
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/
pathType: ImplementationSpecific
backend:
service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
port:
number: 80
name: synapse-presence
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
- path: /_matrix/client/(api/v1|r0|v3|unstable)/pushrules/(global|device)/(override|underride|sender|room|content|default)/
pathType: ImplementationSpecific
backend:
service:
Expand Down
Loading