chart: move everything under synapse key, and enhance context in helpers

This commit is contained in:
Gaël Goinvic committed 2024-11-27 14:55:43 +01:00
1 parent f80723ebe1
commit d6a83d473d
24 files changed
+3123 -2915

No files matched your search

+229 -214
View File
@@ -3,208 +3,119 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"postgres": {
"$ref": "file://./../../matrix-stack/sub_schemas/postgres-libpq.json"
},
"media": {
"type": "object",
"properties": {
"storage": {
"$ref": "file://./../../matrix-stack/sub_schemas/persistentVolumeClaim.json"
}
}
},
"macaroon": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"registrationSharedSecret": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"signingKey": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"additional": {
"type": "object",
"anyOf": [
{
"required": []
},
{
"required": [
"config"
]
},
{
"required": [
"configSecret",
"configSecretKey"
]
}
],
"properties": {
"config": {
"type": "string"
},
"configSecret": {
"type": "string"
},
"configSecretKey": {
"type": "string"
}
}
},
"appservices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"registrationFileConfigMap": {
"type": "string"
}
}
}
},
"logging": {
"type": "object",
"properties": {
"rootLevel": {
"type": "string",
"enum": [
"CRITICAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG"
]
},
"levelOverrides": {
"type": "object",
"additionalProperties": {
"type": "string",
"enum": [
"CRITICAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG"
]
}
}
}
},
"global": {
"$ref": "file://./../../matrix-stack/sub_schemas/global.json"
},
"ess": {
"$ref": "file://./../../matrix-stack/sub_schemas/ess.json"
},
"ess-library": {
"$ref": "file://./../../matrix-stack/sub_schemas/essLibrary.json"
"type": "object",
"additionalProperties": true
},
"ingress": {
"$ref": "file://sub_schemas/ingress_with_additional_paths.json"
},
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
"extraEnv": {
"$ref": "file://./../../matrix-stack/sub_schemas/extraEnv.json"
},
"hostAliases": {
"$ref": "file://./../../matrix-stack/sub_schemas/hostAliases.json"
},
"nodeSelector": {
"$ref": "file://./../../matrix-stack/sub_schemas/nodeSelector.json"
},
"podSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/podSecurityContext.json"
},
"resources": {
"$ref": "file://./../../matrix-stack/sub_schemas/resources.json"
},
"serviceAccount": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceAccount.json"
},
"serviceMonitors": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceMonitors.json"
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
},
"workers": {
"synapse": {
"type": "object",
"properties": {
"appservice": {
"$ref": "file://sub_schemas/single_worker.json"
"enabled": {
"type": "boolean"
},
"background": {
"$ref": "file://sub_schemas/single_worker.json"
"postgres": {
"$ref": "file://./../../matrix-stack/sub_schemas/postgres-libpq.json"
},
"client-reader": {
"$ref": "file://sub_schemas/scalable_worker.json"
"media": {
"type": "object",
"properties": {
"storage": {
"$ref": "file://./../../matrix-stack/sub_schemas/persistentVolumeClaim.json"
}
}
},
"encryption": {
"$ref": "file://sub_schemas/single_worker.json"
"macaroon": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"event-creator": {
"$ref": "file://sub_schemas/scalable_worker.json"
"registrationSharedSecret": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"event-persister": {
"$ref": "file://sub_schemas/scalable_worker.json"
"signingKey": {
"$ref": "file://./../../matrix-stack/sub_schemas/credential.json"
},
"federation-reader": {
"$ref": "file://sub_schemas/scalable_worker.json"
"additional": {
"type": "object",
"anyOf": [
{
"required": []
},
{
"required": [
"config"
]
},
{
"required": [
"configSecret",
"configSecretKey"
]
}
],
"properties": {
"config": {
"type": "string"
},
"configSecret": {
"type": "string"
},
"configSecretKey": {
"type": "string"
}
}
},
"federation-sender": {
"$ref": "file://sub_schemas/scalable_worker.json"
"appservices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"registrationFileConfigMap": {
"type": "string"
}
}
}
},
"initial-synchrotron": {
"$ref": "file://sub_schemas/scalable_worker.json"
"logging": {
"type": "object",
"properties": {
"rootLevel": {
"type": "string",
"enum": [
"CRITICAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG"
]
},
"levelOverrides": {
"type": "object",
"additionalProperties": {
"type": "string",
"enum": [
"CRITICAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG"
]
}
}
}
},
"media-repository": {
"$ref": "file://sub_schemas/single_worker.json"
"global": {
"$ref": "file://./../../matrix-stack/sub_schemas/global.json"
},
"presence-writer": {
"$ref": "file://sub_schemas/single_worker.json"
"ess-library": {
"$ref": "file://./../../matrix-stack/sub_schemas/essLibrary.json"
},
"pusher": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"receipts-account": {
"$ref": "file://sub_schemas/single_worker.json"
},
"sliding-sync": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"sso-login": {
"$ref": "file://sub_schemas/single_worker.json"
},
"synchrotron": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"typing-persister": {
"$ref": "file://sub_schemas/single_worker.json"
},
"user-dir": {
"$ref": "file://sub_schemas/single_worker.json"
}
}
},
"haproxy": {
"type": "object",
"properties": {
"replicas": {
"minimum": 1,
"type": "integer"
"ingress": {
"$ref": "file://sub_schemas/ingress_with_additional_paths.json"
},
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
@@ -218,6 +129,12 @@
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
"extraEnv": {
"$ref": "file://./../../matrix-stack/sub_schemas/extraEnv.json"
},
"hostAliases": {
"$ref": "file://./../../matrix-stack/sub_schemas/hostAliases.json"
},
"nodeSelector": {
"$ref": "file://./../../matrix-stack/sub_schemas/nodeSelector.json"
},
@@ -235,40 +152,138 @@
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
}
}
},
"redis": {
"type": "object",
"properties": {
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
"workers": {
"type": "object",
"properties": {
"appservice": {
"$ref": "file://sub_schemas/single_worker.json"
},
"background": {
"$ref": "file://sub_schemas/single_worker.json"
},
"client-reader": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"encryption": {
"$ref": "file://sub_schemas/single_worker.json"
},
"event-creator": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"event-persister": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"federation-reader": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"federation-sender": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"initial-synchrotron": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"media-repository": {
"$ref": "file://sub_schemas/single_worker.json"
},
"presence-writer": {
"$ref": "file://sub_schemas/single_worker.json"
},
"pusher": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"receipts-account": {
"$ref": "file://sub_schemas/single_worker.json"
},
"sliding-sync": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"sso-login": {
"$ref": "file://sub_schemas/single_worker.json"
},
"synchrotron": {
"$ref": "file://sub_schemas/scalable_worker.json"
},
"typing-persister": {
"$ref": "file://sub_schemas/single_worker.json"
},
"user-dir": {
"$ref": "file://sub_schemas/single_worker.json"
}
}
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
"haproxy": {
"type": "object",
"properties": {
"replicas": {
"minimum": 1,
"type": "integer"
},
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
"nodeSelector": {
"$ref": "file://./../../matrix-stack/sub_schemas/nodeSelector.json"
},
"podSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/podSecurityContext.json"
},
"resources": {
"$ref": "file://./../../matrix-stack/sub_schemas/resources.json"
},
"serviceAccount": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceAccount.json"
},
"serviceMonitors": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceMonitors.json"
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
}
}
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
"nodeSelector": {
"$ref": "file://./../../matrix-stack/sub_schemas/nodeSelector.json"
},
"podSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/podSecurityContext.json"
},
"resources": {
"$ref": "file://./../../matrix-stack/sub_schemas/resources.json"
},
"serviceAccount": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceAccount.json"
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
"redis": {
"type": "object",
"properties": {
"image": {
"$ref": "file://./../../matrix-stack/sub_schemas/image.json"
},
"labels": {
"$ref": "file://./../../matrix-stack/sub_schemas/labels.json"
},
"annotations": {
"$ref": "file://./../../matrix-stack/sub_schemas/workloadAnnotations.json"
},
"containersSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/containersSecurityContext.json"
},
"nodeSelector": {
"$ref": "file://./../../matrix-stack/sub_schemas/nodeSelector.json"
},
"podSecurityContext": {
"$ref": "file://./../../matrix-stack/sub_schemas/podSecurityContext.json"
},
"resources": {
"$ref": "file://./../../matrix-stack/sub_schemas/resources.json"
},
"serviceAccount": {
"$ref": "file://./../../matrix-stack/sub_schemas/serviceAccount.json"
},
"tolerations": {
"$ref": "file://./../../matrix-stack/sub_schemas/tolerations.json"
}
}
}
}
}
}
}
}
+100 -98
View File
@@ -6,109 +6,111 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{% import 'sub_schema_values.yaml.j2' as sub_schema_values -%}
{% import 'synapse_sub_schema_values.yaml.j2' as synapse_sub_schema_values -%}
{{ sub_schema_values.generatedFileWarning() }}
{{- sub_schema_values.generatedFileWarning() }}
{{ sub_schema_values.global() }}
{{- sub_schema_values.ess() }}
{{ sub_schema_values.postgresLibPQ() }}
{{- sub_schema_values.postgresLibPQ() }}
## Configures the media store for Synapse
media:
{{ sub_schema_values.persistentVolumeClaim("storage") | indent(2) }}
synapse:
enabled: true
## Configures the media store for Synapse
media:
{{- sub_schema_values.persistentVolumeClaim("storage") | indent(4) }}
{{ sub_schema_values.credential("Key used to sign events and federation requests.\n## This needs to be the full signing key starting `ed25519 ...`", "signingKey") }}
{{ sub_schema_values.credential("Shared Secret to registering users without having any users provisioned", "registrationSharedSecret") }}
{{ sub_schema_values.credential("Secret used to sign Synapse issued tokens", "macaroon") }}
{{- sub_schema_values.credential("Key used to sign events and federation requests.\n## This needs to be the full signing key starting `ed25519 ...`", "signingKey") | indent(2) }}
{{- sub_schema_values.credential("Shared Secret to registering users without having any users provisioned", "registrationSharedSecret") | indent(2) }}
{{- sub_schema_values.credential("Secret used to sign Synapse issued tokens", "macaroon") | indent(2) }}
## Additional configuration to provide to all Synapse processes.
## This can be provided in-line in the Helm Chart and/or via an existing Secret
## e.g.
## additional:
## config: |
## allow_guest_access: true
##
## or
## additional:
## configSecret: custom-synapse-config
## configSecretKey: shared.yaml
additional: {}
## Details of Application Service registration files to give to Synapse
## e.g.
## appservices:
## - registrationFileConfigMap: test-appservice
appservices: []
## Additional Synapse processes managed by this chart
## e.g.
## workers:
## client-reader:
## instances: 2
## event-creator: {}
workers:
{{ synapse_sub_schema_values.single_worker('appservice') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('background') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('client-reader') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('encryption') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('event-creator') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('event-persister') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('federation-reader') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('federation-sender') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('initial-synchrotron') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('media-repository') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('presence-writer') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('pusher') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('receipts-account') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('sliding-sync') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('sso-login') | indent(2) }}
{{ synapse_sub_schema_values.scalable_worker('synchrotron') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('typing-persister') | indent(2) }}
{{ synapse_sub_schema_values.single_worker('user-dir') | indent(2) }}
## Synapse's logging settings
logging:
## The maximum level of Synapse log output before any overrides
rootLevel: INFO
## Override the log level of specific loggers
## Additional configuration to provide to all Synapse processes.
## This can be provided in-line in the Helm Chart and/or via an existing Secret
## e.g.
## levelOverrides:
## synapse.util.caches.lrucache: WARNING
levelOverrides: {}
{{ sub_schema_values.image(registry='docker.io', repository='matrixdotorg/synapse') }}
{{ sub_schema_values.ingress() }}
{{ sub_schema_values.labels() }}
{{ sub_schema_values.workloadAnnotations() }}
{{ sub_schema_values.containersSecurityContext() }}
{{ sub_schema_values.extraEnv() }}
{{ sub_schema_values.hostAliases() }}
{{ sub_schema_values.nodeSelector() }}
{{ sub_schema_values.podSecurityContext(user_id='10091', group_id='10091') }}
{{ sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='4Gi') }}
{{ sub_schema_values.serviceAccount() }}
{{ sub_schema_values.serviceMonitors() }}
{{ sub_schema_values.tolerations() }}
## additional:
## config: |
## allow_guest_access: true
##
## or
## additional:
## configSecret: custom-synapse-config
## configSecretKey: shared.yaml
additional: {}
haproxy:
replicas: 2
{{ sub_schema_values.image(registry='docker.io', repository='library/haproxy', tag='3.0-alpine') | indent(2) }}
{{ sub_schema_values.labels() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
{{ sub_schema_values.containersSecurityContext() | indent(2) }}
{{ sub_schema_values.nodeSelector() | indent(2) }}
{{ sub_schema_values.podSecurityContext(user_id='10001', group_id='10001') | indent(2) }}
{{ sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='200Mi') | indent(2) }}
{{ sub_schema_values.serviceAccount() | indent(2) }}
{{ sub_schema_values.serviceMonitors() | indent(2) }}
{{ sub_schema_values.tolerations() | indent(2) }}
## Details of Application Service registration files to give to Synapse
## e.g.
## appservices:
## - registrationFileConfigMap: test-appservice
appservices: []
redis:
{{- sub_schema_values.image(registry='docker.io', repository='library/redis', tag='7.4-alpine') | indent(2) }}
{{ sub_schema_values.labels() | indent(2) }}
{{ sub_schema_values.workloadAnnotations() | indent(2) }}
{{ sub_schema_values.containersSecurityContext() | indent(2) }}
{{ sub_schema_values.nodeSelector() | indent(2) }}
{{ sub_schema_values.podSecurityContext(user_id='10002', group_id='10002') | indent(2) }}
{{ sub_schema_values.resources(requests_memory='50Mi', requests_cpu='50m', limits_memory='50Mi') | indent(2) }}
{{ sub_schema_values.serviceAccount() | indent(2) }}
{{ sub_schema_values.tolerations() | indent(2) }}
## Additional Synapse processes managed by this chart
## e.g.
## workers:
## client-reader:
## instances: 2
## event-creator: {}
workers:
{{- synapse_sub_schema_values.single_worker('appservice') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('background') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('client-reader') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('encryption') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('event-creator') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('event-persister') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('federation-reader') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('federation-sender') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('initial-synchrotron') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('media-repository') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('presence-writer') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('pusher') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('receipts-account') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('sliding-sync') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('sso-login') | indent(4) }}
{{- synapse_sub_schema_values.scalable_worker('synchrotron') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('typing-persister') | indent(4) }}
{{- synapse_sub_schema_values.single_worker('user-dir') | indent(4) }}
## Synapse's logging settings
logging:
## The maximum level of Synapse log output before any overrides
rootLevel: INFO
## Override the log level of specific loggers
## e.g.
## levelOverrides:
## synapse.util.caches.lrucache: WARNING
levelOverrides: {}
{{- sub_schema_values.image(registry='docker.io', repository='matrixdotorg/synapse') | indent(2) }}
{{- sub_schema_values.ingress() | indent(2) }}
{{- sub_schema_values.labels() | indent(2) }}
{{- sub_schema_values.workloadAnnotations() | indent(2) }}
{{- sub_schema_values.containersSecurityContext() | indent(2) }}
{{- sub_schema_values.extraEnv() | indent(2) }}
{{- sub_schema_values.hostAliases() | indent(2) }}
{{- sub_schema_values.nodeSelector() | indent(2) }}
{{- sub_schema_values.podSecurityContext(user_id='10091', group_id='10091') | indent(2) }}
{{- sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='4Gi') | indent(2) }}
{{- sub_schema_values.serviceAccount() | indent(2) }}
{{- sub_schema_values.serviceMonitors() | indent(2) }}
{{- sub_schema_values.tolerations() | indent(2) }}
haproxy:
replicas: 2
{{- sub_schema_values.image(registry='docker.io', repository='library/haproxy', tag='3.0-alpine') | indent(4) }}
{{- sub_schema_values.labels() | indent(4) }}
{{- sub_schema_values.workloadAnnotations() | indent(4) }}
{{- sub_schema_values.containersSecurityContext() | indent(4) }}
{{- sub_schema_values.nodeSelector() | indent(4) }}
{{- sub_schema_values.podSecurityContext(user_id='10001', group_id='10001') | indent(4) }}
{{- sub_schema_values.resources(requests_memory='100Mi', requests_cpu='100m', limits_memory='200Mi') | indent(4) }}
{{- sub_schema_values.serviceAccount() | indent(4) }}
{{- sub_schema_values.serviceMonitors() | indent(4) }}
{{- sub_schema_values.tolerations() | indent(4) }}
redis:
{{- sub_schema_values.image(registry='docker.io', repository='library/redis', tag='7.4-alpine') | indent(4) }}
{{- sub_schema_values.labels() | indent(4) }}
{{- sub_schema_values.workloadAnnotations() | indent(4) }}
{{- sub_schema_values.containersSecurityContext() | indent(4) }}
{{- sub_schema_values.nodeSelector() | indent(4) }}
{{- sub_schema_values.podSecurityContext(user_id='10002', group_id='10002') | indent(4) }}
{{- sub_schema_values.resources(requests_memory='50Mi', requests_cpu='50m', limits_memory='50Mi') | indent(4) }}
{{- sub_schema_values.serviceAccount() | indent(4) }}
{{- sub_schema_values.tolerations() | indent(4) }}
+53 -24
View File
@@ -1,69 +1,98 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- define "element-io.synapse.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.labels) }}
{{- $global := .global -}}
{{- with required "element-io.synapse.labels missing context" .context -}}
{{ include "element-io.ess-library.labels.common" (list $global .labels) }}
app.kubernetes.io/component: matrix-server
app.kubernetes.io/name: synapse
app.kubernetes.io/instance: {{ .Release.Name }}-synapse
app.kubernetes.io/version: {{ .Values.image.tag | default $.Chart.AppVersion }}
k8s.element.io/synapse-instance: {{ .Release.Name }}-synapse
app.kubernetes.io/instance: {{ $global.Release.Name }}-synapse
app.kubernetes.io/version: {{ .image.tag | default $global.Chart.AppVersion }}
k8s.element.io/synapse-instance: {{ $global.Release.Name }}-synapse
{{- end }}
{{- end }}
{{- define "element-io.synapse.process.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.labels) }}
{{- $global := .global -}}
{{- with required "element-io.synapse.labels missing context" .context -}}
{{ include "element-io.ess-library.labels.common" (list $ .labels) }}
app.kubernetes.io/component: matrix-server
app.kubernetes.io/name: synapse-{{ .ProcessType }}
app.kubernetes.io/instance: {{ .Release.Name }}-synapse-{{ .ProcessType }}
app.kubernetes.io/version: {{ .Values.image.tag | default $.Chart.AppVersion }}
k8s.element.io/synapse-instance: {{ .Release.Name }}-synapse
app.kubernetes.io/instance: {{ $global.Name }}-synapse-{{ .ProcessType }}
app.kubernetes.io/version: {{ .image.tag | default $.Chart.AppVersion }}
k8s.element.io/synapse-instance: {{ $global.Name }}-synapse
{{- end }}
{{- end }}
{{- define "element-io.synapse.redis.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.redis.labels) }}
{{- $global := .global -}}
{{- with required "element-io.redis.labels missing context" .context -}}
{{ include "element-io.ess-library.labels.common" (list $ .redis.labels) }}
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server-pubsub
app.kubernetes.io/name: synapse-redis
app.kubernetes.io/instance: {{ .Release.Name }}-synapse-redis
app.kubernetes.io/version: {{ .Values.redis.image.tag }}
app.kubernetes.io/instance: {{ $global.Name }}-synapse-redis
app.kubernetes.io/version: {{ .redis.image.tag }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.haproxy.labels" -}}
{{ include "element-io.ess-library.labels.common" (list $ .Values.haproxy.labels) }}
{{- $global := .global -}}
{{- with required "element-io.haproxy.labels missing context" .context -}}
{{ include "element-io.ess-library.labels.common" (list $ .haproxy.labels) }}
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server-ingress
app.kubernetes.io/name: synapse-haproxy
app.kubernetes.io/instance: {{ .Release.Name }}-synapse-haproxy
app.kubernetes.io/version: {{ .Values.haproxy.image.tag }}
app.kubernetes.io/instance: {{ $global.Name }}-synapse-haproxy
app.kubernetes.io/version: {{ .haproxy.image.tag }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.serviceAccountName" -}}
{{ default (printf "%s-synapse" .Release.Name ) .Values.serviceAccount.name }}
{{- $global := .global -}}
{{- with required "element-io.synapse.serviceAccountName missing context" .context -}}
{{ default (printf "%s-synapse" $global.Name ) .serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.redis.serviceAccountName" -}}
{{ default (printf "%s-synapse-redis" .Release.Name ) .Values.redis.serviceAccount.name }}
{{- $global := .global -}}
{{- with required "element-io.synapse.redis.serviceAccountName missing context" .context -}}
{{ default (printf "%s-synapse-redis" $global.Name ) .redis.serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.haproxy.serviceAccountName" -}}
{{ default (printf "%s-synapse-haproxy" .Release.Name ) .Values.haproxy.serviceAccount.name }}
{{- $global := .global -}}
{{- with required "element-io.synapse.haproxy.serviceAccountName missing context" .context -}}
{{ default (printf "%s-synapse-haproxy" $global.Name ) .haproxy.serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.enabledWorkers" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.enabledWorkers missing context" .context -}}
{{ $enabledWorkers := dict }}
{{- range $workerType, $workerDetails := .Values.workers }}
{{- range $workerType, $workerDetails := .workers }}
{{- if $workerDetails.enabled }}
{{ $_ := set $enabledWorkers $workerType $workerDetails }}
{{- end }}
{{- end }}
{{ $enabledWorkers | toJson }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.pvcName" -}}
{{- if .Values.media.storage.existingClaim -}}
{{ .Values.media.storage.existingClaim }}
{{- $global := .global -}}
{{- with required "element-io.synapse.pvcName missing context" .context -}}
{{- if .media.storage.existingClaim -}}
{{ .media.storage.existingClaim }}
{{- else -}}
{{ .Release.Name }}-synapse-media
{{ $global.Name }}-synapse-media
{{- end -}}
{{- end }}
{{- end }}
+45 -34
View File
@@ -1,17 +1,24 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- define "element-io.synapse.config.shared-underrides" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.config.shared-underrides missing context" .context -}}
report_stats: false
require_auth_for_profile_requests: true
{{ end }}
{{ end }}
{{- define "element-io.synapse.config.shared-overrides" -}}
public_baseurl: https://{{ .Values.ingress.host }}
server_name: {{ required "Synapse requires global.ess.server_name set" .Values.global.ess.server_name }}
signing_key_path: /secrets/{{ $.Values.signingKey.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ $.Values.signingKey.secretKey | default "SIGNING_KEY" }}
{{- $global := .global -}}
{{- with required "element-io.synapse.config.shared-overrides missing context" .context -}}
public_baseurl: https://{{ .ingress.host }}
server_name: {{ required "Synapse requires global.ess.server_name set" .global.ess.server_name }}
signing_key_path: /secrets/{{ .signingKey.secret | default (printf "%s-synapse" $global.Release.Name) }}/{{ .signingKey.secretKey | default "SIGNING_KEY" }}
enable_metrics: true
log_config: "/conf/log_config.yaml"
macaroon_secret_key: ${SYNAPSE_MACAROON}
@@ -20,14 +27,14 @@ registration_shared_secret: ${SYNAPSE_REGISTRATION_SHARED_SECRET}
database:
name: psycopg2
args:
user: {{ .Values.postgres.user }}
user: {{ .postgres.user }}
password: ${SYNAPSE_POSTGRES_PASSWORD}
database: {{ .Values.postgres.database }}
host: {{ .Values.postgres.host }}
port: {{ .Values.postgres.port }}
database: {{ .postgres.database }}
host: {{ .postgres.host }}
port: {{ .postgres.port }}
application_name: ${APPLICATION_NAME}
sslmode: {{ .Values.postgres.sslMode }}
sslmode: {{ .postgres.sslMode }}
keepalives: 1
keepalives_idle: 10
keepalives_interval: 10
@@ -55,28 +62,28 @@ ip_range_blacklist:
- 'ff00::/8'
- 'fec0::/10'
{{- if dig "appservice" "enabled" false .Values.workers }}
{{- if dig "appservice" "enabled" false .workers }}
notify_appservices_from_worker: appservice-0
{{- end }}
{{- with .Values.appservices }}
{{- with .appservices }}
app_service_config_files:
{{- range $appservice := . }}
- /as/{{ .registrationFileConfigMapName }}/registration.yaml
{{- end }}
{{- end }}
{{- if dig "background" "enabled" false .Values.workers }}
{{- if dig "background" "enabled" false .workers }}
run_background_tasks_on: background-0
{{- end }}
{{- if dig "federation-sender" "enabled" false .Values.workers }}
{{- if dig "federation-sender" "enabled" false .workers }}
send_federation: false
federation_sender_instances:
{{- range $index := untilStep 0 ((index .Values.workers "federation-sender").instances | int) 1 }}
{{- range $index := untilStep 0 ((index .workers "federation-sender").instances | int) 1 }}
- federation-sender-{{ $index }}
{{- end }}
{{- else }}
@@ -86,18 +93,18 @@ send_federation: true
# This is still required despite media_storage_providers as otherwise Synapse attempts to mkdir /media_store
media_store_path: "/media/media_store"
{{- if dig "media-repository" "enabled" false .Values.workers }}
{{- if dig "media-repository" "enabled" false .workers }}
media_instance_running_background_jobs: "media-repository-0"
{{- end }}
presence:
enabled: {{ dig "presence-writer" "enabled" false .Values.workers }}
enabled: {{ dig "presence-writer" "enabled" false .workers }}
{{- if dig "pusher" "enabled" false .Values.workers }}
{{- if dig "pusher" "enabled" false .workers }}
start_pushers: false
pusher_instances:
{{- range $index := untilStep 0 ((index .Values.workers "pusher").instances | int) 1 }}
{{- range $index := untilStep 0 ((index .workers "pusher").instances | int) 1 }}
- pusher-{{ $index }}
{{- end }}
{{- else }}
@@ -105,21 +112,21 @@ pusher_instances:
start_pushers: true
{{- end }}
{{- if dig "user-dir" "enabled" false .Values.workers }}
{{- if dig "user-dir" "enabled" false .workers }}
update_user_directory_from_worker: user-dir-0
{{- end }}
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" $) | fromJson }}
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" (dict "global" $global "context" .)) | fromJson }}
instance_map:
main:
host: {{ $.Release.Name }}-synapse-main.{{ $.Release.Namespace }}.svc.cluster.local.
host: {{ $global.Release.Name }}-synapse-main.{{ $global.Release.Namespace }}.svc.cluster.local.
port: 9093
{{- range $workerType, $workerDetails := $enabledWorkers }}
{{- if include "element-io.synapse.process.hasReplication" $workerType }}
{{- if include "element-io.synapse.process.hasReplication" (dict "global" $global "context" $workerType) }}
{{- range $index := untilStep 0 ($workerDetails.instances | int | default 1) 1 }}
{{ $workerType }}-{{ $index }}:
host: {{ $.Release.Name }}-synapse-{{ $workerType }}-{{ $index }}.{{ $.Release.Name }}-synapse-{{ $workerType }}.{{ $.Release.Namespace }}.svc.cluster.local.
host: {{ $global.Release.Name }}-synapse-{{ $workerType }}-{{ $index }}.{{ $global.Release.Name }}-synapse-{{ $workerType }}.{{ $global.Release.Namespace }}.svc.cluster.local.
port: 9093
{{- end }}
{{- end }}
@@ -129,13 +136,13 @@ instance_map:
redis:
enabled: true
host: "{{ $.Release.Name }}-synapse-redis.{{ $.Release.Namespace }}.svc.cluster.local"
{{- if include "element-io.synapse.streamWriterWorkers" $ | fromJsonArray }}
host: "{{ $global.Release.Name }}-synapse-redis.{{ $global.Release.Namespace }}.svc.cluster.local"
{{- if include "element-io.synapse.streamWriterWorkers" (dict "global" $global "context" .) | fromJsonArray }}
stream_writers:
{{- range $workerType, $workerDetails := $enabledWorkers }}
{{- if include "element-io.synapse.process.streamWriters" $workerType | fromJsonArray }}
{{- range $stream_writer := include "element-io.synapse.process.streamWriters" $workerType | fromJsonArray }}
{{- if include "element-io.synapse.process.streamWriters" (dict "global" $global "context" $workerType) | fromJsonArray }}
{{- range $stream_writer := include "element-io.synapse.process.streamWriters" (dict "global" $global "context" $workerType) | fromJsonArray }}
{{ $stream_writer }}:
{{- range $index := untilStep 0 ($workerDetails.instances | int | default 1) 1 }}
- {{ $workerType }}-{{ $index }}
@@ -145,12 +152,15 @@ stream_writers:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{ end }}
{{- define "element-io.synapse.config.processSpecific" -}}
worker_app: {{ include "element-io.synapse.process.app" .processType }}
{{- $global := .global -}}
{{- with required "element-io.synapse.config.processSpecific missing context" .context -}}
worker_app: {{ include "element-io.synapse.process.app" (dict "global" $global "context" .processType) }}
{{- if eq .processType "main" }}
listeners:
@@ -159,7 +169,7 @@ worker_name: ${APPLICATION_NAME}
worker_listeners:
{{- end }}
{{- if (include "element-io.synapse.process.hasHttp" .processType) }}
{{- if (include "element-io.synapse.process.hasHttp" (dict "global" $global "context" .processType)) }}
- port: 8008
tls: false
bind_addresses: ['0.0.0.0']
@@ -175,7 +185,7 @@ worker_listeners:
{{- end }}
compress: false
{{- end }}
{{- if (include "element-io.synapse.process.hasReplication" .processType) }}
{{- if (include "element-io.synapse.process.hasReplication" (dict "global" $global "context" .processType)) }}
- port: 9093
tls: false
bind_addresses: ['0.0.0.0']
@@ -198,8 +208,8 @@ worker_listeners:
- names: []
compress: false
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" $) | fromJson }}
{{- if (include "element-io.synapse.process.responsibleForMedia" (dict "processType" .processType "enabledWorkerTypes" (keys $enabledWorkers))) }}
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" (dict "global" $global "context" .)) | fromJson }}
{{- if (include "element-io.synapse.process.responsibleForMedia" (dict "global" $global "context" (dict "processType" .processType "enabledWorkerTypes" (keys $enabledWorkers)))) }}
enable_media_repo: true
{{- else }}
# Stub out the media storage provider for processes not responsible for media
@@ -211,4 +221,5 @@ media_storage_providers:
config:
directory: "/media/media_store"
{{- end }}
{{- end }}
{{ end }}
+37 -5
View File
@@ -1,8 +1,12 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- define "element-io.synapse.process.hasHttp" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.hasHttp missing context" .context -}}
{{ $hasHttp := (list "main" "client-reader" "encryption" "event-creator"
"federation-inbound" "federation-reader" "initial-synchrotron"
"media-repository" "presence-writer" "receipts-account"
@@ -11,35 +15,47 @@
{{- if has . $hasHttp -}}
hasHttp
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.hasReplication" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.hasReplication missing context" .context -}}
{{- $hasReplication := (list "main" "encryption" "event-persister"
"presence-writer" "receipts-account"
"typing-persister") }}
{{- if has . $hasReplication -}}
hasReplication
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.isSingle" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.isSingle missing context" .context -}}
{{ $isSingle := (list "main" "appservice" "background" "encryption"
"media-repository" "presence-writer" "receipts-account"
"sso-login" "typing-persister" "user-dir") }}
{{- if has . $isSingle -}}
isSingle
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.workerTypeName" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.workerTypeName missing context" .context -}}
{{- if eq . "initial-synchrotron" -}}
initial-sync
{{- else -}}
{{ . }}
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.app" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.app missing context" .context -}}
{{- if eq . "main" -}}
synapse.app.homeserver
{{- else if eq . "media-repository" -}}
@@ -47,17 +63,23 @@ synapse.app.media_repository
{{- else -}}
synapse.app.generic_worker
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.responsibleForMedia" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.responsibleForMedia missing context" .context -}}
{{- if and (eq .processType "main") (not (has "media-repository" .enabledWorkerTypes)) -}}
responsibleForMedia
{{- else if eq .processType "media-repository" -}}
responsibleForMedia
{{- end -}}
{{- end -}}
{{- end }}
{{- define "element-io.synapse.process.streamWriters" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.process.streamWriters missing context" .context -}}
{{- if eq . "encryption" }}
{{ list "to_device" | toJson }}
{{- else if eq . "event-persister" }}
@@ -72,18 +94,24 @@ responsibleForMedia
{{ list | toJson }}
{{- end }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.streamWriterWorkers" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.streamWriterWorkers missing context" .context -}}
{{ $streamWriterWorkers := list }}
{{- range $workerType := keys ((include "element-io.synapse.enabledWorkers" $) | fromJson) }}
{{- if include "element-io.synapse.process.streamWriters" $workerType | fromJsonArray -}}
{{- range $workerType := keys ((include "element-io.synapse.enabledWorkers" (dict "global" $global "context" .)) | fromJson) }}
{{- if include "element-io.synapse.process.streamWriters" (dict "global" $global "context" $workerType) | fromJsonArray -}}
{{ $streamWriterWorkers = append $streamWriterWorkers $workerType }}
{{- end }}
{{- end }}
{{ $streamWriterWorkers | toJson }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.configSecrets" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.configSecrets missing context" .context -}}
{{ $configSecrets := list (printf "%s-synapse" $.Release.Name) }}
{{- with .Values.macaroon.secret -}}
{{ $configSecrets = append $configSecrets . }}
@@ -99,8 +127,11 @@ responsibleForMedia
{{- end -}}
{{ $configSecrets | uniq | toJson }}
{{- end }}
{{- end }}
{{- define "element-io.synapse.process.workerPaths" -}}
{{- $global := .global -}}
{{- with required "element-io.synapse.workerPaths missing context" .context -}}
{{ $workerPaths := list }}
{{- if eq .workerType "client-reader" }}
@@ -298,3 +329,4 @@ responsibleForMedia
{{- end }}
{{ $workerPaths | toJson }}
{{- end }}
{{- end }}
@@ -1,14 +1,18 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse-haproxy
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-haproxy
namespace: {{ $.Release.Namespace }}
data:
haproxy.cfg: |
{{- tpl ($.Files.Get "configs/haproxy/haproxy.cfg.tpl") . | nindent 4 }}
@@ -16,9 +20,9 @@ data:
# A map file that is used in haproxy config to map from matrix paths to the
# named backend. The format is: path_regexp backend_name
{{ $enabledWorkerTypes := keys ((include "element-io.synapse.enabledWorkers" $) | fromJson) }}
{{ $enabledWorkerTypes := keys ((include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson) }}
{{- range $workerType := $enabledWorkerTypes | sortAlpha }}
{{- $workersPaths := (include "element-io.synapse.process.workerPaths" (dict "workerType" $workerType "enabledWorkerTypes" $enabledWorkerTypes)) | fromJsonArray }}
{{- $workersPaths := (include "element-io.synapse.process.workerPaths" (dict "global" $ "context" (dict "workerType" $workerType "enabledWorkerTypes" $enabledWorkerTypes))) | fromJsonArray }}
{{- if len $workersPaths }}
# {{ $workerType }}
{{- range $path := $workersPaths }}
@@ -29,7 +33,7 @@ data:
path_map_file_get: |
# A map file that is used in haproxy config to map from matrix paths to the
# named backend. The format is: path_regexp backend_name
{{ if dig "client-reader" "enabled" false .Values.workers }}
{{ if dig "client-reader" "enabled" false .workers }}
^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ client-reader
{{- end }}
429.http: |
@@ -44,3 +48,5 @@ data:
<html><body><h1>429 Too Many Requests</h1>
No server is available to handle this request.
</body></html>
{{- end -}}
{{- end -}}
@@ -1,8 +1,12 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- with .Values.haproxy }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- with .haproxy }}
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -11,7 +15,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 4 }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/haproxy_configmap.yaml") $ | sha1sum }}"
name: {{ $.Release.Name }}-synapse-haproxy
namespace: {{ $.Release.Namespace }}
@@ -28,7 +32,7 @@ spec:
template:
metadata:
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 8 }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 8 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/haproxy_configmap.yaml") $ | sha1sum }}"
{{- with .annotations }}
annotations:
@@ -50,7 +54,7 @@ spec:
topologyKey: kubernetes.io/hostname
{{- end }}
automountServiceAccountToken: false
serviceAccountName: {{ include "element-io.synapse.haproxy.serviceAccountName" $ }}
serviceAccountName: {{ include "element-io.synapse.haproxy.serviceAccountName" (dict "global" $ "context" .) }}
{{- include "element-io.ess-library.pods.pullSecrets" (list $ .image) | nindent 6 }}
{{- with .podSecurityContext }}
securityContext:
@@ -115,3 +119,5 @@ spec:
defaultMode: 420
name: haproxy-config
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,16 +1,20 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor" }}
{{- if .Values.haproxy.serviceMonitors.enabled }}
{{- if .haproxy.serviceMonitors.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse-haproxy
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-haproxy
namespace: {{ $.Release.Namespace }}
spec:
endpoints:
- interval: 30s
@@ -19,6 +23,9 @@ spec:
matchLabels:
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server-ingress
app.kubernetes.io/instance: {{ .Release.Name }}-synapse-haproxy
app.kubernetes.io/instance: {{ $.Release.Name }}-synapse-haproxy
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,18 +1,25 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if .Values.haproxy.serviceAccount.create }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if .haproxy.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- with .Values.haproxy.serviceAccount.annotations }}
{{- with .haproxy.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.haproxy.labels" . | nindent 4 }}
name: {{ include "element-io.synapse.haproxy.serviceAccountName" . }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ include "element-io.synapse.haproxy.serviceAccountName" (dict "global" $ "context" .) }}
namespace: {{ .Release.Namespace }}
automountServiceAccountToken: false
{{- end }}
{{- end -}}
{{- end -}}
+11 -5
View File
@@ -1,13 +1,17 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if (include "element-io.synapse.enabledWorkers" $) | fromJson }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
{{- include "element-io.synapse.redis.labels" $ | nindent 4 }}
{{- include "element-io.synapse.redis.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-redis
namespace: {{ $.Release.Namespace }}
data:
@@ -100,3 +104,5 @@ data:
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
{{- end }}
{{- end -}}
{{- end -}}
+14 -8
View File
@@ -1,9 +1,13 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if (include "element-io.synapse.enabledWorkers" $) | fromJson }}
{{- with .Values.redis }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
{{- with .redis }}
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -12,7 +16,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.redis.labels" $ | nindent 4 }}
{{- include "element-io.synapse.redis.labels" (dict "global" $ "context" .) | nindent 4 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/redis_configmap.yaml") $ | sha1sum }}"
name: {{ $.Release.Name }}-synapse-redis
namespace: {{ $.Release.Namespace }}
@@ -29,7 +33,7 @@ spec:
template:
metadata:
labels:
{{- include "element-io.synapse.redis.labels" $ | nindent 8 }}
{{- include "element-io.synapse.redis.labels" (dict "global" $ "context" .) | nindent 8 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/redis_configmap.yaml") $ | sha1sum }}"
{{- with .annotations }}
annotations:
@@ -37,7 +41,7 @@ spec:
{{- end }}
spec:
automountServiceAccountToken: false
serviceAccountName: {{ include "element-io.synapse.redis.serviceAccountName" $ }}
serviceAccountName: {{ include "element-io.synapse.redis.serviceAccountName" (dict "global" $ "context" .) }}
{{- include "element-io.ess-library.pods.pullSecrets" (list $ .image) | nindent 6 }}
{{- with .podSecurityContext }}
securityContext:
@@ -105,3 +109,5 @@ spec:
name: data
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
+14 -8
View File
@@ -1,19 +1,25 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if (include "element-io.synapse.enabledWorkers" $) | fromJson }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "element-io.synapse.redis.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse-redis
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.redis.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-redis
namespace: {{ $.Release.Namespace }}
spec:
ports:
- port: 6379
targetPort: redis
selector:
app.kubernetes.io/instance: "{{ .Release.Name }}-synapse-redis"
app.kubernetes.io/instance: "{{ $.Release.Name }}-synapse-redis"
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,20 +1,27 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if (include "element-io.synapse.enabledWorkers" $) | fromJson }}
{{- if .Values.redis.serviceAccount.create }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
{{- if .redis.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- with .Values.redis.serviceAccount.annotations }}
{{- with .redis.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.redis.labels" . | nindent 4 }}
name: {{ include "element-io.synapse.redis.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.redis.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ include "element-io.synapse.redis.serviceAccountName" (dict "global" $ "context" .) }}
namespace: {{ $.Release.Namespace }}
automountServiceAccountToken: false
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
+19 -13
View File
@@ -1,26 +1,30 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
{{- include "element-io.synapse.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse
namespace: {{ $.Release.Namespace }}
data:
01-homeserver-underrides.yaml: |
{{- include "element-io.synapse.config.shared-underrides" . | nindent 4 }}
{{- include "element-io.synapse.config.shared-underrides" (dict "global" $ "context" .) | nindent 4 }}
{{- /*02 files are user provided in Helm values and end up in the Secret*/}}
{{- /*03 files are user provided as secrets rather than directly in Helm*/}}
04-homeserver-overrides.yaml: |
{{- include "element-io.synapse.config.shared-overrides" . | nindent 4 }}
{{- include "element-io.synapse.config.shared-overrides" (dict "global" $ "context" .) | nindent 4 }}
05-main.yaml: |
{{- include "element-io.synapse.config.processSpecific" (dict "processType" "main" "Values" .Values) | nindent 4 }}
{{- range $workerType, $workerDetails := (include "element-io.synapse.enabledWorkers" $) | fromJson }}
{{- include "element-io.synapse.config.processSpecific" (dict "global" $ "context" (dict "processType" "main" "Values" .)) | nindent 4 }}
{{- range $workerType, $workerDetails := (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
05-{{ $workerType }}.yaml: |
{{- include "element-io.synapse.config.processSpecific" (dict "processType" $workerType "Values" $.Values) | nindent 4 }}
{{- include "element-io.synapse.config.processSpecific" (dict "global" $ "context" (dict "processType" $workerType "Values" $.synapse.Values)) | nindent 4 }}
{{- end }}
log_config.yaml: |
# Copyright 2024 New Vector Ltd
@@ -43,16 +47,18 @@ data:
nuked if an override is set and then if the root level is increased to debug, the access tokens will be logged.
Putting here means it is an explicit customer choice to override it.
*/}}
{{- range $logger, $level := merge dict .Values.logging.levelOverrides (dict "synapse.storage.SQL" "INFO") }}
{{- range $logger, $level := merge dict .logging.levelOverrides (dict "synapse.storage.SQL" "INFO") }}
{{ $logger }}:
level: "{{ $level }}"
{{- end }}
root:
level: "{{ .Values.logging.rootLevel }}"
level: "{{ .logging.rootLevel }}"
handlers:
- console
disable_existing_loggers: false
render_config_with_secrets.py: |
{{- ($.Files.Get "configs/synapse/render_config_with_secrets.py") | nindent 4 }}
{{- end -}}
{{- end -}}
@@ -1,16 +1,20 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse-haproxy
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-haproxy
namespace: {{ $.Release.Namespace }}
spec:
type: {{ .Values.ingress.service.type }}
type: {{ .ingress.service.type }}
ports:
- name: haproxy-http
port: 8008
@@ -22,4 +26,6 @@ spec:
port: 8405
targetPort: haproxy-metrics
selector:
app.kubernetes.io/instance: "{{ .Release.Name }}-synapse-haproxy"
app.kubernetes.io/instance: "{{ $.Release.Name }}-synapse-haproxy"
{{- end -}}
{{- end -}}
+21 -14
View File
@@ -1,33 +1,37 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- with .Values.ingress.annotations }}
{{- with .ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.haproxy.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.haproxy.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse
namespace: {{ $.Release.Namespace }}
spec:
{{- if .Values.ingress.tlsSecret }}
{{- if .ingress.tlsSecret }}
tls:
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: {{ .Values.ingress.tlsSecret | quote }}
- {{ .ingress.host | quote }}
secretName: {{ .ingress.tlsSecret | quote }}
{{- end }}
{{- with .Values.ingress.className }}
{{- with .ingress.className }}
ingressClassName: {{ . | quote }}
{{- end }}
rules:
- host: {{ .Values.ingress.host | quote }}
- host: {{ .ingress.host | quote }}
http:
paths:
{{- range .Values.ingress.additionalPaths -}}
{{- range .ingress.additionalPaths -}}
{{- if eq .availability "only_externally" }}
- path: {{ .path }}
pathType: Prefix
@@ -51,7 +55,7 @@ spec:
defined additional paths. If so, let the other service handle it and don't
add it here. */}}
{{- $_pathAlreadyDefined := false }}
{{- range $.Values.ingress.additionalPaths -}}
{{- range $.ingress.additionalPaths -}}
{{- if has .availability (list "only_externally" "blocked") }}
{{- if hasPrefix .path $synapsePath }}
{{- $_pathAlreadyDefined = true }}
@@ -70,3 +74,6 @@ spec:
name: haproxy-http
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,22 +1,28 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if not .Values.media.storage.existingClaim }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if not .media.storage.existingClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
{{- include "element-io.synapse.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse-media
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-media
namespace: {{ $.Release.Namespace }}
spec:
{{- with .Values.media.storage.storageClassName }}
{{- with .media.storage.storageClassName }}
storageClassName: {{ . }}
{{- end }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.media.storage.size }}
storage: {{ .media.storage.size }}
{{- end }}
{{- end -}}
{{- end -}}
+17 -11
View File
@@ -1,27 +1,33 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "element-io.synapse.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse
namespace: {{ $.Release.Namespace }}
data:
{{- with .Values.additional.config }}
{{- with .additional.config }}
02-homeserver-helm-user-provided.yaml: {{ . | b64enc }}
{{- end }}
{{- with .Values.macaroon.value }}
{{- with .macaroon.value }}
MACAROON: {{ . | b64enc }}
{{- end }}
{{- with .Values.postgres.password.value }}
{{- with .postgres.password.value }}
POSTGRES: {{ . | b64enc }}
{{- end }}
{{- with .Values.registrationSharedSecret.value }}
{{- with .registrationSharedSecret.value }}
REGISTRATION_SHARED_SECRET: {{ . | b64enc }}
{{- end }}
{{- with .Values.signingKey.value }}
{{- with .signingKey.value }}
SIGNING_KEY: {{ .| b64enc }}
{{- end }}
{{- end -}}
{{- end -}}
+13 -7
View File
@@ -1,25 +1,29 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- range $processType := prepend (keys ((include "element-io.synapse.enabledWorkers" $) | fromJson)) "main" }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- range $processType := prepend (keys ((include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson)) "main" }}
{{- $perProcessRoot := merge (dict "ProcessType" $processType) $ }}
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "element-io.synapse.process.labels" $perProcessRoot | nindent 4 }}
{{- include "element-io.synapse.process.labels" (dict "global" $ "context" $perProcessRoot) | nindent 4 }}
name: {{ $.Release.Name }}-synapse-{{ $processType }}
namespace: {{ $.Release.Namespace }}
spec:
clusterIP: None
ports:
{{- if (include "element-io.synapse.process.hasHttp" .) }}
{{- if (include "element-io.synapse.process.hasHttp" (dict "global" $ "context" .)) }}
- name: synapse-http
port: 8008
targetPort: synapse-http
{{- end }}
{{- if (include "element-io.synapse.process.hasReplication" .) }}
{{- if (include "element-io.synapse.process.hasReplication" (dict "global" $ "context" .)) }}
- name: synapse-repl
port: 9093
targetPort: synapse-repl
@@ -34,3 +38,5 @@ spec:
app.kubernetes.io/instance: {{ $.Release.Name }}-synapse-{{ $processType }}
---
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,16 +1,20 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor" }}
{{- if .Values.serviceMonitors.enabled }}
{{- if .serviceMonitors.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
{{- include "element-io.synapse.labels" $ | nindent 4 }}
name: {{ .Release.Name }}-synapse
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-synapse
namespace: {{ $.Release.Namespace }}
spec:
endpoints:
- interval: 30s
@@ -18,11 +22,13 @@ spec:
relabelings:
- targetLabel: instance
action: replace
replacement: {{ .Values.ingress.host }}
replacement: {{ .ingress.host }}
selector:
matchLabels:
app.kubernetes.io/part-of: matrix-stack
app.kubernetes.io/component: matrix-server
k8s.element.io/synapse-instance: {{ .Release.Name }}-synapse
k8s.element.io/synapse-instance: {{ $.Release.Name }}-synapse
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,18 +1,25 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- if .Values.serviceAccount.create }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- if .serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- with .Values.serviceAccount.annotations }}
{{- with .serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.labels" . | nindent 4 }}
name: {{ include "element-io.synapse.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- include "element-io.synapse.labels" (dict "global" $ "context" .) | nindent 4 }}
name: {{ include "element-io.synapse.serviceAccountName" (dict "global" $ "context" .) }}
namespace: {{ $.Release.Namespace }}
automountServiceAccountToken: false
{{- end }}
{{- end -}}
{{- end -}}
@@ -1,30 +1,34 @@
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
{{- /*
Copyright 2024 New Vector Ltd
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" $) | fromJson }}
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
*/ -}}
{{- with .Values.synapse -}}
{{- if .enabled -}}
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" (dict "global" $ "context" .)) | fromJson }}
{{- range $processType, $unmergedProcessDetails := merge $enabledWorkers (dict "main" dict) }}
{{- $perProcessRoot := merge (dict "ProcessType" $processType) $ }}
{{- with dict "Values" (merge dict ($unmergedProcessDetails | deepCopy) ($.Values | deepCopy)) }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
{{- with .Values.annotations }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "element-io.synapse.process.labels" $perProcessRoot | nindent 4 }}
{{- include "element-io.synapse.process.labels" (dict "global" $ "context" $perProcessRoot) | nindent 4 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/synapse_secret.yaml") $ | sha1sum }}"
k8s.element.io/logconfighash: "{{ include (print $.Template.BasePath "/synapse_configmap.yaml") $ | sha1sum }}"
{{- range $index, $appservice := .Values.appservices }}
{{- range $index, $appservice := .appservices }}
k8s.element.io/as-registration-{{ $index }}-hash: "{{ (lookup "v1" "ConfigMap" $.Release.Namespace $appservice.registrationFileConfigMap) | toJson | sha1sum }}"
{{- end }}
name: {{ $.Release.Name }}-synapse-{{ $processType }}
namespace: {{ $.Release.Namespace }}
spec:
serviceName: {{ $.Release.Name }}-synapse-{{ $processType }}
replicas: {{ .Values.instances | default 1 }}
replicas: {{ .instances | default 1 }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ $.Release.Name }}-synapse-{{ $processType }}
@@ -35,34 +39,34 @@ spec:
template:
metadata:
labels:
{{- include "element-io.synapse.process.labels" $perProcessRoot | nindent 8 }}
{{- include "element-io.synapse.process.labels" (dict "global" $ "context" $perProcessRoot) | nindent 8 }}
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/synapse_secret.yaml") $ | sha1sum }}"
k8s.element.io/logconfighash: "{{ include (print $.Template.BasePath "/synapse_configmap.yaml") $ | sha1sum }}"
{{- range $index, $appservice := .Values.appservices }}
{{- range $index, $appservice := .appservices }}
k8s.element.io/as-registration-{{ $index }}-hash: "{{ (lookup "v1" "ConfigMap" $.Release.Namespace $appservice.registrationFileConfigMap) | toJson | sha1sum }}"
{{- end }}
{{- with .Values.annotations }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: false
serviceAccountName: {{ include "element-io.synapse.serviceAccountName" $ }}
{{- include "element-io.ess-library.pods.pullSecrets" (list $ .Values.image) | nindent 6 }}
{{- with .Values.podSecurityContext }}
serviceAccountName: {{ include "element-io.synapse.serviceAccountName" (dict "global" $ "context" .) }}
{{- include "element-io.ess-library.pods.pullSecrets" (list $ .image) | nindent 6 }}
{{- with .podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostAliases }}
{{- with .hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -75,7 +79,7 @@ We have an init container to render & merge the config for several reasons:
*/}}
initContainers:
- name: render-config
{{- with .Values.image -}}
{{- with .image -}}
{{- if .digest }}
image: "{{ .registry }}/{{ .repository }}@{{ .digest }}"
imagePullPolicy: {{ .pullPolicy | default "IfNotPresent" }}
@@ -84,7 +88,7 @@ We have an init container to render & merge the config for several reasons:
imagePullPolicy: {{ .pullPolicy | default "Always" }}
{{- end }}
{{- end }}
{{- with .Values.containersSecurityContext }}
{{- with .containersSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
@@ -99,9 +103,9 @@ We have an init container to render & merge the config for several reasons:
These could be done as env vars with valueFrom.secretKeyRef, but that triggers CKV_K8S_35.
If we wanted to allow for replacement of values in the user-provided config with external Secrets we could extend this init-container
to allow extraEnv with valueFrom.secretKeyRef. */}}
export SYNAPSE_MACAROON=$(cat /secrets/{{ .Values.macaroon.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .Values.macaroon.secretKey | default "MACAROON" }});
export SYNAPSE_POSTGRES_PASSWORD=$(cat /secrets/{{ .Values.postgres.password.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .Values.postgres.password.secretKey | default "POSTGRES_PASSWORD" }});
export SYNAPSE_REGISTRATION_SHARED_SECRET=$(cat /secrets/{{ .Values.registrationSharedSecret.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .Values.registrationSharedSecret.secretKey | default "REGISTRATION_SHARED_SECRET" }});
export SYNAPSE_MACAROON=$(cat /secrets/{{ .macaroon.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .macaroon.secretKey | default "MACAROON" }});
export SYNAPSE_POSTGRES_PASSWORD=$(cat /secrets/{{ .postgres.password.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .postgres.password.secretKey | default "POSTGRES_PASSWORD" }});
export SYNAPSE_REGISTRATION_SHARED_SECRET=$(cat /secrets/{{ .registrationSharedSecret.secret | default (printf "%s-synapse" $.Release.Name) }}/{{ .registrationSharedSecret.secretKey | default "REGISTRATION_SHARED_SECRET" }});
set -x;
export APPLICATION_NAME=$(hostname -s | sed 's/.*-synapse-//g');
@@ -109,16 +113,16 @@ We have an init container to render & merge the config for several reasons:
python3 /config-templates/render_config_with_secrets.py \
/config-templates/01-homeserver-underrides.yaml \
{{- if .Values.additional.config }}
{{- if .additional.config }}
/secrets/{{ $.Release.Name }}-synapse/02-homeserver-helm-user-provided.yaml \
{{- end }}
{{- if .Values.additional.configSecret }}
/secrets/{{ .Values.additional.configSecret }}/{{ .Values.additional.configSecretKey }} \
{{- if .additional.configSecret }}
/secrets/{{ .additional.configSecret }}/{{ .additional.configSecretKey }} \
{{- end }}
/config-templates/04-homeserver-overrides.yaml \
/config-templates/05-{{ $processType }}.yaml \
> /conf/homeserver.yaml;
{{- with .Values.resources }}
{{- with .resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
@@ -126,7 +130,7 @@ We have an init container to render & merge the config for several reasons:
- mountPath: /config-templates
name: plain-config
readOnly: true
{{- range $secret := include "element-io.synapse.configSecrets" $ | fromJsonArray }}
{{- range $secret := include "element-io.synapse.configSecrets" (dict "global" $ "context" .) | fromJsonArray }}
- mountPath: /secrets/{{ $secret }}
name: "secret-{{ $secret }}"
readOnly: true
@@ -136,7 +140,7 @@ We have an init container to render & merge the config for several reasons:
readOnly: false
containers:
- name: synapse
{{- with .Values.image -}}
{{- with .image -}}
{{- if .digest }}
image: "{{ .registry }}/{{ .repository }}@{{ .digest }}"
imagePullPolicy: {{ .pullPolicy | default "IfNotPresent" }}
@@ -145,7 +149,7 @@ We have an init container to render & merge the config for several reasons:
imagePullPolicy: {{ .pullPolicy | default "Always" }}
{{- end }}
{{- end }}
{{- with .Values.containersSecurityContext }}
{{- with .containersSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
@@ -155,18 +159,18 @@ We have an init container to render & merge the config for several reasons:
- >
ls -lR /secrets;
[ -e "/usr/lib/`uname -m`-linux-gnu/libjemalloc.so.2" ] && export LD_PRELOAD="/usr/lib/`uname -m`-linux-gnu/libjemalloc.so.2";
python3 -m {{ include "element-io.synapse.process.app" $processType }} -c /conf/homeserver.yaml
{{- with .Values.extraEnv }}
python3 -m {{ include "element-io.synapse.process.app" (dict "global" $ "context" $processType) }} -c /conf/homeserver.yaml
{{- with .extraEnv }}
env:
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
{{- if (include "element-io.synapse.process.hasHttp" $processType) }}
{{- if (include "element-io.synapse.process.hasHttp" (dict "global" $ "context" $processType)) }}
- containerPort: 8008
name: synapse-http
protocol: TCP
{{- end }}
{{- if (include "element-io.synapse.process.hasReplication" $processType) }}
{{- if (include "element-io.synapse.process.hasReplication" (dict "global" $ "context" $processType)) }}
- containerPort: 9093
name: synapse-repl
protocol: TCP
@@ -191,7 +195,7 @@ We have an init container to render & merge the config for several reasons:
timeoutSeconds: 2
{{- /* For Synapse processes where there can only be 1 instance we're more generous with the threshold.
This is because people can't scale the process up and so the impact of a restart is greater. */}}
failureThreshold: {{ ternary 8 3 (eq "isSingle" (include "element-io.synapse.process.isSingle" $processType)) }}
failureThreshold: {{ ternary 8 3 (eq "isSingle" (include "element-io.synapse.process.isSingle" (dict "global" $ "context" $processType))) }}
readinessProbe:
httpGet:
path: /health
@@ -199,18 +203,18 @@ We have an init container to render & merge the config for several reasons:
periodSeconds: 2
timeoutSeconds: 2
successThreshold: 2
failureThreshold: {{ ternary 8 3 (eq "isSingle" (include "element-io.synapse.process.isSingle" $processType)) }}
{{- with .Values.resources }}
failureThreshold: {{ ternary 8 3 (eq "isSingle" (include "element-io.synapse.process.isSingle" (dict "global" $ "context" $processType))) }}
{{- with .resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
volumeMounts:
{{- range $secret := include "element-io.synapse.configSecrets" $ | fromJsonArray }}
{{- range $secret := include "element-io.synapse.configSecrets" (dict "global" $ "context" .) | fromJsonArray }}
- mountPath: /secrets/{{ $secret }}
name: "secret-{{ $secret }}"
readOnly: true
{{- end }}
{{- range $appservice := .Values.appservices }}
{{- range $appservice := .appservices }}
- name: {{ $appservice.registrationFileConfigMap }}
mountPath: /as/{{ $appservice.registrationFileConfigMap }}/registration.yaml
readOnly: true
@@ -230,7 +234,7 @@ We have an init container to render & merge the config for several reasons:
defaultMode: 420
name: "{{ $.Release.Name }}-synapse"
name: plain-config
{{- range $secret := include "element-io.synapse.configSecrets" $ | fromJsonArray }}
{{- range $secret := include "element-io.synapse.configSecrets" (dict "global" $ "context" .) | fromJsonArray }}
- secret:
secretName: {{ $secret }}
name: secret-{{ $secret }}
@@ -238,7 +242,7 @@ We have an init container to render & merge the config for several reasons:
- emptyDir:
medium: Memory
name: "rendered-config"
{{- range $appservice := .Values.appservices }}
{{- range $appservice := .appservices }}
- configMap:
defaultMode: 420
name: "{{ $appservice.registrationFileConfigMap }}"
@@ -246,7 +250,7 @@ We have an init container to render & merge the config for several reasons:
{{- end }}
{{- if (include "element-io.synapse.process.responsibleForMedia" (dict "processType" $processType "enabledWorkerTypes" (keys $enabledWorkers))) }}
- persistentVolumeClaim:
claimName: {{ include "element-io.synapse.pvcName" $ }}
claimName: {{ include "element-io.synapse.pvcName" (dict "global" $ "context" $processType) }}
name: "media"
{{- else }}
- emptyDir:
@@ -259,3 +263,6 @@ We have an init container to render & merge the config for several reasons:
---
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
File diff suppressed because it is too large. Load diff
+562 -621
View File
File diff suppressed because it is too large. Load diff