charts/charts-wip/matrix-synapse/templates/deployment.yaml

145 lines
5.1 KiB
YAML
Raw Normal View History

2020-08-07 21:23:34 +00:00
{{- if not .Values.config.serverName -}}
{{- fail "A valid .Values.config.serverName is required" -}}
{{- end -}}
2020-08-08 22:15:10 +00:00
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled (or .Values.persistence.enabled .Values.persistence.existingClaim) }}
2020-08-07 21:23:34 +00:00
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "matrix-synapse.fullname" . }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
2020-08-08 22:15:10 +00:00
app.kubernetes.io/component: synapse
2020-08-07 21:23:34 +00:00
spec:
2020-08-09 09:16:36 +00:00
replicas: 1
2020-08-07 21:23:34 +00:00
selector:
matchLabels:
{{- include "matrix-synapse.selectorLabels" . | nindent 6 }}
2020-08-08 22:15:10 +00:00
app.kubernetes.io/component: synapse
2020-08-07 21:23:34 +00:00
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configuration.yaml") . | sha256sum }}
checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
2020-08-09 09:16:36 +00:00
{{- with .Values.synapse.annotations }}
2020-08-08 22:15:10 +00:00
{{ . | toYaml | nindent 8 }}
{{- end }}
2020-08-07 21:23:34 +00:00
labels:
{{- include "matrix-synapse.selectorLabels" . | nindent 8 }}
2020-08-08 22:15:10 +00:00
app.kubernetes.io/component: synapse
2020-08-09 09:16:36 +00:00
{{- with .Values.synapse.labels }}
2020-08-08 22:15:10 +00:00
{{ . | toYaml | nindent 8 }}
{{- end }}
2020-08-07 21:23:34 +00:00
spec:
2020-08-09 09:16:36 +00:00
{{- include "matrix-synapse.imagePullSecrets" . | nindent 6 }}
2020-08-07 21:23:34 +00:00
securityContext:
2020-08-09 09:16:36 +00:00
{{- toYaml .Values.synapse.podSecurityContext | nindent 8 }}
2020-08-07 21:23:34 +00:00
containers:
2020-08-09 09:16:36 +00:00
- name: synapse
2020-08-07 21:23:34 +00:00
command:
- sh
- -c
- |
cat /synapse/secrets/*.yaml | \
sed -e "s/@@POSTGRES_PASSWORD@@/${POSTGRES_PASSWORD:-}/" \
-e "s/@@REDIS_PASSWORD@@/${REDIS_PASSWORD:-}/" \
> /synapse/config/conf.d/secrets.yaml
/matrix-synapse $@
args:
- synapse.app.homeserver
env:
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "matrix-synapse.postgresql.fullname" . }}
key: postgresql-password
{{- end }}
{{- if and .Values.redis.enabled (default .Values.redis.usePassword true) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "matrix-synapse.redis.fullname" . }}
key: redis-password
{{- end }}
2020-08-08 22:15:10 +00:00
{{- with .Values.extraEnv }}
{{ . | toYaml }}
{{- end }}
2020-08-07 21:23:34 +00:00
image: "{{ .Values.image.repository }}:{{ include "matrix-synapse.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
2020-08-09 09:16:36 +00:00
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
2020-08-07 21:23:34 +00:00
ports:
- name: http
containerPort: 8008
protocol: TCP
- name: replication
containerPort: 9093
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
livenessProbe:
httpGet:
path: /_matrix/client/versions
port: http
readinessProbe:
httpGet:
path: /_matrix/client/versions
port: http
volumeMounts:
- name: config
mountPath: /synapse/config
- name: tmpconf
mountPath: /synapse/config/conf.d
- name: secrets
mountPath: /synapse/secrets
- name: signingkey
mountPath: /synapse/keys
2020-08-08 18:38:36 +00:00
- name: media
mountPath: /synapse/data
2020-08-07 21:23:34 +00:00
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: config
configMap:
name: {{ include "matrix-synapse.fullname" . }}
- name: secrets
secret:
secretName: {{ include "matrix-synapse.fullname" . }}
- name: signingkey
secret:
2020-08-09 09:16:36 +00:00
secretName: {{ .Values.signingkey.existingSecret | default (include "matrix-synapse.workername" (dict "global" . "worker" "signingkey")) | quote }}
2020-08-07 21:23:34 +00:00
items:
2020-08-09 09:16:36 +00:00
- key: {{ .Values.signingkey.existingSecretKey | default "signing.key" | quote }}
2020-08-07 21:23:34 +00:00
path: signing.key
- name: tmpconf
emptyDir: {}
2020-08-08 18:38:36 +00:00
- name: media
{{- $mediaworker := false }}
{{- range $worker, $config := .Values.workers }}
{{- if eq $worker "media-repository" }}
{{- $mediaworker = true }}
{{- end }}
{{- end }}
{{- if and .Values.persistence.enabled (not $mediaworker) }}
persistentVolumeClaim:
2020-08-09 09:16:36 +00:00
claimName: {{ .Values.persistence.existingClaim | default (include "matrix-synapse.fullname" .) }}
2020-08-08 18:38:36 +00:00
{{- else }}
emptyDir: {}
{{- end }}
2020-08-07 21:23:34 +00:00
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}