[Sonarr][Change] Merge PVCs for tv and downloads into single PVC (#225)

* Merge PVCs for tv and downloads into single PVC

Signed-off-by: Thomas John Wesolowski <wojoinc@gmail.com>

* Add upgrading documentation to README

Signed-off-by: Thomas John Wesolowski <wojoinc@gmail.com>

* Add extraExistingClaims back in

Signed-off-by: Thomas John Wesolowski <wojoinc@gmail.com>
This commit is contained in:
Thomas John Wesolowski 2020-05-23 08:24:20 -05:00 committed by GitHub
parent 51f46209a2
commit f888b8c9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 113 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 2.0.0.5344-ls60 appVersion: 2.0.0.5344-ls60
description: Sonarr is a television show downloading client description: Sonarr is a television show downloading client
name: sonarr name: sonarr
version: 3.2.0 version: 4.0.0
keywords: keywords:
- sonarr - sonarr
- usenet - usenet

View File

@ -17,6 +17,19 @@ To install the chart with the release name `my-release`:
helm install --name my-release billimek/sonarr helm install --name my-release billimek/sonarr
``` ```
## Upgrading
Chart versions 3.2.0 and earlier used separate PVCs for Downloads and TV. This presented an issue where Sonarr would be unable to hard-link files between the /downloads and /tv directories when importing media. This is caused because each PVC is exposed to the pod as a separate filesystem. This resulted in Sonarr copying files rather than linking; using additional storage without the user's knowledge.
This chart now uses a single PVC for Downloads and TV. This means all of your media (and downloads) must be in, or be subdirectories of, a single directory. If upgrading from v1 of the chart, do the following:
1. [Uninstall](#uninstalling-the-chart) your current release
2. On your backing store, organize your media, ie. media/tv, 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 Sonarr's `Series Editor` under the `Series` tab. Simply select all series in your library, and use the editor to change the `Root Folder` and hit save.
## Uninstalling the Chart ## Uninstalling the Chart
To uninstall/delete the `my-release` deployment: To uninstall/delete the `my-release` deployment:
@ -32,7 +45,7 @@ The command removes all the Kubernetes components associated with the chart and
The following tables lists the configurable parameters of the Sentry chart and their default values. The following tables lists the configurable parameters of the Sentry chart and their default values.
| Parameter | Description | Default | | Parameter | Description | Default |
|---------------------------------------------|----------------------------------------------------------------------------------------------|------------------------------------------------| | ------------------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `image.repository` | Image repository | `linuxserver/sonarr` | | `image.repository` | Image repository | `linuxserver/sonarr` |
| `image.tag` | Image tag. Possible values listed [here](https://hub.docker.com/r/linuxserver/sonarr/tags/). | `2.0.0.5344-ls60` | | `image.tag` | Image tag. Possible values listed [here](https://hub.docker.com/r/linuxserver/sonarr/tags/). | `2.0.0.5344-ls60` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` | | `image.pullPolicy` | Image pull policy | `IfNotPresent` |
@ -78,18 +91,12 @@ The following tables lists the configurable parameters of the Sentry chart and t
| `persistence.config.storageClass` | Type of persistent volume claim | `-` | | `persistence.config.storageClass` | Type of persistent volume claim | `-` |
| `persistence.config.accessMode` | Persistence access mode | `ReadWriteOnce` | | `persistence.config.accessMode` | Persistence access mode | `ReadWriteOnce` |
| `persistence.config.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | | `persistence.config.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` |
| `persistence.downloads.enabled` | Use persistent volume for downloads | `true` | | `persistence.media.enabled` | Use persistent volume for media | `true` |
| `persistence.downloads.size` | Size of persistent volume claim | `10Gi` | | `persistence.media.size` | Size of persistent volume claim | `10Gi` |
| `persistence.downloads.existingClaim` | Use an existing PVC to persist data | `nil` | | `persistence.media.existingClaim` | Use an existing PVC to persist data | `nil` |
| `persistence.downloads.storageClass` | Type of persistent volume claim | `-` | | `persistence.media.storageClass` | Type of persistent volume claim | `-` |
| `persistence.downloads.accessMode` | Persistence access mode | `ReadWriteOnce` | | `persistence.media.accessMode` | Persistence access mode | `ReadWriteOnce` |
| `persistence.downloads.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` | | `persistence.media.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` |
| `persistence.tv.enabled` | Use persistent volume for tv show persistence | `true` |
| `persistence.tv.size` | Size of persistent volume claim | `10Gi` |
| `persistence.tv.existingClaim` | Use an existing PVC to persist data | `nil` |
| `persistence.tv.storageClass` | Type of persistent volume claim | `-` |
| `persistence.tv.accessMode` | Persistence access mode | `ReadWriteOnce` |
| `persistence.tv.skipuninstall` | Do not delete the pvc upon helm uninstall | `false` |
| `persistence.extraExistingClaimMounts` | Optionally add multiple existing claims | `[]` | | `persistence.extraExistingClaimMounts` | Optionally add multiple existing claims | `[]` |
| `resources` | CPU/Memory resource requests/limits | `{}` | | `resources` | CPU/Memory resource requests/limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` | | `nodeSelector` | Node labels for pod assignment | `{}` |
@ -113,6 +120,7 @@ helm install --name my-release -f values.yaml stable/sonarr
``` ```
--- ---
**NOTE** **NOTE**
If you get `Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...` it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`. If you get `Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...` it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`.

View File

@ -66,15 +66,10 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /config - mountPath: /config
name: config name: config
- mountPath: /downloads - mountPath: /media
name: downloads name: media
{{- if .Values.persistence.downloads.subPath }} {{- if .Values.persistence.media.subPath }}
subPath: {{ .Values.persistence.downloads.subPath }} subPath: {{ .Values.persistence.media.subPath }}
{{- end }}
- mountPath: /tv
name: tv
{{- if .Values.persistence.tv.subPath }}
subPath: {{ .Values.persistence.tv.subPath }}
{{- end }} {{- end }}
{{- range .Values.persistence.extraExistingClaimMounts }} {{- range .Values.persistence.extraExistingClaimMounts }}
- name: {{ .name }} - name: {{ .name }}
@ -129,17 +124,10 @@ spec:
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}
- name: downloads - name: media
{{- if .Values.persistence.downloads.enabled }} {{- if .Values.persistence.media.enabled }}
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ if .Values.persistence.downloads.existingClaim }}{{ .Values.persistence.downloads.existingClaim }}{{- else }}{{ template "sonarr.fullname" . }}-downloads{{- end }} claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "sonarr.fullname" . }}-media{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: tv
{{- if .Values.persistence.tv.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.tv.existingClaim }}{{ .Values.persistence.tv.existingClaim }}{{- else }}{{ template "sonarr.fullname" . }}-tv{{- end }}
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}

