Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit de1ed9d

Browse files
Omar007S7evinK
andauthored
Extend Dendrite Helm chart with some additional config options (#3077)
This set of changes introduces a few (compatible) changes to the Helm chart: - Allow PVC class to be set on each PVC, not only one-for-all. - Allow Prometheus servicemonitor and rules labels to be empty. - Have the option to generate the ingress (incl. TLS config) based on dendrite_config. * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: Omar Pakker <[email protected]> --------- Signed-off-by: Omar Pakker <[email protected]> Co-authored-by: Till <[email protected]>
1 parent 939ee32 commit de1ed9d

File tree

6 files changed

+106
-31
lines changed

6 files changed

+106
-31
lines changed

helm/dendrite/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: dendrite
3-
version: "0.12.3"
3+
version: "0.12.4"
44
appVersion: "0.12.0"
55
description: Dendrite Matrix Homeserver
66
type: application

helm/dendrite/templates/ingress.yaml

Lines changed: 75 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
{{- if .Values.ingress.enabled -}}
2-
{{- $fullName := include "dendrite.fullname" . -}}
3-
{{- $svcPort := .Values.service.port -}}
4-
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5-
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6-
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7-
{{- end }}
8-
{{- end }}
9-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
2+
{{- $fullName := include "dendrite.fullname" . -}}
3+
{{- $serverNameHost := .Values.dendrite_config.global.server_name -}}
4+
{{- $wellKnownServerHost := default $serverNameHost (regexFind "^[^:]+" .Values.dendrite_config.global.well_known_server_name) -}}
5+
{{- $wellKnownClientHost := default $serverNameHost (regexFind "^[^:]+" .Values.dendrite_config.global.well_known_client_name) -}}
6+
{{- $allHosts := list $serverNameHost $wellKnownServerHost $wellKnownClientHost | uniq -}}
7+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
108
apiVersion: networking.k8s.io/v1
11-
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
9+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
1210
apiVersion: networking.k8s.io/v1beta1
13-
{{- else -}}
11+
{{- else -}}
1412
apiVersion: extensions/v1beta1
15-
{{- end }}
13+
{{- end }}
1614
kind: Ingress
1715
metadata:
1816
name: {{ $fullName }}
1917
labels:
2018
{{- include "dendrite.labels" . | nindent 4 }}
2119
annotations:
20+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
21+
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
22+
{{- end }}
2223
{{- with .Values.ingress.annotations }}
2324
{{- toYaml . | nindent 4 }}
2425
{{- end }}
2526
spec:
2627
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
2728
ingressClassName: {{ .Values.ingress.className }}
2829
{{- end }}
29-
{{- if .Values.ingress.tls }}
30+
{{- if kindIs "slice" .Values.ingress.tls }}
3031
tls:
3132
{{- range .Values.ingress.tls }}
3233
- hosts:
@@ -35,8 +36,16 @@ spec:
3536
{{- end }}
3637
secretName: {{ .secretName }}
3738
{{- end }}
39+
{{- else if .Values.ingress.tls.generate }}
40+
tls:
41+
- hosts:
42+
{{- range $allHosts }}
43+
- {{ . | quote }}
44+
{{- end }}
45+
secretName: {{ $fullName }}-ingress-tls
3846
{{- end }}
3947
rules:
48+
{{- if .Values.ingress.hostName }}
4049
- host: {{ .Values.ingress.hostName | quote }}
4150
http:
4251
paths:
@@ -47,9 +56,60 @@ spec:
4756
service:
4857
name: {{ $fullName }}
4958
port:
50-
number: {{ $svcPort }}
59+
name: http
60+
{{- else }}
61+
serviceName: {{ $fullName }}
62+
servicePort: http
63+
{{- end }}
64+
{{- else }}
65+
- host: {{ $serverNameHost | quote }}
66+
http:
67+
paths:
68+
- path: /.well-known/matrix
69+
pathType: Prefix
70+
backend:
71+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
72+
service:
73+
name: {{ $fullName }}
74+
port:
75+
name: http
5176
{{- else }}
5277
serviceName: {{ $fullName }}
53-
servicePort: {{ $svcPort }}
78+
servicePort: http
5479
{{- end }}
55-
{{- end }}
80+
- host: {{ $wellKnownServerHost | quote }}
81+
http:
82+
paths:
83+
{{- range list "/_matrix/key" "/_matrix/federation" }}
84+
- path: {{ . | quote }}
85+
pathType: Prefix
86+
backend:
87+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
88+
service:
89+
name: {{ $fullName }}
90+
port:
91+
name: http
92+
{{- else }}
93+
serviceName: {{ $fullName }}
94+
servicePort: http
95+
{{- end }}
96+
{{- end }}
97+
- host: {{ $wellKnownClientHost | quote }}
98+
http:
99+
paths:
100+
{{- range list "/_matrix/client" "/_matrix/media" }}
101+
- path: {{ . | quote }}
102+
pathType: Prefix
103+
backend:
104+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
105+
service:
106+
name: {{ $fullName }}
107+
port:
108+
name: http
109+
{{- else }}
110+
serviceName: {{ $fullName }}
111+
servicePort: http
112+
{{- end }}
113+
{{- end }}
114+
{{- end }}
115+
{{- end }}

helm/dendrite/templates/prometheus-rules.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ metadata:
66
name: {{ include "dendrite.fullname" . }}
77
labels:
88
{{- include "dendrite.labels" . | nindent 4 }}
9-
{{- toYaml .Values.prometheus.rules.labels | nindent 4 }}
9+
{{- with .Values.prometheus.rules.labels }}
10+
{{- . | toYaml | nindent 4 }}
11+
{{- end }}
1012
spec:
1113
groups:
1214
{{- if .Values.prometheus.rules.additionalRules }}

helm/dendrite/templates/pvc.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
resources:
1313
requests:
1414
storage: {{ .Values.persistence.media.capacity }}
15-
storageClassName: {{ .Values.persistence.storageClass }}
15+
storageClassName: {{ default .Values.persistence.storageClass .Values.persistence.media.storageClass }}
1616
{{ end }}
1717
{{ if not .Values.persistence.jetstream.existingClaim }}
1818
---
@@ -28,7 +28,7 @@ spec:
2828
resources:
2929
requests:
3030
storage: {{ .Values.persistence.jetstream.capacity }}
31-
storageClassName: {{ .Values.persistence.storageClass }}
31+
storageClassName: {{ default .Values.persistence.storageClass .Values.persistence.jetstream.storageClass }}
3232
{{ end }}
3333
{{ if not .Values.persistence.search.existingClaim }}
3434
---
@@ -44,5 +44,5 @@ spec:
4444
resources:
4545
requests:
4646
storage: {{ .Values.persistence.search.capacity }}
47-
storageClassName: {{ .Values.persistence.storageClass }}
48-
{{ end }}
47+
storageClassName: {{ default .Values.persistence.storageClass .Values.persistence.search.storageClass }}
48+
{{ end }}

helm/dendrite/templates/servicemonitor.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ metadata:
99
name: {{ include "dendrite.fullname" . }}
1010
labels:
1111
{{- include "dendrite.labels" . | nindent 4 }}
12-
{{- toYaml .Values.prometheus.servicemonitor.labels | nindent 4 }}
12+
{{- with .Values.prometheus.servicemonitor.labels }}
13+
{{- . | toYaml | nindent 4 }}
14+
{{- end }}
1315
spec:
1416
endpoints:
1517
- port: http

helm/dendrite/values.yaml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,38 @@ signing_key:
1919
resources:
2020
requests:
2121
memory: "512Mi"
22-
2322
limits:
2423
memory: "4096Mi"
2524

2625
persistence:
27-
# -- The storage class to use for volume claims. Defaults to the
28-
# cluster default storage class.
26+
# -- The storage class to use for volume claims.
27+
# Used unless specified at the specific component.
28+
# Defaults to the cluster default storage class.
2929
storageClass: ""
3030
jetstream:
3131
# -- Use an existing volume claim for jetstream
3232
existingClaim: ""
3333
# -- PVC Storage Request for the jetstream volume
3434
capacity: "1Gi"
35+
# -- The storage class to use for volume claims.
36+
# Defaults to persistence.storageClass
37+
storageClass: ""
3538
media:
3639
# -- Use an existing volume claim for media files
3740
existingClaim: ""
3841
# -- PVC Storage Request for the media volume
3942
capacity: "1Gi"
43+
# -- The storage class to use for volume claims.
44+
# Defaults to persistence.storageClass
45+
storageClass: ""
4046
search:
4147
# -- Use an existing volume claim for the fulltext search index
4248
existingClaim: ""
4349
# -- PVC Storage Request for the search volume
4450
capacity: "1Gi"
51+
# -- The storage class to use for volume claims.
52+
# Defaults to persistence.storageClass
53+
storageClass: ""
4554

4655
# -- Add additional volumes to the Dendrite Pod
4756
extraVolumes: []
@@ -50,7 +59,6 @@ extraVolumes: []
5059
# secret:
5160
# secretName: extra-config
5261

53-
5462
# -- Configure additional mount points volumes in the Dendrite Pod
5563
extraVolumeMounts: []
5664
# ex.
@@ -212,7 +220,6 @@ dendrite_config:
212220
# - msc2836 (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
213221
# - msc2946 (Spaces Summary, see https://github.com/matrix-org/matrix-doc/pull/2946)
214222

215-
216223
app_service_api:
217224
# -- Disable the validation of TLS certificates of appservices. This is
218225
# not recommended in production since it may allow appservice traffic
@@ -359,14 +366,18 @@ postgresql:
359366
enabled: false
360367

361368
ingress:
362-
# -- Create an ingress for a monolith deployment
369+
# -- Create an ingress for the deployment
363370
enabled: false
364-
hosts: []
371+
# -- The ingressClass to use. Will be converted to annotation if not yet supported.
365372
className: ""
366-
hostName: ""
367373
# -- Extra, custom annotations
368374
annotations: {}
369-
375+
# -- The ingress hostname for your matrix server.
376+
# Should align with the server_name and well_known_* hosts.
377+
# If not set, generated from the dendrite_config values.
378+
hostName: ""
379+
# -- TLS configuration. Should contain information for the server_name and well-known hosts.
380+
# Alternatively, set tls.generate=true to generate defaults based on the dendrite_config.
370381
tls: []
371382

372383
service:

0 commit comments

Comments
 (0)