Files
media-charts/plex/templates/deployment.yaml
2025-01-26 15:46:15 +01:00

153 lines
5.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "plex.fullname" . }}
labels:
{{- include "plex.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "plex.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "plex.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: debug
image: busybox:latest
command: ['sleep', 'infinity']
- name: {{ .Chart.Name }}
securityContext:
privileged: {{ .Values.securityContext.privileged }}
capabilities:
add:
{{ toYaml .Values.securityContext.capabilities.add | indent 16 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: {{ .Values.env.TZ | quote }}
- name: PUID
value: {{ .Values.securityContext.PUID | quote }}
- name: PGID
value: {{ .Values.securityContext.PGID | quote }}
- name: VERSION
value: {{ .Values.env.VERSION | quote }}
{{- if .Values.env.PLEX_CLAIM }}
- name: PLEX_CLAIM
value: {{ .Values.env.PLEX_CLAIM | quote }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- range .Values.service.additional }}
- name: {{ .name }}
containerPort: {{ .port }}
protocol: {{ .protocol }}
{{- end }}
volumeMounts:
- name: config
mountPath: {{ .Values.persistence.config.mountPath }}
- name: transcode
mountPath: {{ .Values.persistence.transcode.mountPath }}
- name: data
mountPath: {{ .Values.persistence.data.mountPath }}
{{- if .Values.transcoding.hardware.enabled }}
{{- if .Values.transcoding.hardware.intel }}
- name: dev-dri
mountPath: /dev/dri
{{- end }}
{{- if .Values.transcoding.hardware.nvidia }}
- name: nvidia
mountPath: /usr/lib/nvidia
- name: nvidia-dev
mountPath: /dev/nvidia0
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /identity
port: http
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /identity
port: http
initialDelaySeconds: 30
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: config
{{- if .Values.persistence.config.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.config.existingClaim }}
claimName: {{ .Values.persistence.config.existingClaim }}
{{- else }}
claimName: {{ include "plex.fullname" . }}-config
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: transcode
{{- if .Values.persistence.transcode.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.transcode.existingClaim }}
claimName: {{ .Values.persistence.transcode.existingClaim }}
{{- else }}
claimName: {{ include "plex.fullname" . }}-transcode
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: data
{{- if .Values.persistence.data.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.data.existingClaim }}
claimName: {{ .Values.persistence.data.existingClaim }}
{{- else }}
claimName: {{ include "plex.fullname" . }}-data
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.transcoding.hardware.enabled }}
{{- if .Values.transcoding.hardware.intel }}
- name: dev-dri
hostPath:
path: /dev/dri
{{- end }}
{{- if .Values.transcoding.hardware.nvidia }}
- name: nvidia
hostPath:
path: /usr/lib/nvidia
- name: nvidia-dev
hostPath:
path: /dev/nvidia0
{{- end }}
{{- 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 }}