blob: 2cbc59a324b4a0f5df1431aa9ceaff821e26f1ea [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001apiVersion: rbac.authorization.k8s.io/v1
2kind: Role
3metadata:
4 name: CreateConfigMaps
5 namespace: {{ .Release.Namespace }}
6 annotations:
7 helm.sh/hook: pre-install
8 helm.sh/hook-weight: "-10"
9rules:
10- apiGroups:
11 - ""
12 resources:
13 - configmaps
14 verbs:
15 - create
16---
17apiVersion: rbac.authorization.k8s.io/v1
18kind: RoleBinding
19metadata:
20 name: default-CreateConfigMaps
21 namespace: {{ .Release.Namespace }}
22 annotations:
23 helm.sh/hook: pre-install
24 helm.sh/hook-weight: "-10"
25roleRef:
26 apiGroup: rbac.authorization.k8s.io
27 kind: Role
28 name: CreateConfigMaps
29subjects:
30- kind: ServiceAccount
31 name: default
32 namespace: {{ .Release.Namespace }}
33---
34apiVersion: v1
35kind: Service
36metadata:
37 name: matrix
38 namespace: {{ .Release.Namespace }}
39spec:
40 type: ClusterIP
41 selector:
42 app: matrix
43 ports:
44 - name: http
45 port: 80
46 targetPort: http
47 protocol: TCP
48---
49apiVersion: networking.k8s.io/v1
50kind: Ingress
51metadata:
52 name: ingress
53 namespace: {{ .Release.Namespace }}
54 {{- if .Values.certificateIssuer }}
55 annotations:
56 acme.cert-manager.io/http01-edit-in-place: "true"
57 cert-manager.io/cluster-issuer: {{ .Values.certificateIssuer }}
58 {{- end }}
59spec:
60 ingressClassName: {{ .Values.ingressClassName }}
61 tls:
62 - hosts:
63 - {{ .Values.subdomain }}.{{ .Values.domain }}
64 secretName: cert-{{ .Values.subdomain }}.{{ .Values.domain }}
65 rules:
66 - host: {{ .Values.subdomain }}.{{ .Values.domain }}
67 http:
68 paths:
69 - path: /
70 pathType: Prefix
71 backend:
72 service:
73 name: matrix
74 port:
75 name: http
76---
77apiVersion: batch/v1
78kind: Job
79metadata:
80 name: generate-config
81 namespace: {{ .Release.Namespace }}
82 annotations:
83 helm.sh/hook: pre-install
84 helm.sh/hook-weight: "-5"
85spec:
86 template:
87 metadata:
88 labels:
89 app: generate-config
90 spec:
91 restartPolicy: OnFailure
92 volumes:
93 - name: data
94 persistentVolumeClaim:
95 claimName: data
96 - name: config
97 configMap:
98 name: {{ .Values.configMerge.configName }}
99 initContainers:
100 - name: matrix
101 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
102 imagePullPolicy: {{ .Values.image.pullPolicy }}
103 ports:
104 - name: http
105 containerPort: 8008
106 protocol: TCP
107 env:
108 - name: SYNAPSE_SERVER_NAME
109 value: "{{ .Values.domain }}"
110 - name: SYNAPSE_REPORT_STATS
111 value: "no"
112 - name: SYNAPSE_CONFIG_DIR
113 value: "/data"
114 - name: SYNAPSE_CONFIG_PATH
115 value: "/data/homeserver.yaml"
116 - name: SYNAPSE_DATA_DIR
117 value: "/data"
118 command:
119 - /start.py
120 - generate
121 volumeMounts:
122 - name: data
123 mountPath: /data
124 containers:
125 - name: capture-config
126 image: giolekva/capture-config:latest
127 imagePullPolicy: Always
128 command:
129 - /capture-config
130 - --base=/data/homeserver.yaml
131 - --merge-with=/config-to-merge/{{ .Values.configMerge.fileName }}
132 - --namespace={{ .Release.Namespace }}
133 - --config-map-name=config
134 volumeMounts:
135 - name: data
136 mountPath: /data
137 - name: config
138 mountPath: /config-to-merge
139---
140apiVersion: apps/v1
141kind: Deployment
142metadata:
143 name: matrix
144 namespace: {{ .Release.Namespace }}
145spec:
146 selector:
147 matchLabels:
148 app: matrix
149 replicas: 1
150 template:
151 metadata:
152 labels:
153 app: matrix
154 spec:
155 volumes:
156 - name: data
157 persistentVolumeClaim:
158 claimName: data
159 - name: homeserver-config
160 configMap:
161 name: config
162 containers:
163 - name: matrix
164 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
165 imagePullPolicy: {{ .Values.image.pullPolicy }}
166 ports:
167 - name: http
168 containerPort: 8008
169 protocol: TCP
170 env:
171 - name: SYNAPSE_SERVER_NAME
172 value: "{{ .Values.domain }}"
173 - name: SYNAPSE_REPORT_STATS
174 value: "no"
175 - name: SYNAPSE_CONFIG_DIR
176 value: "/data"
177 - name: SYNAPSE_CONFIG_PATH
178 value: "/homeserver-config/homeserver.yaml"
179 - name: SYNAPSE_DATA_DIR
180 value: "/data"
181 command: ["/start.py"]
182 volumeMounts:
183 - name: data
184 mountPath: /data
185 - name: homeserver-config
186 mountPath: /homeserver-config
187 readOnly: true
188---
189apiVersion: v1
190kind: PersistentVolumeClaim
191metadata:
192 name: data
193 namespace: {{ .Release.Namespace }}
194 annotations:
195 helm.sh/hook: pre-install
196 helm.sh/hook-weight: "-10"
197spec:
198 accessModes:
199 - ReadWriteOnce
200 resources:
201 requests:
202 storage: 10Gi