From 402b64152f85ae879672187212c7a5a822d68bb8 Mon Sep 17 00:00:00 2001 From: Jon Ervine Date: Sat, 13 Feb 2021 21:38:04 +0800 Subject: [PATCH] Added PVC option --- nzbget/Chart.yaml | 2 +- nzbget/templates/deployment.yaml | 20 +++++++++----------- nzbget/values.yaml | 11 +++++++---- nzbhydra/Chart.yaml | 2 +- nzbhydra/templates/statefulset.yaml | 13 +++++++++++-- nzbhydra/values.yaml | 7 +++++-- 6 files changed, 34 insertions(+), 21 deletions(-) diff --git a/nzbget/Chart.yaml b/nzbget/Chart.yaml index a237680..2689ff7 100644 --- a/nzbget/Chart.yaml +++ b/nzbget/Chart.yaml @@ -14,7 +14,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. -version: 0.1.3 +version: 0.1.9 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/nzbget/templates/deployment.yaml b/nzbget/templates/deployment.yaml index ff30eb5..e1823c3 100644 --- a/nzbget/templates/deployment.yaml +++ b/nzbget/templates/deployment.yaml @@ -62,10 +62,17 @@ spec: claimName: {{ .Values.mediaPvc }} - name: local-download emptyDir: {} - {{- with .Values.nodeSelector }} + {{- if and .Values.config.persistence.enabled .Values.config.persistence.existingClaim }} + - name: nzbget-config + persistentVolumeClaim: + {{- with .Values.config.persistence.existingClaim }} + claimName: {{ tpl . $ }} + {{- end }} + {{- end }} + {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} @@ -74,12 +81,3 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumeClaimTemplates: - - metadata: - name: nzbget-config - spec: - accessModes: [ "ReadWriteOnce" ] - storageClassName: {{ .Values.config.storageClassName | quote }} - resources: - requests: - storage: {{ .Values.config.storageSize }} diff --git a/nzbget/values.yaml b/nzbget/values.yaml index 35abc2b..408c137 100644 --- a/nzbget/values.yaml +++ b/nzbget/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 image: repository: harbor.ervine.dev/public/x86_64/alpine/nzbget - tag: v21.0-3.13.0 + tag: v21.0-3.13.1 pullPolicy: Always imagePullSecrets: [] @@ -29,7 +29,7 @@ securityContext: # - ALL readOnlyRootFilesystem: true runAsNonRoot: true - runAsUser: 1003 + runAsUser: 1027 service: type: ClusterIP @@ -68,7 +68,10 @@ tolerations: [] affinity: {} config: - storageClassName: nfs-client-hermes - storageSize: 5Gi + persistence: + enabled: true + existingClaim: media-nzbget-hermes-config + storageClassName: nfs-client-hermes + storageSize: 5Gi mediaPvc: nzbget-hermes-media-pvc diff --git a/nzbhydra/Chart.yaml b/nzbhydra/Chart.yaml index f5e4ddc..d6ee7ba 100644 --- a/nzbhydra/Chart.yaml +++ b/nzbhydra/Chart.yaml @@ -14,7 +14,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. -version: 0.1.29 +version: 0.1.30 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/nzbhydra/templates/statefulset.yaml b/nzbhydra/templates/statefulset.yaml index 7c65bea..b853d89 100644 --- a/nzbhydra/templates/statefulset.yaml +++ b/nzbhydra/templates/statefulset.yaml @@ -53,6 +53,13 @@ spec: volumes: - name: hydra-tmp emptyDir: {} + {{- if and .Values.config.persistence.enabled .Values.config.persistence.existingClaim }} + - name: hydra-config + persistentVolumeClaim: + {{- with .Values.config.persistence.existingClaim }} + claimName: {{ tpl . $ }} + {{- end }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -65,12 +72,14 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if and .Values.config.persistence.enabled (not .Values.config.persistence.existingClaim) }} volumeClaimTemplates: - metadata: name: hydra-config spec: accessModes: [ "ReadWriteOnce" ] - storageClassName: {{ .Values.config.storageClassName | quote }} + storageClassName: {{ .Values.config.persistence.storageClassName | quote }} resources: requests: - storage: {{ .Values.config.storageSize }} + storage: {{ .Values.config.persistence.storageSize }} + {{- end -}} diff --git a/nzbhydra/values.yaml b/nzbhydra/values.yaml index 9639b50..1106cbb 100644 --- a/nzbhydra/values.yaml +++ b/nzbhydra/values.yaml @@ -67,5 +67,8 @@ tolerations: [] affinity: {} config: - storageClassName: nfs-client-hermes - storageSize: 10Gi + persistence: + enabled: true + existingClaim: media-nzbhydra-config + storageClassName: nfs-client-hermes + storageSize: 10Gi