244 lines
8.0 KiB
YAML
244 lines
8.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "pms-chart.fullname" . }}
|
|
labels:
|
|
name: {{ include "pms-chart.fullname" . }}
|
|
{{ include "pms-chart.labels" . | indent 4 }}
|
|
{{- with .Values.statefulSet.annotations }}
|
|
annotations:
|
|
{{ toYaml . | indent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceName: {{ include "pms-chart.fullname" . }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "pms-chart.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "pms-chart.labels" . | nindent 8 }}
|
|
annotations:
|
|
{{- toYaml .Values.statefulSet.podAnnotations | nindent 8 }}
|
|
spec:
|
|
{{- if .Values.hostNetwork }}
|
|
hostNetwork: {{ .Values.hostNetwork }}
|
|
{{- end }}
|
|
{{- if .Values.dnsConfig }}
|
|
dnsConfig:
|
|
{{- toYaml .Values.dnsConfig | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.dnsPolicy }}
|
|
dnsPolicy: {{ .Values.dnsPolicy | quote }}
|
|
{{- end }}
|
|
{{- if .Values.runtimeClassName }}
|
|
runtimeClassName: {{ .Values.runtimeClassName | quote }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "pms-chart.serviceAccountName" . }}
|
|
{{- if .Values.pms.shareProcessNamespace }}
|
|
shareProcessNamespace: {{ .Values.pms.shareProcessNamespace }}
|
|
{{- end }}
|
|
tolerations:
|
|
{{- toYaml .Values.tolerations | nindent 8 }}
|
|
nodeSelector:
|
|
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
|
affinity:
|
|
{{- toYaml .Values.affinity | nindent 8 }}
|
|
{{- if .Values.priorityClassName }}
|
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
|
{{- end }}
|
|
volumes:
|
|
{{- if .Values.pms.configExistingClaim }}
|
|
- name: pms-config
|
|
persistentVolumeClaim:
|
|
claimName: {{ .Values.pms.configExistingClaim | quote }}
|
|
{{- end }}
|
|
- name: pms-transcode
|
|
emptyDir: {}
|
|
{{- if and .Values.rclone.enabled .Values.rclone.configSecret }}
|
|
{{- range .Values.rclone.remotes }}
|
|
- name: rclone-media-{{ (split ":" .)._0 }}
|
|
emptyDir: {}
|
|
{{- end }}
|
|
- name: rclone-config
|
|
emptyDir: {}
|
|
- name: rclone-config-data
|
|
secret:
|
|
secretName: {{ .Values.rclone.configSecret }}
|
|
{{- end }}
|
|
{{- if .Values.initContainer.script }}
|
|
- name: init-script-configmap
|
|
configMap:
|
|
defaultMode: 0700
|
|
name: {{ include "pms-chart.fullname" . }}-init-script
|
|
{{- end }}
|
|
{{- if .Values.extraVolumes }}
|
|
{{ toYaml .Values.extraVolumes | indent 6 }}
|
|
{{- end }}
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: 120
|
|
initContainers:
|
|
{{- if .Values.initContainer.script }}
|
|
- name: {{ include "pms-chart.fullname" . }}-pms-init
|
|
image: {{ include "pms-chart.init_image" . }}
|
|
command: ["/init/init.sh"]
|
|
volumeMounts:
|
|
- name: pms-config
|
|
mountPath: /config
|
|
- name: init-script-configmap
|
|
mountPath: /init
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{ toYaml .Values.extraVolumeMounts | indent 8}}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if and .Values.rclone.enabled .Values.rclone.configSecret }}
|
|
- name: {{ include "pms-chart.fullname" . }}-config
|
|
image: {{ include "pms-chart.init_image" . }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
args:
|
|
- cp -v /in/* /out/
|
|
volumeMounts:
|
|
- name: rclone-config-data
|
|
mountPath: /in
|
|
readOnly: true
|
|
- name: rclone-config
|
|
mountPath: /out
|
|
{{- end }}
|
|
{{- with .Values.extraInitContainers }}
|
|
{{- toYaml . | nindent 6 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ include "pms-chart.fullname" . }}-pms
|
|
image: {{ include "pms-chart.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
ports:
|
|
- containerPort: 32400
|
|
name: pms
|
|
env:
|
|
{{- if or .Values.ingress.enabled .Values.extraEnv.ADVERTISE_IP }}
|
|
- name: ADVERTISE_IP
|
|
value: {{ .Values.extraEnv.ADVERTISE_IP | default (printf "%s:443" .Values.ingress.url) }}
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.extraEnv }}
|
|
{{- if ne $key "ADVERTISE_IP" }}
|
|
- name: {{ $key }}
|
|
value: {{ $value | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if and .Values.pms.claimSecret.name .Values.pms.claimSecret.value }}
|
|
- name: PLEX_CLAIM
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.pms.claimSecret.name }}
|
|
key: {{ .Values.pms.claimSecret.key }}
|
|
{{- end }}
|
|
{{- if .Values.pms.gpu.nvidia.enabled }}
|
|
- name: NVIDIA_VISIBLE_DEVICES
|
|
value: all
|
|
- name: NVIDIA_DRIVER_CAPABILITIES
|
|
value: compute,video,utility
|
|
{{- end }}
|
|
{{- with .Values.pms.livenessProbe }}
|
|
livenessProbe:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.pms.readinessProbe }}
|
|
readinessProbe:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.pms.resources }}
|
|
resources:
|
|
limits:
|
|
{{- with .limits }}
|
|
{{ toYaml . | indent 12 | trim }}
|
|
{{- end }}
|
|
{{- if and $.Values.pms.gpu.nvidia.enabled (not (hasKey .limits "nvidia.com/gpu")) }}
|
|
nvidia.com/gpu: 1
|
|
{{- end }}
|
|
{{- if .requests }}
|
|
requests:
|
|
{{ toYaml .requests | indent 12 | trim }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.pms.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: pms-config
|
|
mountPath: /config
|
|
- name: pms-transcode
|
|
mountPath: /transcode
|
|
{{- if and .Values.rclone.enabled .Values.rclone.configSecret }}
|
|
{{- range .Values.rclone.remotes }}
|
|
- name: rclone-media-{{ (split ":" .)._0 }}
|
|
mountPath: "/data/{{ (split ":" .)._0 }}"
|
|
mountPropagation: HostToContainer
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{ toYaml .Values.extraVolumeMounts | indent 8 }}
|
|
{{- end }}
|
|
{{- if and .Values.rclone.enabled .Values.rclone.configSecret }}
|
|
{{- range .Values.rclone.remotes }}
|
|
- name: {{ include "pms-chart.fullname" $ }}-rclone-{{ (split ":" .)._0 }}
|
|
image: {{ include "pms-chart.rclone_image" $ }}
|
|
imagePullPolicy: {{ $.Values.rclone.image.pullPolicy }}
|
|
args:
|
|
- mount
|
|
- "{{ . }}"
|
|
- "/data/{{ (split ":" .)._0 }}"
|
|
- --config=/etc/rclone/rclone.conf
|
|
- --allow-non-empty
|
|
- --allow-other
|
|
{{- if $.Values.rclone.readOnly }}
|
|
- --read-only
|
|
{{- end }}
|
|
{{- range $.Values.rclone.additionalArgs }}
|
|
- {{ . }}
|
|
{{- end }}
|
|
{{- with $.Values.rclone.resources }}
|
|
resources:
|
|
{{ toYaml . | indent 10 }}
|
|
{{- end }}
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command: ["/bin/sh","-c","fusermount3 -uz /data/{{ (split ":" .)._0 }}"]
|
|
securityContext:
|
|
privileged: true
|
|
capabilities:
|
|
add:
|
|
- SYS_ADMIN
|
|
volumeMounts:
|
|
- name: rclone-config
|
|
mountPath: /etc/rclone
|
|
- name: rclone-media-{{ (split ":" .)._0 }}
|
|
mountPath: "/data/{{ (split ":" .)._0 }}"
|
|
mountPropagation: Bidirectional
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.extraContainers }}
|
|
{{- toYaml . | nindent 6 }}
|
|
{{- end }}
|
|
{{- if not .Values.pms.configExistingClaim }}
|
|
volumeClaimTemplates:
|
|
- apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: pms-config
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
{{- if .Values.pms.storageClassName }}
|
|
storageClassName: {{ .Values.pms.storageClassName }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.pms.configStorage }}
|
|
{{- end }}
|