mautrix-meta/templates/deployment.yaml

133 lines
4.5 KiB
YAML
Raw Permalink Normal View History

apiVersion: apps/v1
{{- $podAnnotations := .Values.podAnnotations }}
{{- $secretAnnotation := dict "checksum/secret" (include (print $.Template.BasePath "/secret.yaml") . | sha256sum) }}
{{- $podAnnotations := merge $podAnnotations $secretAnnotation }}
kind: Deployment
metadata:
name: {{ include "mautrix-meta.fullname" . }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.deploymentAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels:
{{ include "mautrix-meta.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
{{- if .Values.strategy }}
strategy:
{{ toYaml .Values.strategy | indent 4 }}
{{ if eq .Values.strategy.type "Recreate" }}
rollingUpdate: null
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "mautrix-meta.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "mautrix-meta.selectorLabels" . | nindent 8 }}
{{- if $podAnnotations }}
annotations:
{{- range $key, $value := $podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "mautrix-meta.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.dnsConfig }}
dnsConfig:
{{- toYaml .Values.dnsConfig | nindent 8 }}
{{- end }}
initContainers:
- name: init
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/sh"]
args:
- "-c"
- |-
set -ex
cp /config/*.yaml /data/
#chown {{.Values.uid}}:{{.Values.gid}} -R /data
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /config
resources:
{{- toYaml .Values.resources | nindent 12 }}
containers:
- name: mautrix-meta
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ required "need config.appservice.port" .Values.config.appservice.port }}
protocol: TCP
env:
[]
livenessProbe:
httpGet:
path: /_matrix/mau/live
port: http
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
readinessProbe:
httpGet:
path: /_matrix/mau/live
port: http
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
startupProbe:
httpGet:
path: /_matrix/mau/live
port: http
initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }}
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
{{- end }}
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /config
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: config
secret:
secretName: {{ include "mautrix-meta.fullname" . }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "mautrix-meta.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}