-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathchat-deployment.yaml
More file actions
274 lines (273 loc) · 10.5 KB
/
chat-deployment.yaml
File metadata and controls
274 lines (273 loc) · 10.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "rocketchat.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.deploymentLabels }}
{{ toYaml .Values.deploymentLabels | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
annotations:
{{ include "rocketchat.annotations" (dict "name" "meteor" "context" $) | indent 8 }}
checksum/secret: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "rocketchat.serviceAccountName" . }}
{{- if .Values.extraInitContainers }}
initContainers:
{{- toYaml .Values.extraInitContainers | nindent 8 }}
{{- end }}
containers:
- name: rocketchat
image: "{{ include "rocketchat.image" (dict "repository" .Values.image.repository "tag" .Values.image.tag "appVersion" .Chart.AppVersion "global" .Values.global) }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.extraSecret }}
envFrom:
- secretRef:
name: {{ .Values.extraSecret }}
{{- end }}
env:
- name: DEPLOY_PLATFORM
value: helm-chart
- name: INSTANCE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
{{- if .Values.existingMongodbSecret }}
- name: MONGO_URL
valueFrom:
secretKeyRef:
name: {{ .Values.existingMongodbSecret }}
key: mongo-uri
{{- else }}
- name: MONGO_URL
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: mongo-uri
{{- end }}
{{- if .Values.host }}
- name: ROOT_URL
value: https://{{ .Values.host }}
{{- end }}
{{- if .Values.smtp.enabled }}
{{- if not .Values.smtp.existingSecret }}
- name: MAIL_URL
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: mail-url
{{- else }}
- name: MAIL_URL
valueFrom:
secretKeyRef:
name: {{ .Values.smtp.existingSecret }}
key: mail-url
{{- end }}
{{- end }}
{{- if and .Values.registrationToken .Release.IsInstall }}
- name: REG_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: reg-token
{{- end }}
{{- if .Values.license }}
- name: OVERWRITE_SETTING_Enterprise_License
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: license
- name: OVERWRITE_SETTING_Show_Setup_Wizard
value: "completed"
- name: LICENSE_DEBUG
value: "true"
{{- end }}
{{- if .Values.prometheusScraping.enabled }}
- name: OVERWRITE_SETTING_Prometheus_Enabled
value: "true"
- name: OVERWRITE_SETTING_Prometheus_Port
value: "{{ .Values.prometheusScraping.port }}"
{{- if and .Values.prometheusScraping.enabled .Values.microservices.enabled }}
- name: MS_METRICS
value: "true"
- name: MS_METRICS_PORT
value: {{ .Values.prometheusScraping.msPort | default "9458" | quote }}
{{- end }}
{{- end }}
# Environment variables for microservices option
{{- include "rocketchat.transporter.connectionString" (dict "Values" $.Values "Release" $.Release) | nindent 8 }}
{{- if .Values.microservices.enabled }}
{{- if eq (include "rocketchat.streamHub.enabled" .) "true" }}
- name: DB_WATCHERS
value: "true"
{{- end }}
- name: MOLECULER_LOG_LEVEL
value: {{ .Values.microservices.logLevel | quote }}
- name: HEARTBEAT_INTERVAL
value: {{ .Values.microservices.heartbeatInterval | quote }}
- name: HEARTBEAT_TIMEOUT
value: {{ .Values.microservices.heartbeatTimeout | quote }}
- name: RETRY_ENABLED
value: 'yes'
{{- end }} # end of microservices envvar. options
{{- with .Values.extraEnv }}
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.federation.enabled }}
- name: OVERWRITE_SETTING_Federation_Matrix_homeserver_domain
value: {{ .Values.host }}
- name: OVERWRITE_SETTING_Federation_Matrix_enabled
value: "true"
- name: OVERWRITE_SETTING_Federation_Matrix_serve_well_known
{{- if not .Values.ingress.federation.serveWellKnown }}
value: "true"
{{- else }}
value: "false"
{{- end }}
- name: OVERWRITE_SETTING_Federation_Matrix_id
valueFrom:
secretKeyRef:
name: {{ include "rocketchat.fullname" . }}-synapse
key: appservice_id
- name: OVERWRITE_SETTING_Federation_Matrix_hs_token
valueFrom:
secretKeyRef:
name: {{ include "rocketchat.fullname" . }}-synapse
key: hs_token
- name: OVERWRITE_SETTING_Federation_Matrix_as_token
valueFrom:
secretKeyRef:
name: {{ include "rocketchat.fullname" . }}-synapse
key: as_token
- name: OVERWRITE_SETTING_Federation_Matrix_bridge_url
valueFrom:
secretKeyRef:
name: {{ include "rocketchat.fullname" . }}-synapse
key: bridge_url
- name: OVERWRITE_SETTING_Federation_Matrix_homeserver_url
{{- if .Values.ingress.federation.serveWellKnown }}
value: http://{{ template "rocketchat.fullname" . }}-synapse:8008
{{- else }}
value: https://{{ .Values.federation.host }}
{{- end }}
- name: OVERWRITE_SETTING_Federation_Matrix_bridge_localpart
value: "rocket.cat"
{{end}}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- name: http
containerPort: 3000
{{- if .Values.prometheusScraping.enabled }}
- name: metrics
containerPort: {{ .Values.prometheusScraping.port }}
{{- if .Values.microservices.enabled }}
- name: ms-metrics
containerPort: {{ .Values.prometheusScraping.msPort }}
{{- end }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.livenessProbe.path }}
port: http
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.readinessProbe.path }}
port: http
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: rocket-data
mountPath: /app/uploads
- name: tmp
mountPath: /tmp
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: rocket-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "rocketchat.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 6 }}
{{- end }}
nodeSelector:
{{ include "rocketchat.nodeSelector" (dict "name" "meteor" "context" $) | indent 8 }}
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "meteor" "context" $) | indent 8 }}
{{- if or .Values.podAntiAffinity .Values.affinity }}
affinity:
{{- if .Values.affinity }}
{{ include "rocketchat.nodeAffinity" (dict "name" "meteor" "context" $) | indent 10 }}
{{- end }}
{{- if eq .Values.podAntiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
{{- else if eq .Values.podAntiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}