helm-charts/pretix/templates/deployment.yaml

102 lines
3.4 KiB
YAML
Raw Normal View History

2024-12-12 22:33:45 +01:00
{{- range $component := list "web" "taskworker" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "pretix.fullname" $ }}-{{ $component }}
labels:
{{- include "pretix.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
spec:
{{- if not $.Values.autoscaling.enabled }}
replicas: {{ get $.Values.replicas $component }}
{{- end }}
selector:
matchLabels:
{{- include "pretix.selectorLabels" $ | nindent 6 }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
annotations:
checksum/secret: {{ toYaml $.Values.env | sha256sum }}
{{- with $.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "pretix.labels" $ | nindent 8 }}
app.kubernetes.io/component: {{ $component }}
{{- with $.Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "pretix.serviceAccountName" $ }}
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ $.Chart.Name }}
securityContext:
{{- toYaml $.Values.securityContext | nindent 12 }}
{{- with $.Values.image }}
image: "{{ .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
env:
# Migrations are handled by helm hooks in pretix-migrate.yaml
- name: AUTOMIGRATE
value: "skip"
envFrom:
- secretRef:
name: {{ include "pretix.fullname" $ }}
command: [ "pretix" ]
args: [ {{ $component | quote }} ]
{{- if (eq $component "web") }}
ports:
- name: http
containerPort: {{ $.Values.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml $.Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml $.Values.readinessProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml $.Values.resources | nindent 12 }}
volumeMounts:
- name: pretix-data
mountPath: /data
{{- with $.Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: pretix-data
{{- if $.Values.persistence.hostPath }}
hostPath:
type: Directory
path: {{ $.Values.persistence.hostPath | quote }}
{{- else if $.Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ with $.Values.persistence.existingClaim }}{{ . }}{{- else }}{{ template "pretix.fullname" $ }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with $.Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- 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 }}
{{- end }}