From a80fa0d800d91126a0d87fc28933d336fbbaaabe Mon Sep 17 00:00:00 2001 From: Thomas John Wesolowski Date: Sat, 23 May 2020 08:25:18 -0500 Subject: [PATCH] [Lidarr][Change] Merge downloads and music PVCs (#227) * Merge music and downloads into single PVC Signed-off-by: Thomas John Wesolowski * Add upgrading section to README Signed-off-by: Thomas John Wesolowski --- charts/lidarr/Chart.yaml | 2 +- charts/lidarr/README.md | 31 +++++++++++++--------- charts/lidarr/templates/deployment.yaml | 26 +++++------------- charts/lidarr/templates/downloads-pvc.yaml | 29 -------------------- charts/lidarr/templates/media-pvc.yaml | 29 ++++++++++++++++++++ charts/lidarr/templates/music-pvc.yaml | 29 -------------------- charts/lidarr/values.yaml | 23 ++-------------- 7 files changed, 58 insertions(+), 111 deletions(-) delete mode 100644 charts/lidarr/templates/downloads-pvc.yaml create mode 100644 charts/lidarr/templates/media-pvc.yaml delete mode 100644 charts/lidarr/templates/music-pvc.yaml diff --git a/charts/lidarr/Chart.yaml b/charts/lidarr/Chart.yaml index 4aa0c092..2c4af505 100644 --- a/charts/lidarr/Chart.yaml +++ b/charts/lidarr/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 0.7.1.1381-ls7 description: Looks and smells like Sonarr but made for music. name: lidarr -version: 1.0.1 +version: 2.0.0 keywords: - lidarr - usenet diff --git a/charts/lidarr/README.md b/charts/lidarr/README.md index f87f45d0..fb4f6072 100644 --- a/charts/lidarr/README.md +++ b/charts/lidarr/README.md @@ -17,6 +17,19 @@ To install the chart with the release name `my-release`: helm install --name my-release billimek/lidarr ``` +## Upgrading + +Chart versions 1.0.1 and earlier used separate PVCs for Downloads and Music. This presented an issue where Lidarr would be unable to hard-link files between the /downloads and /music directories when importing media. This is caused because each PVC is exposed to the pod as a separate filesystem. This resulted in Lidarr copying files rather than linking; using additional storage without the user's knowledge. + +This chart now uses a single PVC for Downloads and Music. This means all of your media (and downloads) must be in, or be subdirectories of, a single directory. If upgrading from an earlier version of the chart, do the following: + +1. [Uninstall](#uninstalling-the-chart) your current release +2. On your backing store, organize your media, ie. media/music, media/downloads +3. If using a pre-existing PVC, create a single new PVC for all of your media +4. Refer to the [configuration](#configuration) for updates to the chart values +5. Re-install the chart +6. Update your settings in the app to point to the new PVC, which is mounted at /media. This can be done using Lidarr's `Mass Editor` under the `Library` tab. Simply select all artists in your library, and use the editor to change the `Root Folder` and hit save. + ## Uninstalling the Chart To uninstall/delete the `my-release` deployment: @@ -64,18 +77,12 @@ The following tables lists the configurable parameters of the Sentry chart and t | `persistence.config.storageClass` | Type of persistent volume claim | `-` | | `persistence.config.accessMode` | Persistence access mode | `ReadWriteOnce` | | `persistence.config.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | -| `persistence.downloads.enabled` | Use persistent volume to store configuration data | `true` | -| `persistence.downloads.size` | Size of persistent volume claim | `10Gi` | -| `persistence.downloads.existingClaim`| Use an existing PVC to persist data | `nil` | -| `persistence.downloads.storageClass` | Type of persistent volume claim | `-` | -| `persistence.downloads.accessMode` | Persistence access mode | `ReadWriteOnce` | -| `persistence.downloads.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | -| `persistence.music.enabled` | Use persistent volume to store configuration data | `true` | -| `persistence.music.size` | Size of persistent volume claim | `10Gi` | -| `persistence.music.existingClaim`| Use an existing PVC to persist data | `nil` | -| `persistence.music.storageClass` | Type of persistent volume claim | `-` | -| `persistence.music.accessMode` | Persistence access mode | `ReadWriteOnce` | -| `persistence.music.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | +| `persistence.media.enabled` | Use persistent volume to store configuration data | `true` | +| `persistence.media.size` | Size of persistent volume claim | `10Gi` | +| `persistence.media.existingClaim`| Use an existing PVC to persist data | `nil` | +| `persistence.media.storageClass` | Type of persistent volume claim | `-` | +| `persistence.media.accessMode` | Persistence access mode | `ReadWriteOnce` | +| `persistence.media.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | | `persistence.extraExistingClaimMounts` | Optionally add multiple existing claims | `[]` | | `resources` | CPU/Memory resource requests/limits | `{}` | | `nodeSelector` | Node labels for pod assignment | `{}` | diff --git a/charts/lidarr/templates/deployment.yaml b/charts/lidarr/templates/deployment.yaml index 289e8a75..83ee0bcb 100644 --- a/charts/lidarr/templates/deployment.yaml +++ b/charts/lidarr/templates/deployment.yaml @@ -64,15 +64,10 @@ spec: volumeMounts: - mountPath: /config name: config - - mountPath: /downloads - name: downloads - {{- if .Values.persistence.downloads.subPath }} - subPath: {{ .Values.persistence.downloads.subPath }} - {{- end }} - - mountPath: /music - name: music - {{- if .Values.persistence.music.subPath }} - subPath: {{ .Values.persistence.music.subPath }} + - mountPath: /media + name: media + {{- if .Values.persistence.media.subPath }} + subPath: {{ .Values.persistence.media.subPath }} {{- end }} {{- range .Values.persistence.extraExistingClaimMounts }} - name: {{ .name }} @@ -89,17 +84,10 @@ spec: {{- else }} emptyDir: {} {{- end }} - - name: downloads - {{- if .Values.persistence.downloads.enabled }} + - name: media + {{- if .Values.persistence.media.enabled }} persistentVolumeClaim: - claimName: {{ if .Values.persistence.downloads.existingClaim }}{{ .Values.persistence.downloads.existingClaim }}{{- else }}{{ template "lidarr.fullname" . }}-downloads{{- end }} - {{- else }} - emptyDir: {} - {{- end }} - - name: music - {{- if .Values.persistence.music.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.music.existingClaim }}{{ .Values.persistence.music.existingClaim }}{{- else }}{{ template "lidarr.fullname" . }}-music{{- end }} + claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "lidarr.fullname" . }}-media{{- end }} {{- else }} emptyDir: {} {{- end }} diff --git a/charts/lidarr/templates/downloads-pvc.yaml b/charts/lidarr/templates/downloads-pvc.yaml deleted file mode 100644 index 5d25f2ce..00000000 --- a/charts/lidarr/templates/downloads-pvc.yaml +++ /dev/null @@ -1,29 +0,0 @@ - -{{- if and .Values.persistence.downloads.enabled (not .Values.persistence.downloads.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "lidarr.fullname" . }}-downloads - {{- if .Values.persistence.downloads.skipuninstall }} - annotations: - "helm.sh/resource-policy": keep - {{- end }} - labels: - app.kubernetes.io/name: {{ include "lidarr.name" . }} - helm.sh/chart: {{ include "lidarr.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.downloads.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.downloads.size | quote }} -{{- if .Values.persistence.downloads.storageClass }} -{{- if (eq "-" .Values.persistence.downloads.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.downloads.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/charts/lidarr/templates/media-pvc.yaml b/charts/lidarr/templates/media-pvc.yaml new file mode 100644 index 00000000..17dc7d03 --- /dev/null +++ b/charts/lidarr/templates/media-pvc.yaml @@ -0,0 +1,29 @@ + +{{- if and .Values.persistence.media.enabled (not .Values.persistence.media.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "lidarr.fullname" . }}-media + {{- if .Values.persistence.media.skipuninstall }} + annotations: + "helm.sh/resource-policy": keep + {{- end }} + labels: + app.kubernetes.io/name: {{ include "lidarr.name" . }} + helm.sh/chart: {{ include "lidarr.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.media.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.media.size | quote }} +{{- if .Values.persistence.media.storageClass }} +{{- if (eq "-" .Values.persistence.media.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.media.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/lidarr/templates/music-pvc.yaml b/charts/lidarr/templates/music-pvc.yaml deleted file mode 100644 index 82fdf6e2..00000000 --- a/charts/lidarr/templates/music-pvc.yaml +++ /dev/null @@ -1,29 +0,0 @@ - -{{- if and .Values.persistence.music.enabled (not .Values.persistence.music.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "lidarr.fullname" . }}-music - {{- if .Values.persistence.music.skipuninstall }} - annotations: - "helm.sh/resource-policy": keep - {{- end }} - labels: - app.kubernetes.io/name: {{ include "lidarr.name" . }} - helm.sh/chart: {{ include "lidarr.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.music.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.music.size | quote }} -{{- if .Values.persistence.music.storageClass }} -{{- if (eq "-" .Values.persistence.music.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.music.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/charts/lidarr/values.yaml b/charts/lidarr/values.yaml index 95fa4a1b..75c20248 100644 --- a/charts/lidarr/values.yaml +++ b/charts/lidarr/values.yaml @@ -81,28 +81,9 @@ persistence: size: 1Gi ## Do not delete the pvc upon helm uninstall skipuninstall: false - downloads: + media: enabled: true - ## lidarr downloads volume configuration - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - # storageClass: "-" - ## - ## If you want to reuse an existing claim, you can pass the name of the PVC using - ## the existingClaim variable - # existingClaim: your-claim - # subPath: some-subpath - accessMode: ReadWriteOnce - size: 10Gi - ## Do not delete the pvc upon helm uninstall - skipuninstall: false - music: - enabled: true - ## Directory where music are persisted + ## lidarr media volume configuration ## If defined, storageClassName: ## If set to "-", storageClassName: "", which disables dynamic provisioning ## If undefined (the default) or set to null, no storageClassName spec is