Skip to content

Commit

Permalink
Merge pull request #19 from kenmccann/master
Browse files Browse the repository at this point in the history
Refactored to allow for adding a custom volume as an alternative to PV/PVC
  • Loading branch information
kubealex authored Jan 2, 2022
2 parents 836944b + f61a40e commit 9547d5a
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The CR is quite simple to configure, and I tried to keep the number of parameter
| general.pgid | The GID for the process | 1000 |
| general.puid | The UID for the process | 1000 |
| general.nodeSelector | Node Selector for all the pods | {} |
| general.storage.customVolume | Flag if you want to supply your own volume and not use a PVC | false |
| general.storage.pvcName | Name of the persistenVolumeClaim configured in deployments | mediaserver-pvc |
| general.storage.pvcStorageClass | Specifies a storageClass for the PVC | "" |
| general.storage.size | Size of the persistenVolume | 50Gi |
Expand All @@ -85,6 +86,7 @@ The CR is quite simple to configure, and I tried to keep the number of parameter
| general.storage.subPaths.transmission | Default subpath for transmission downloads on used storage | general.storage.subPaths.downloads/transmission |
| general.storage.subPaths.sabnzbd | Default subpath for sabnzbd downloads on used storage | general.storage.subPaths.downloads/sabnzbd |
| general.storage.subPaths.config | Default subpath for all config files on used storage | config |
| general.storage.volumes | Supply custom volume to be mounted for all services | {} |

# Plex

Expand Down
5 changes: 5 additions & 0 deletions helm-charts/k8s-mediaserver/templates/jackett-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
- name: init-files-jackett
configMap:
defaultMode: 493
Expand Down
7 changes: 6 additions & 1 deletion helm-charts/k8s-mediaserver/templates/plex-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ spec:
app: plex
spec:
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
containers:
- name: {{ .Chart.Name }}
envFrom:
Expand Down Expand Up @@ -137,4 +142,4 @@ spec:
port:
number: {{ .Values.plex.service.port }}
{{ end }}
{{ end }}
{{ end }}
5 changes: 5 additions & 0 deletions helm-charts/k8s-mediaserver/templates/radarr-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
- name: init-files-radarr
configMap:
defaultMode: 493
Expand Down
14 changes: 8 additions & 6 deletions helm-charts/k8s-mediaserver/templates/sabnzbd-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data:
api_key = 7a50bedb4f764603bab47212c7a16ec4
nzb_key = c7378d3a9b024117baacb21de005b1a6
permissions = ""
download_dir = /{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.sabnzbd }}/incomplete-downloads
download_dir = /{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.sabnzbd }}/incomplete
download_free = ""
complete_dir = /{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.sabnzbd }}/complete
complete_free = ""
Expand Down Expand Up @@ -387,18 +387,20 @@ spec:
subPath: "{{ .Values.general.storage.subPaths.config }}/sabnzbd"
- name: mediaserver-volume
mountPath: "/downloads"
subPath: "{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.sabnzbd }}/complete"
- name: mediaserver-volume
mountPath: "/incomplete-downloads"
subPath: "{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.sabnzbd }}/incomplete"
subPath: "{{ .Values.general.storage.subPaths.downloads }}"
{{- with .Values.sabnzbd.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
- name: init-files-sabnzbd
configMap:
defaultMode: 493
Expand Down Expand Up @@ -514,4 +516,4 @@ spec:
port:
number: {{ .Values.sabnzbd.service.http.port }}
{{ end }}
{{ end }}
{{ end }}
5 changes: 5 additions & 0 deletions helm-charts/k8s-mediaserver/templates/sonarr-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
- name: init-files-sonarr
configMap:
defaultMode: 493
Expand Down
4 changes: 3 additions & 1 deletion helm-charts/k8s-mediaserver/templates/storage-resources.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if not .Values.general.storage.customVolume }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -8,4 +9,5 @@ spec:
resources:
requests:
storage: {{ .Values.general.storage.size }}
storageClassName: {{ if (kindIs "invalid" .Values.general.storage.pvcStorageClass) }}""{{- else }}{{ .Values.general.storage.pvcStorageClass | quote }}{{- end }}
storageClassName: {{ if (kindIs "invalid" .Values.general.storage.pvcStorageClass) }}""{{- else }}{{ .Values.general.storage.pvcStorageClass | quote }}{{- end }}
{{ end }}
19 changes: 13 additions & 6 deletions helm-charts/k8s-mediaserver/templates/transmission-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ data:
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": true,
"download-dir": "/downloads/complete",
"download-dir": "/{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.transmission }}/complete",
"download-queue-enabled": true,
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/downloads/incomplete",
"incomplete-dir": "/{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.transmission }}/incomplete",
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"message-level": 2,
Expand Down Expand Up @@ -154,15 +154,20 @@ spec:
subPath: "{{ .Values.general.storage.subPaths.config }}/transmission"
- name: mediaserver-volume
mountPath: "/downloads"
subPath: "{{ .Values.general.storage.subPaths.downloads }}/{{ .Values.general.storage.subPaths.transmission }}"
subPath: "{{ .Values.general.storage.subPaths.downloads }}"
{{- with .Values.transmission.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
- name: init-files-transmission
configMap:
defaultMode: 493
Expand Down Expand Up @@ -230,7 +235,7 @@ spec:
selector:
app: transmission
---
{{ if .Values.transmission.service.extraLBService }}
{{ if .Values.transmission.service.utp.extraLBService }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -247,6 +252,8 @@ spec:
selector:
app: transmission
---
{{ end }}
{{ if .Values.transmission.service.peer.extraLBService }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -257,7 +264,7 @@ spec:
type: LoadBalancer
ports:
- port: {{ .Values.transmission.service.peer.port }}
targetPort: {{ .Values.transmission.container.peer.port }}
targetPort: {{ .Values.transmission.container.port.peer }}
protocol: TCP
name: trans-peer-tcp
selector:
Expand All @@ -273,7 +280,7 @@ spec:
type: LoadBalancer
ports:
- port: {{ .Values.transmission.service.peer.port }}
targetPort: {{ .Values.transmission.container.peer.port }}
targetPort: {{ .Values.transmission.container.port.peer }}
protocol: UDP
name: trans-peer-udp
selector:
Expand Down
6 changes: 5 additions & 1 deletion helm-charts/k8s-mediaserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ general:
puid: 1000
#GID to run the process with
pgid: 1000
#Name, size and SC of needed PVC
#Persistent storage selections and pathing
storage:
customVolume: false #set to true if not using a PVC (must provide volume below)
pvcName: mediaserver-pvc
size: 5Gi
pvcStorageClass: []
Expand All @@ -23,6 +24,9 @@ general:
transmission: transmission
sabnzbd: sabnzbd
config: config
volumes: {}
# hostPath:
# path: /mnt/share

sonarr:
enabled: true
Expand Down

0 comments on commit 9547d5a

Please sign in to comment.