apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "immich.fullname" . }}-server labels: {{- include "immich.labels" . | nindent 4 }} app.kubernetes.io/component: server spec: {{- if not .Values.immich.autoscaling.enabled }} replicas: {{ .Values.immich.replicaCount }} {{- end }} selector: matchLabels: {{- include "immich.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: server strategy: rollingUpdate: maxSurge: 50% maxUnavailable: 50% type: RollingUpdate template: metadata: {{- with .Values.immich.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "immich.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: server spec: {{- with .Values.immich.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.immich.podSecurityContext | nindent 8 }} initContainers: - name: init-immich image: "{{ .Values.immich.image.repository }}:{{ .Values.immich.image.tag | default .Chart.AppVersion }}" imagePullPolicy: IfNotPresent command: - sh - -c - | touch /data/library/.immich touch /data/encoded-video/.immich touch /data/thumbs/.immich touch /data/upload/.immich touch /data/profile/.immich touch /data/backups/.immich chown -R 10000:10000 /data/library /data/encoded-video /data/thumbs /data/upload /data/profile /data/backups volumeMounts: - name: library mountPath: /data/library - name: encoded-video mountPath: /data/encoded-video - name: thumbs mountPath: /data/thumbs - name: upload mountPath: /data/upload - name: profile mountPath: /data/profile - name: backups mountPath: /data/backups containers: - name: {{ .Chart.Name }}-server securityContext: {{- toYaml .Values.immich.securityContext | nindent 12 }} image: "{{ .Values.immich.image.repository }}:{{ .Values.immich.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.immich.image.pullPolicy }} envFrom: {{- if .Values.secret.existingSecretName }} - secretRef: name: {{ .Values.secret.existingSecretName }} {{- else if .Values.secret.enabled }} - secretRef: name: {{ include "immich.fullname" . }} {{- end }} - configMapRef: name: {{ include "immich.fullname" . }} env: - name: IMMICH_PORT value: {{ .Values.immich.service.port | quote }} - name: IMMICH_MACHINE_LEARNING_URL value: {{ printf "http://%s-machine-learning:3003" (include "immich.fullname" .) | quote }} {{- range $key, $value := .Values.immich.env }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} ports: - name: http containerPort: 2283 protocol: TCP livenessProbe: {{- toYaml .Values.immich.livenessProbe | nindent 12 }} readinessProbe: {{- toYaml .Values.immich.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.immich.resources | nindent 12 }} volumeMounts: - name: library mountPath: /data/library {{- if .Values.immich.persistence.encodedVideo.enabled }} - name: encoded-video mountPath: /data/encoded-video {{- end }} {{- if .Values.immich.persistence.thumbs.enabled }} - name: thumbs mountPath: /data/thumbs {{- end }} {{- if .Values.immich.persistence.upload.enabled }} - name: upload mountPath: /data/upload {{- end }} {{- if .Values.immich.persistence.profile.enabled }} - name: profile mountPath: /data/profile {{- end }} {{- if .Values.immich.persistence.backups.enabled }} - name: backups mountPath: /data/backups {{- end }} {{- with .Values.immich.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.immich.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.immich.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} restartPolicy: Always automountServiceAccountToken: false volumes: {{- if .Values.immich.persistence.library.enabled }} - name: library persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-library {{- end }} {{- if .Values.immich.persistence.encodedVideo.enabled }} - name: encoded-video persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-encoded-video {{- end }} {{- if .Values.immich.persistence.thumbs.enabled }} - name: thumbs persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-thumbs {{- end }} {{- if .Values.immich.persistence.upload.enabled }} - name: upload persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-upload {{- end }} {{- if .Values.immich.persistence.profile.enabled }} - name: profile persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-profile {{- end }} {{- if .Values.immich.persistence.backups.enabled }} - name: backups persistentVolumeClaim: claimName: {{ include "immich.fullname" . }}-backups {{- end }}