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 description: Matrix reference homeserver
icon: https://matrix.org/images/matrix-logo.svg icon: https://matrix.org/images/matrix-logo.svg
type: application type: application
version: 0.0.2 version: 0.0.3
# renovate: image=ghcr.io/element-hq/synapse # renovate: image=ghcr.io/element-hq/synapse
appVersion: 1.101.0 appVersion: 1.101.0
maintainers: maintainers:

View file

@ -2,7 +2,7 @@
= matrix-synapse = 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/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] image::https://img.shields.io/badge/AppVersion-1.101.0-informational?style=flat-square[AppVersion: 1.101.0]
== Maintainers == Maintainers
@ -237,16 +237,36 @@ helm uninstall matrix-synapse-release
| `"ReadWriteOnce"` | `"ReadWriteOnce"`
| |
| persistence.annotations
| object
| `{}`
|
| persistence.enabled | persistence.enabled
| bool | bool
| `true` | `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 | persistence.size
| string | string
| `"10Gi"` | `"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 | postgresql.auth.database
| string | string
| `"synapse"` | `"synapse"`

View file

@ -152,9 +152,9 @@ spec:
mountPath: /synapse/data mountPath: /synapse/data
- name: tmpdir - name: tmpdir
mountPath: /tmp mountPath: /tmp
{{- with .Values.synapse.extraVolumeMounts }} {{- with .Values.synapse.extraVolumeMounts }}
{{- . | toYaml | nindent 12 }} {{- . | toYaml | nindent 12 }}
{{- end }} {{- end }}
resources: resources:
{{- toYaml .Values.synapse.resources | nindent 12 }} {{- toYaml .Values.synapse.resources | nindent 12 }}
volumes: volumes:
@ -175,30 +175,38 @@ spec:
- name: tmpdir - name: tmpdir
emptyDir: {} emptyDir: {}
- name: media - name: media
{{- $mediaworker := false }} {{- $mediaworker := false }}
{{- range $worker, $config := .Values.workers }} {{- range $worker, $config := .Values.workers }}
{{- if eq $worker "media_repository" }} {{- if eq $worker "media_repository" }}
{{- $mediaworker = ($config.enabled | default false) }} {{- $mediaworker = ($config.enabled | default false) }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and .Values.persistence.enabled (not $mediaworker) }} {{- if $mediaworker }}
emptyDir: {}
{{- else }}
{{- if .Values.persistence.hostPath }}
hostPath:
type: Directory
path: {{ .Values.persistence.hostPath | quote }}
{{- else if .Values.persistence.enabled }}
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "matrix-synapse.fullname" .) }} claimName: {{ .Values.persistence.existingClaim | default (include "matrix-synapse.fullname" .) }}
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}{{/* end-if hostPath+persistent*/}}
{{- end }}{{/* end-if not $mediaworker */}}
{{- with .Values.synapse.extraVolumes }} {{- with .Values.synapse.extraVolumes }}
{{- . | toYaml | nindent 8 }} {{- . | toYaml | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.synapse.nodeSelector }} {{- with .Values.synapse.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.synapse.affinity }} {{- with .Values.synapse.affinity }}
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.synapse.tolerations }} {{- with .Values.synapse.tolerations }}
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- 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 kind: PersistentVolumeClaim
apiVersion: v1 apiVersion: v1
metadata: metadata:
name: {{ template "matrix-synapse.fullname" . }} name: {{ template "matrix-synapse.fullname" . }}
labels: labels:
{{- include "matrix-synapse.labels" . | nindent 4 }} {{- include "matrix-synapse.labels" . | nindent 4 }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec: spec:
accessModes: accessModes:
- {{ .Values.persistence.accessMode | quote }} - {{ .Values.persistence.accessMode | quote }}
resources: resources:
requests: requests:
storage: {{ .Values.persistence.size | quote }} storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }} {{- with .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }} {{- if (eq "-" .) }}
storageClassName: "" storageClassName: ""
{{- else }} {{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}" storageClassName: {{ . | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

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

View file

@ -760,9 +760,22 @@ externalRedis:
## ##
persistence: persistence:
enabled: true 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 accessMode: ReadWriteOnce
size: 10Gi size: 10Gi