fix(matrix-synapse): add hostPath support

This commit is contained in:
WrenIX 2024-02-14 01:01:15 +01:00
parent f1b62fb5ad
commit 4a4d7f86b4
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
6 changed files with 85 additions and 33 deletions

View file

@ -4,7 +4,7 @@ name: matrix-synapse
description: Matrix reference homeserver
icon: https://matrix.org/images/matrix-logo.svg
type: application
version: 0.0.2
version: 0.0.3
# renovate: image=ghcr.io/element-hq/synapse
appVersion: 1.101.0
maintainers:

View file

@ -2,7 +2,7 @@
= matrix-synapse
image::https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square[Version: 0.0.2]
image::https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square[Version: 0.0.3]
image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application]
image::https://img.shields.io/badge/AppVersion-1.101.0-informational?style=flat-square[AppVersion: 1.101.0]
== Maintainers
@ -237,16 +237,36 @@ helm uninstall matrix-synapse-release
| `"ReadWriteOnce"`
|
| persistence.annotations
| object
| `{}`
|
| persistence.enabled
| bool
| `true`
|
| persistence.existingClaim
| string
| `nil`
| A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound
| persistence.hostPath
| string
| `nil`
| Do not create an PVC, direct use hostPath in Pod
| persistence.size
| string
| `"10Gi"`
|
| persistence.storageClass
| string
| `nil`
| Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack)
| postgresql.auth.database
| string
| `"synapse"`

View file

@ -152,9 +152,9 @@ spec:
mountPath: /synapse/data
- name: tmpdir
mountPath: /tmp
{{- with .Values.synapse.extraVolumeMounts }}
{{- with .Values.synapse.extraVolumeMounts }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.synapse.resources | nindent 12 }}
volumes:
@ -175,30 +175,38 @@ spec:
- name: tmpdir
emptyDir: {}
- name: media
{{- $mediaworker := false }}
{{- range $worker, $config := .Values.workers }}
{{- $mediaworker := false }}
{{- range $worker, $config := .Values.workers }}
{{- if eq $worker "media_repository" }}
{{- $mediaworker = ($config.enabled | default false) }}
{{- $mediaworker = ($config.enabled | default false) }}
{{- end }}
{{- end }}
{{- if and .Values.persistence.enabled (not $mediaworker) }}
{{- end }}
{{- if $mediaworker }}
emptyDir: {}
{{- else }}
{{- if .Values.persistence.hostPath }}
hostPath:
type: Directory
path: {{ .Values.persistence.hostPath | quote }}
{{- else if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "matrix-synapse.fullname" .) }}
{{- else }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}{{/* end-if hostPath+persistent*/}}
{{- end }}{{/* end-if not $mediaworker */}}
{{- with .Values.synapse.extraVolumes }}
{{- . | toYaml | nindent 8 }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.synapse.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.synapse.affinity }}
{{- with .Values.synapse.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.synapse.tolerations }}
{{- end }}
{{- with .Values.synapse.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View file

@ -1,22 +1,29 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
{{- if and
.Values.persistence.enabled
(not .Values.persistence.existingClaim)
(not .Values.persistence.hostPath)
-}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "matrix-synapse.fullname" . }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
{{- with .Values.persistence.storageClass }}
{{- if (eq "-" .) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- else }}
storageClassName: {{ . | quote }}
{{- end }}
{{- end }}
{{- end -}}

View file

@ -201,17 +201,21 @@ spec:
path: signing.key
- name: tmpconf
emptyDir: {}
{{- if eq $name "media-repository" }}
{{- if eq $name "media-repository" }}
- name: media
{{- if $.Values.persistence.enabled }}
{{- if $.Values.persistence.hostPath }}
hostPath:
type: Directory
path: {{ .Values.persistence.hostPath | quote }}
{{- else if $.Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ $.Values.persistence.existingClaim | default (include "matrix-synapse.fullname" $) }}
{{- else }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}{{/* end-if media-repository */}}
{{- with $config.volumes | default $default.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with $config.volumes | default $default.volumes }}
{{ . | toYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -760,9 +760,22 @@ externalRedis:
##
persistence:
enabled: true
# existingClaim: synapse-data
annotations: {}
# -- Persistent Volume Storage Class
# If defined, storageClassName: <storageClass>
# If set to "-", storageClassName: "", which disables dynamic provisioning
# If undefined (the default) or set to null, no storageClassName spec is
# set, choosing the default provisioner. (gp2 on AWS, standard on
# GKE, AWS & OpenStack)
storageClass:
# storageClass: "-"
# -- A manually managed Persistent Volume and Claim
# Requires persistence.enabled: true
# If defined, PVC must be created manually before volume will be bound
existingClaim:
# -- Do not create an PVC, direct use hostPath in Pod
hostPath:
accessMode: ReadWriteOnce
size: 10Gi