View File

@ -1,29 +0,0 @@
{{- if and .Values.persistence.downloads.enabled (not .Values.persistence.downloads.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "sonarr.fullname" . }}-downloads
{{- if .Values.persistence.downloads.skipuninstall }}
annotations:
"helm.sh/resource-policy": keep
{{- end }}
labels:
app.kubernetes.io/name: {{ include "sonarr.name" . }}
helm.sh/chart: {{ include "sonarr.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 -}}

View File

@ -0,0 +1,29 @@
{{- if and .Values.persistence.media.enabled (not .Values.persistence.media.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "sonarr.fullname" . }}-media
{{- if .Values.persistence.media.skipuninstall }}
annotations:
"helm.sh/resource-policy": keep
{{- end }}
labels:
app.kubernetes.io/name: {{ include "sonarr.name" . }}
helm.sh/chart: {{ include "sonarr.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 -}}

View File

@ -1,29 +0,0 @@
{{- if and .Values.persistence.tv.enabled (not .Values.persistence.tv.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "sonarr.fullname" . }}-tv
{{- if .Values.persistence.tv.skipuninstall }}
annotations:
"helm.sh/resource-policy": keep
{{- end }}
labels:
app.kubernetes.io/name: {{ include "sonarr.name" . }}
helm.sh/chart: {{ include "sonarr.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
accessModes:
- {{ .Values.persistence.tv.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.tv.size | quote }}
{{- if .Values.persistence.tv.storageClass }}
{{- if (eq "-" .Values.persistence.tv.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.tv.storageClass }}"
{{- end }}
{{- end }}
{{- end -}}

View File

@ -101,28 +101,9 @@ persistence:
size: 1Gi size: 1Gi
## Do not delete the pvc upon helm uninstall ## Do not delete the pvc upon helm uninstall
skipuninstall: false skipuninstall: false
downloads: media:
enabled: true enabled: true
## sonarr downloads volume configuration ## sonarr media volume configuration
## If defined, storageClassName: <storageClass>
## 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
tv:
enabled: true
## Directory where televion shows are persisted
## If defined, storageClassName: <storageClass> ## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning ## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is ## If undefined (the default) or set to null, no storageClassName spec is