blob: 2cbc59a324b4a0f5df1431aa9ceaff821e26f1ea [file] [log] [blame]
giolekva95340e82021-11-08 21:36:55 +04001apiVersion: rbac.authorization.k8s.io/v1
2kind: Role
3metadata:
4 name: CreateConfigMaps
5 namespace: {{ .Release.Namespace }}
giolekva30850462021-12-01 16:23:50 +04006 annotations:
7 helm.sh/hook: pre-install
8 helm.sh/hook-weight: "-10"
giolekva95340e82021-11-08 21:36:55 +04009rules:
10- apiGroups:
11 - ""
12 resources:
13 - configmaps
14 verbs:
giolekva95340e82021-11-08 21:36:55 +040015 - create
16---
17apiVersion: rbac.authorization.k8s.io/v1
18kind: RoleBinding
19metadata:
20 name: default-CreateConfigMaps
21 namespace: {{ .Release.Namespace }}
giolekva30850462021-12-01 16:23:50 +040022 annotations:
23 helm.sh/hook: pre-install
24 helm.sh/hook-weight: "-10"
giolekva95340e82021-11-08 21:36:55 +040025roleRef:
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 }}
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +040054 {{- 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 }}
giolekva95340e82021-11-08 21:36:55 +040059spec:
60 ingressClassName: {{ .Values.ingressClassName }}
61 tls:
62 - hosts:
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +040063 - {{ .Values.subdomain }}.{{ .Values.domain }}
64 secretName: cert-{{ .Values.subdomain }}.{{ .Values.domain }}
giolekva95340e82021-11-08 21:36:55 +040065 rules:
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +040066 - host: {{ .Values.subdomain }}.{{ .Values.domain }}
giolekva95340e82021-11-08 21:36:55 +040067 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 }}
giolekva30850462021-12-01 16:23:50 +040082 annotations:
83 helm.sh/hook: pre-install
84 helm.sh/hook-weight: "-5"
giolekva95340e82021-11-08 21:36:55 +040085spec:
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
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +040096 - name: config
97 configMap:
98 name: {{ .Values.configMerge.configName }}
giolekva95340e82021-11-08 21:36:55 +040099 initContainers:
100 - name: matrix
Giorgi Lekveishvili9d4c10d2023-12-20 20:22:47 +0400101 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
102 imagePullPolicy: {{ .Values.image.pullPolicy }}
giolekva95340e82021-11-08 21:36:55 +0400103 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:
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +0400129 - /capture-config
130 - --base=/data/homeserver.yaml
131 - --merge-with=/config-to-merge/{{ .Values.configMerge.fileName }}
giolekva95340e82021-11-08 21:36:55 +0400132 - --namespace={{ .Release.Namespace }}
133 - --config-map-name=config
giolekva95340e82021-11-08 21:36:55 +0400134 volumeMounts:
135 - name: data
136 mountPath: /data
Giorgi Lekveishvili6d7dcb82023-12-20 14:44:42 +0400137 - name: config
138 mountPath: /config-to-merge
giolekva95340e82021-11-08 21:36:55 +0400139---
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
Giorgi Lekveishvili9d4c10d2023-12-20 20:22:47 +0400164 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
165 imagePullPolicy: {{ .Values.image.pullPolicy }}
giolekva95340e82021-11-08 21:36:55 +0400166 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 }}
giolekva30850462021-12-01 16:23:50 +0400194 annotations:
195 helm.sh/hook: pre-install
196 helm.sh/hook-weight: "-10"
giolekva95340e82021-11-08 21:36:55 +0400197spec:
198 accessModes:
199 - ReadWriteOnce
200 resources:
201 requests:
202 storage: 10Gi