feat: migrate immich to k8s
This commit is contained in:
parent
2f0378cba6
commit
3d3ea948db
21 changed files with 1044 additions and 100 deletions
167
k8s/charts/immich/templates/deployment.yaml
Normal file
167
k8s/charts/immich/templates/deployment.yaml
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
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.autoscaling.enabled }}
|
||||
replicas: {{ .Values.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.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "immich.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: server
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
initContainers:
|
||||
- name: init-immich
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.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.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.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.service.port | quote }}
|
||||
- name: IMMICH_MACHINE_LEARNING_URL
|
||||
value: {{ printf "http://%s-machine-learning:3003" (include "immich.fullname" .) | quote }}
|
||||
{{- range $key, $value := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 2283
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: library
|
||||
mountPath: /data/library
|
||||
{{- if .Values.persistence.encodedVideo.enabled }}
|
||||
- name: encoded-video
|
||||
mountPath: /data/encoded-video
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.thumbs.enabled }}
|
||||
- name: thumbs
|
||||
mountPath: /data/thumbs
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.upload.enabled }}
|
||||
- name: upload
|
||||
mountPath: /data/upload
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.profile.enabled }}
|
||||
- name: profile
|
||||
mountPath: /data/profile
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.backups.enabled }}
|
||||
- name: backups
|
||||
mountPath: /data/backups
|
||||
{{- 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 }}
|
||||
restartPolicy: Always
|
||||
automountServiceAccountToken: false
|
||||
volumes:
|
||||
{{- if .Values.persistence.library.enabled }}
|
||||
- name: library
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-library
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.encodedVideo.enabled }}
|
||||
- name: encoded-video
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-encoded-video
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.thumbs.enabled }}
|
||||
- name: thumbs
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-thumbs
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.upload.enabled }}
|
||||
- name: upload
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-upload
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.profile.enabled }}
|
||||
- name: profile
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-profile
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.backups.enabled }}
|
||||
- name: backups
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "immich.fullname" . }}-backups
|
||||
{{- end }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue