From 5032a2a98ee2e82c36fdfdc60bb634c7b8246b16 Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Mon, 14 Oct 2024 19:40:55 -0400 Subject: [PATCH 1/6] Copy all rclone keys into /etc/rclone, add easy gpu option --- .../templates/statefulset.yaml | 39 +++++++++++++++---- charts/plex-media-server/values.yaml | 13 ++++++- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/charts/plex-media-server/templates/statefulset.yaml b/charts/plex-media-server/templates/statefulset.yaml index 131a80c3..2b2be940 100644 --- a/charts/plex-media-server/templates/statefulset.yaml +++ b/charts/plex-media-server/templates/statefulset.yaml @@ -59,6 +59,12 @@ spec: defaultMode: 0700 name: {{ include "pms-chart.fullname" . }}-init-script {{- end }} + {{- if .Values.pms.gpu.nvidia.enabled }} + - name: nvidia + hostPath: + path: {{ .Values.pms.gpu.nvidia.device | default "/dev/nvidia0" }} + type: CharDevice + {{- end }} {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | indent 6 }} {{- end }} @@ -85,11 +91,10 @@ spec: - name: {{ include "pms-chart.fullname" . }}-config image: {{ include "pms-chart.init_image" . }} command: - - cp + - sh + - -c args: - - -v - - /in/rclone.conf - - /out/rclone.conf + - cp -v /in/* /out/ volumeMounts: - name: rclone-config-data mountPath: /in @@ -113,10 +118,26 @@ spec: - name: {{ $key }} value: {{ $value | quote }} {{- 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.resources }} resources: -{{ toYaml . | indent 10 }} - {{- end }} + 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 }} volumeMounts: - name: pms-config mountPath: /config @@ -129,6 +150,10 @@ spec: mountPropagation: HostToContainer {{- end }} {{- end }} + {{- if .Values.pms.gpu.nvidia.enabled }} + - name: nvidia + mountPath: {{ .Values.pms.gpu.nvidia.device | default "/dev/nvidia0" }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{ toYaml .Values.extraVolumeMounts | indent 8 }} {{- end }} @@ -164,7 +189,7 @@ spec: add: - SYS_ADMIN volumeMounts: - - name: rclone-config + - name: rclone-config-data mountPath: /etc/rclone - name: rclone-media-{{ (split ":" .)._0 }} mountPath: "/data/{{ (split ":" .)._0 }}" diff --git a/charts/plex-media-server/values.yaml b/charts/plex-media-server/values.yaml index 9930bc35..4f8584f3 100644 --- a/charts/plex-media-server/values.yaml +++ b/charts/plex-media-server/values.yaml @@ -36,6 +36,14 @@ pms: # NOTE: When set, 'configStorage' and 'storageClassName' are ignored. configExistingClaim: "" + # Enabling this will add nvidia.com/gpu: 1 to limits, will set + # environment for the nvidia operator, and will mount {device} into + # the container (default /dev/nvidia0) + gpu: + nvidia: + enabled: false + # device: /dev/nvidia0 + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -101,7 +109,10 @@ rclone: pullPolicy: IfNotPresent # The name of the secret that contains the rclone configuration file. - # The key must be called `rclone.conf` in the secret + # The rclone config key must be called `rclone.conf` in the secret + # + # All keys in configSecret will be available in /etc/rclone/. This might + # be useful if other files are needed, such as a private key for sftp mode. configSecret: "" From 68f9a371266f35050c19b048b568365152457ebb Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Mon, 14 Oct 2024 19:48:22 -0400 Subject: [PATCH 2/6] Make volume comment more relevant --- charts/plex-media-server/values.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/charts/plex-media-server/values.yaml b/charts/plex-media-server/values.yaml index 4f8584f3..e97ef095 100644 --- a/charts/plex-media-server/values.yaml +++ b/charts/plex-media-server/values.yaml @@ -200,15 +200,16 @@ extraEnv: {} # Optionally specify additional volume mounts for the PMS and init containers. extraVolumeMounts: [] # extraVolumeMounts: -# - name: some-volume-name -# mountPath: /path/in/container - +# - name: dev-dri +# mountPath: /dev/dri # Optionally specify additional volumes for the pod. extraVolumes: [] # extraVolumes: -# - name: some-volume-name -# emptyDir: {} +# - name: dev-dri +# hostPath: +# path: /dev/dri +# type: Directory extraContainers: [] # extraContainers: From 22c01ddb5e27f46162ede2379c315d2c7d1537ac Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Mon, 14 Oct 2024 21:14:52 -0400 Subject: [PATCH 3/6] restore original volume mount --- charts/plex-media-server/templates/statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/plex-media-server/templates/statefulset.yaml b/charts/plex-media-server/templates/statefulset.yaml index 2b2be940..bffbb543 100644 --- a/charts/plex-media-server/templates/statefulset.yaml +++ b/charts/plex-media-server/templates/statefulset.yaml @@ -189,7 +189,7 @@ spec: add: - SYS_ADMIN volumeMounts: - - name: rclone-config-data + - name: rclone-config mountPath: /etc/rclone - name: rclone-media-{{ (split ":" .)._0 }} mountPath: "/data/{{ (split ":" .)._0 }}" From 4e34c11ab045f811d2c8d2e5c76c29b64f3118ac Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Tue, 15 Oct 2024 08:47:07 -0400 Subject: [PATCH 4/6] bump chart version, remove unnecessary device mount --- charts/plex-media-server/Chart.yaml | 2 +- charts/plex-media-server/templates/statefulset.yaml | 10 ---------- charts/plex-media-server/values.yaml | 6 ++---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/charts/plex-media-server/Chart.yaml b/charts/plex-media-server/Chart.yaml index ed4575de..63783c1c 100644 --- a/charts/plex-media-server/Chart.yaml +++ b/charts/plex-media-server/Chart.yaml @@ -22,7 +22,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.0 +version: 0.4.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/plex-media-server/templates/statefulset.yaml b/charts/plex-media-server/templates/statefulset.yaml index bffbb543..eb3d863a 100644 --- a/charts/plex-media-server/templates/statefulset.yaml +++ b/charts/plex-media-server/templates/statefulset.yaml @@ -59,12 +59,6 @@ spec: defaultMode: 0700 name: {{ include "pms-chart.fullname" . }}-init-script {{- end }} - {{- if .Values.pms.gpu.nvidia.enabled }} - - name: nvidia - hostPath: - path: {{ .Values.pms.gpu.nvidia.device | default "/dev/nvidia0" }} - type: CharDevice - {{- end }} {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | indent 6 }} {{- end }} @@ -150,10 +144,6 @@ spec: mountPropagation: HostToContainer {{- end }} {{- end }} - {{- if .Values.pms.gpu.nvidia.enabled }} - - name: nvidia - mountPath: {{ .Values.pms.gpu.nvidia.device | default "/dev/nvidia0" }} - {{- end }} {{- if .Values.extraVolumeMounts }} {{ toYaml .Values.extraVolumeMounts | indent 8 }} {{- end }} diff --git a/charts/plex-media-server/values.yaml b/charts/plex-media-server/values.yaml index e97ef095..05503c16 100644 --- a/charts/plex-media-server/values.yaml +++ b/charts/plex-media-server/values.yaml @@ -36,13 +36,11 @@ pms: # NOTE: When set, 'configStorage' and 'storageClassName' are ignored. configExistingClaim: "" - # Enabling this will add nvidia.com/gpu: 1 to limits, will set - # environment for the nvidia operator, and will mount {device} into - # the container (default /dev/nvidia0) + # Enabling this will add nvidia.com/gpu: 1 to limits, and will set + # environment for the nvidia operator gpu: nvidia: enabled: false - # device: /dev/nvidia0 resources: {} # We usually recommend not to specify default resources and to leave this as a conscious From da0e17a040110e03560529a24a6938a76926accc Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Tue, 15 Oct 2024 08:55:52 -0400 Subject: [PATCH 5/6] update README --- charts/plex-media-server/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/plex-media-server/README.md b/charts/plex-media-server/README.md index 6a0f7794..748c15b8 100644 --- a/charts/plex-media-server/README.md +++ b/charts/plex-media-server/README.md @@ -106,6 +106,7 @@ The following table lists the configurable parameters of the Pms-chart chart and | `ingress.annotations` | Extra annotations to add to the ingress. | `{}` | | `pms.storageClassName` | The storage class that will be used for the PMS configuration directory, if not specified the default will be used | `null` | | `pms.configStorage` | The amount of storage space that is allocated to the config volume, this will probably need to be much higher if thumbnails are enabled. | `"2Gi"` | +| `pms.gpu.nvidia.enabled` | Enabling this will add nvidia.com/gpu: 1 to limits, and will set environment for the nvidia operator | `false` | | `pms.resources` | | `{}` | | `initContainer.image.registry` | The registry that should be used to pull the image from | `"index.docker.io"` | | `initContainer.image.repository` | The docker repo that will be used for the init image to run the setup scripts| `"alpine"` | From e1dccc3d2bc208d0b6171fbbf8d2cefb6361822f Mon Sep 17 00:00:00 2001 From: Marshall Asch Date: Tue, 29 Oct 2024 14:06:38 -0400 Subject: [PATCH 6/6] chore: set the minor version bump Co-authored-by: Gaston Festari --- charts/plex-media-server/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/plex-media-server/Chart.yaml b/charts/plex-media-server/Chart.yaml index 63783c1c..a86fef98 100644 --- a/charts/plex-media-server/Chart.yaml +++ b/charts/plex-media-server/Chart.yaml @@ -22,7 +22,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.1 +version: 0.5.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to