Commit a78da653 authored by Waqar Ahmed's avatar Waqar Ahmed

Setup persistent storage for plex chart

parent 883fb239
...@@ -120,3 +120,125 @@ questions: ...@@ -120,3 +120,125 @@ questions:
description: "Create new pods and then kill old ones" description: "Create new pods and then kill old ones"
- value: "Recreate" - value: "Recreate"
description: "Kill existing pods before creating new ones" description: "Kill existing pods before creating new ones"
# Persistence
- variable: persistence
label: "Configure Persistent Storage"
group: "Storage"
schema:
type: dict
attrs:
- variable: transcode
label: "Configure Transcode Storage"
schema:
type: dict
attrs:
- variable: hostPathEnabled
label: "Configure Host Path for Transcode"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Specify HostPath for Transcode"
schema:
type: hostPath
required: true
- variable: volume
label: "Configure iXVolume"
schema:
type: dict
show_if: [["hostPathEnabled", "=", false]]
$ref:
- "normalize/ixVolume"
attrs:
- variable: mountPath
label: "Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/transcode"
- variable: datasetName
label: "Dataset Name"
schema:
type: string
default: "ix-plex_transcode"
editable: false
- variable: data
label: "Configure Data Storage"
schema:
type: dict
attrs:
- variable: hostPathEnabled
label: "Configure Host Path for Data"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Specify HostPath for Data"
schema:
type: hostPath
required: true
- variable: volume
label: "Configure iXVolume"
schema:
type: dict
show_if: [["hostPathEnabled", "=", false]]
$ref:
- "normalize/ixVolume"
attrs:
- variable: mountPath
label: "Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/data"
- variable: datasetName
label: "Dataset Name"
schema:
type: string
default: "ix-plex_data"
editable: false
- variable: config
label: "Configure Config Storage"
schema:
type: dict
attrs:
- variable: hostPathEnabled
label: "Configure Host Path for Config"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Specify HostPath for Config"
schema:
type: hostPath
required: true
- variable: volume
label: "Configure iXVolume"
schema:
type: dict
show_if: [["hostPathEnabled", "=", false]]
$ref:
- "normalize/ixVolume"
attrs:
- variable: mountPath
label: "Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/config"
- variable: datasetName
label: "Dataset Name"
schema:
type: string
default: "ix-plex_config"
editable: false
{{/*
Retrieve host path from ix volumes based on dataset name
*/}}
{{- define "retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- $hostPathConfiguration.hostPath -}}
{{- end -}}
{{- end }}
{{- end -}}
{{/*
Retrieve host path for transcode
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathTranscode" -}}
{{- if .Values.persistence.transcode.hostPathEnabled -}}
{{- .Values.persistence.transcode.hostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.persistence.transcode.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path for data
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathData" -}}
{{- if .Values.persistence.data.hostPathEnabled -}}
{{- .Values.persistence.data.hostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.persistence.data.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path for transcode
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathConfig" -}}
{{- if .Values.persistence.config.hostPathEnabled -}}
{{- .Values.persistence.config.hostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.persistence.config.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
...@@ -67,26 +67,6 @@ spec: ...@@ -67,26 +67,6 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: TRANSCODE_PVC
{{- if .Values.persistence.transcode.claimName }}
value: "{{ .Values.persistence.transcode.claimName }}"
{{- else }}
value: "{{ template "plex.fullname" . }}-transcode"
{{- end }}
{{- if .Values.persistence.data.enabled }}
- name: DATA_PVC
{{- if .Values.persistence.data.claimName }}
value: "{{ .Values.persistence.data.claimName }}"
{{- else }}
value: "{{ template "plex.fullname" . }}-data"
{{- end }}
{{- end }}
- name: CONFIG_PVC
{{- if .Values.persistence.config.claimName }}
value: "{{ .Values.persistence.config.claimName }}"
{{- else }}
value: "{{ template "plex.fullname" . }}-config"
{{- end }}
{{- if .Values.proxy.enabled }} {{- if .Values.proxy.enabled }}
{{- if .Values.proxy.http }} {{- if .Values.proxy.http }}
- name: "HTTP_PROXY" - name: "HTTP_PROXY"
...@@ -146,41 +126,12 @@ spec: ...@@ -146,41 +126,12 @@ spec:
failureThreshold: {{ .Values.probes.startup.failureThreshold }} failureThreshold: {{ .Values.probes.startup.failureThreshold }}
periodSeconds: {{ .Values.probes.startup.periodSeconds }} periodSeconds: {{ .Values.probes.startup.periodSeconds }}
volumeMounts: volumeMounts:
{{- if .Values.persistence.data.enabled }}
- name: data - name: data
mountPath: /data mountPath: /data
{{- if .Values.persistence.data.subPath }}
subPath: {{ .Values.persistence.data.subPath }}
{{ end }}
{{ end }}
- name: config - name: config
mountPath: /config mountPath: /config
{{- if .Values.persistence.config.subPath }}
subPath: {{ .Values.persistence.config.subPath }}
{{ end }}
- name: transcode - name: transcode
mountPath: /transcode mountPath: /transcode
{{- if .Values.persistence.transcode.subPath }}
subPath: {{ .Values.persistence.transcode.subPath }}
{{ end }}
{{- range .Values.persistence.extraData }}
- mountPath: "/data-{{ .name }}"
{{- if .subPath }}
subPath: {{ .subPath }}
{{ end }}
name: "extradata-{{ .name }}"
{{- end }}
{{- range .Values.persistence.extraMounts }}
{{- if .mountPath }}
- mountPath: /{{ .mountPath }}
{{- else }}
- mountPath: /{{ .name }}
{{- end }}
{{- if .subPath }}
subPath: {{ .subPath }}
{{ end }}
name: {{ .name }}
{{- end }}
- name: shared - name: shared
mountPath: /shared mountPath: /shared
- name: shared-logs - name: shared-logs
...@@ -190,63 +141,17 @@ spec: ...@@ -190,63 +141,17 @@ spec:
mountPath: {{ .Values.plexPreferences.volume.mountPath }} mountPath: {{ .Values.plexPreferences.volume.mountPath }}
subPath: {{ .Values.plexPreferences.volume.subPath }} subPath: {{ .Values.plexPreferences.volume.subPath }}
{{- end }} {{- end }}
{{- if .Values.certificate.pkcsMangler.enabled }}
- name: {{ .Values.certificate.pkcsMangler.volume.name }}
mountPath: {{ .Values.certificate.pkcsMangler.volume.mountPath }}
subPath: {{ .Values.certificate.pkcsMangler.volume.subPath }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
##### VOLUMES START ##### ##### VOLUMES START #####
volumes: volumes:
{{- if .Values.persistence.data.enabled }}
- name: data - name: data
persistentVolumeClaim: hostPath:
{{- if .Values.persistence.data.claimName }} path: {{ template "configuredHostPathData" }}
claimName: "{{ .Values.persistence.data.claimName }}"
{{- else }}
claimName: "{{ template "plex.fullname" . }}-data"
{{- end }}
{{- end }}
- name: config - name: config
persistentVolumeClaim: hostPath:
{{- if .Values.persistence.config.claimName }} path: {{ template "configuredHostPathConfig" }}
claimName: "{{ .Values.persistence.config.claimName }}"
{{- else }}
claimName: "{{ template "plex.fullname" . }}-config"
{{- end }}
- name: transcode - name: transcode
{{- if .Values.persistence.transcode.enabled }} hostPath:
persistentVolumeClaim: path: {{ template "configuredHostPathTranscode" }}
{{- if .Values.persistence.transcode.claimName }}
claimName: "{{ .Values.persistence.transcode.claimName }}"
{{- else }}
claimName: "{{ template "plex.fullname" . }}-transcode"
{{- end }}
{{- else }}
{{- if .Values.persistence.transcode.emptyDir.medium }}
emptyDir:
medium: "{{ .Values.persistence.transcode.emptyDir.medium }}"
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
{{- range .Values.persistence.extraData }}
- name: "extradata-{{ .name }}"
persistentVolumeClaim:
{{- if .claimName }}
claimName: "{{ .claimName }}"
{{- else }}
claimName: "extradata-{{ .name }}"
{{- end }}
{{- end }}
{{- range .Values.persistence.extraMounts }}
{{- if .claimName }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .claimName }}
{{- end }}
{{- end }}
- name: shared - name: shared
emptyDir: {} emptyDir: {}
- name: shared-logs - name: shared-logs
......
{{- if and (not .Values.persistence.transcode.claimName) .Values.persistence.transcode.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "plex.fullname" . }}-transcode
labels:
{{- include "plex.labels" . | nindent 4 }}
component: transcode
spec:
accessModes:
- {{ .Values.persistence.config.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.transcode.size | quote }}
{{- if .Values.persistence.transcode.storageClass }}
storageClassName: {{ .Values.persistence.transcode.storageClass | quote }}
{{- end }}
---
{{- end }}
{{- if not .Values.persistence.config.claimName }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "plex.fullname" . }}-config
labels:
{{- include "plex.labels" . | nindent 4 }}
component: config
spec:
accessModes:
- {{ .Values.persistence.config.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.config.size | quote }}
{{- if .Values.persistence.config.storageClass }}
storageClassName: {{ .Values.persistence.config.storageClass | quote }}
{{- end }}
---
{{- end }}
{{- if and (not .Values.persistence.data.claimName) .Values.persistence.data.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "plex.fullname" . }}-data
labels:
{{- include "plex.labels" . | nindent 4 }}
component: data
spec:
accessModes:
- {{ .Values.persistence.data.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.data.size | quote }}
{{- if .Values.persistence.data.storageClass }}
storageClassName: {{ .Values.persistence.data.storageClass | quote }}
{{- end }}
---
{{- end }}
...@@ -100,84 +100,11 @@ hostNetwork: false ...@@ -100,84 +100,11 @@ hostNetwork: false
persistence: persistence:
transcode: transcode:
# We want to enable a transcode pvc hostPathEnabled: false
enabled: false
# Optionally specify claimName to manually override the PVC to be used for
# the transcode directory. If claimName is specified, storageClass and size
# are ignored.
## claimName: "plex-transcode-pvc"
# Optionally specify a storage class to be used for the transcode directory.
# If not specified and claimName is not specified, the default storage
# class will be used.
storageClass: ""
# subPath: some-subpath
# The requested size of the volume to be used when creating a
# PersistentVolumeClaim.
size: 20Gi
# Access mode for this volume
accessMode: ReadWriteOnce
# If not using a transcode PVC, specify emptyDir.medium="Memory" to use a tmpfs (in-memory)
# Volume for /transcode. Warning! this will greatly increase the amount of memory the plex pod is using
# AND it will count toward any ram pod/namespace limits. Additionally all data will be lost if/when the
# pod is moved to another node. --set persistence.transcode.emptyDir.medium="Memory" `
emptyDir:
medium: ""
# medium: "Memory"
data: data:
# We want to enable a data pvc hostPathEnabled: false
enabled: true
# Optionally specify claimName to manually override the PVC to be used for
# the data directory. If claimName is specified, storageClass and size are
# ignored.
## claimName: "plex-data-pvc"
# Optionally specify a storage class to be used for the data directory.
# If not specified and claimName is not specified, the default storage
# class will be used.
storageClass: ""
# subPath: some-subpath
# The requested size of the volume to be used when creating a
# PersistentVolumeClaim.
size: 40Gi
# Access mode for this volume
accessMode: ReadWriteOnce
extraData: []
# Optionally specifify additional Data mounts. These will be mounted as
# /data-${name}. This should be in the same format as the above 'data',
# with the additional field 'name'
# - claimName: "special-tv"
# name: 'foo'
# subPath: optional/sub/path
extraMounts: []
## Include additional claims that can be mounted inside the
## pod. This is useful if you wish to use different paths with categories
## Claim will me mounted as /{mountPath} if specified. If no {mountPath} is given,
## mountPath will default to {name}
# - name: video
# # if claimName is specified the a new volume will mounted, if omitted the mount will be considered to be associated with one of the standard volumes (e.g data, config, transcode).
# # This useful to mount data to a different subPath
# claimName: optional-claim
# mountPath: /mnt/path/in/pod
# subPath: optional/sub/path
config: config:
# Optionally specify claimName to manually override the PVC to be used for hostPathEnabled: false
# the config directory. If claimName is specified, storageClass and size
# are ignored.
## claimName: "plex-config-pvc"
# Optionally specify a storage class to be used for the config directory.
# If not specified and claimName is not specified, the default storage
# class will be used.
# subPath: some-subpath
storageClass: ""
# The requested size of the volume to be used when creating a
# PersistentVolumeClaim.
size: 20Gi
# Access mode for this volume
accessMode: ReadWriteOnce
# Probes configuration # Probes configuration
probes: probes:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment