Bläddra i källkod

Properly setup persistence values

Waqar Ahmed 4 år sedan
förälder
incheckning
bd0a06c017

+ 106 - 114
test/plex/2.1.0/questions.yaml

@@ -144,127 +144,119 @@ questions:
             max: 65535
             default: 32400
 
-  # Persistence
-  - variable: persistence
-    label: "Configure Persistent Storage"
+  - variable: transcodeHostPathEnabled
+    label: "Configure Host Path for Transcode"
+    group: "Storage"
+    schema:
+      type: boolean
+      default: false
+      show_subquestions_if: true
+      subquestions:
+        - variable: transcodeHostpath
+          label: "Specify HostPath for Transcode"
+          group: "Storage"
+          schema:
+            type: hostpath
+            required: true
+
+  - variable: transcodeVolume
+    label: "Configure iXVolume"
+    group: "Storage"
+    schema:
+      type: dict
+      show_if: [["transcodeHostPathEnabled", "=", false]]
+      $ref:
+        - "normalize/ixVolume"
+      attrs:
+        - variable: mountPath
+          label: "Mount Path"
+          description: "Path where the volume will be mounted inside the pod"
+          schema:
+            type: path
+            editable: false
+            default: "/transcode"
+        - variable: datasetName
+          label: "Dataset Name"
+          schema:
+            type: string
+            default: "ix-plex_transcode"
+            editable: false
+
+  - variable: dataHostPathEnabled
+    label: "Configure Host Path for Data"
+    group: "Storage"
+    schema:
+      type: boolean
+      default: false
+      show_subquestions_if: true
+      group: "Storage"
+      subquestions:
+        - variable: dataHostPath
+          label: "Specify HostPath for Data"
+          schema:
+            type: hostpath
+            required: true
+
+  - variable: dataVolume
+    label: "Configure data iXVolume"
     group: "Storage"
     schema:
       type: dict
+      show_if: [["dataHostPathEnabled", "=", false]]
+      $ref:
+        - "normalize/ixVolume"
       attrs:
-        - variable: transcode
-          label: "Configure Transcode Storage"
+        - variable: mountPath
+          label: "Mount Path"
+          description: "Path where the volume will be mounted inside the pod"
+          schema:
+            type: path
+            editable: false
+            default: "/data"
+        - variable: datasetName
+          label: "Dataset Name"
+          schema:
+            type: string
+            default: "ix-plex_data"
+            editable: false
+
+  - variable: configHostPathEnabled
+    label: "Configure Host Path for Config"
+    group: "Storage"
+    schema:
+      type: boolean
+      default: false
+      show_subquestions_if: true
+      subquestions:
+        - variable: configHostPath
+          label: "Specify HostPath for Config"
+          group: "Storage"
           schema:
-            type: dict
-            attrs:
-              - variable: hostPathEnabled
-                label: "Configure Host Path for Transcode"
-                schema:
-                  type: boolean
-                  default: false
-                  show_subquestions_if: true
-                  subquestions:
-                    - variable: hostPath
-                      label: "Specify HostPath for Transcode"
-                      schema:
-                        type: hostpath
-                        required: true
-              - variable: volume
-                label: "Configure iXVolume"
-                schema:
-                  type: dict
-                  show_if: [["hostPathEnabled", "=", false]]
-                  $ref:
-                    - "normalize/ixVolume"
-                  attrs:
-                    - variable: mountPath
-                      label: "Mount Path"
-                      description: "Path where the volume will be mounted inside the pod"
-                      schema:
-                        type: path
-                        editable: false
-                        default: "/transcode"
-                    - variable: datasetName
-                      label: "Dataset Name"
-                      schema:
-                        type: string
-                        default: "ix-plex_transcode"
-                        editable: false
-        - variable: data
-          label: "Configure Data Storage"
+            type: hostpath
+            required: true
+
+  - variable: configVolume
+    label: "Configure iXVolume"
+    group: "Storage"
+    schema:
+      type: dict
+      show_if: [["configHostPathEnabled", "=", false]]
+      $ref:
+        - "normalize/ixVolume"
+      attrs:
+        - variable: mountPath
+          label: "Mount Path"
+          description: "Path where the volume will be mounted inside the pod"
           schema:
-            type: dict
-            attrs:
-              - variable: hostPathEnabled
-                label: "Configure Host Path for Data"
-                schema:
-                  type: boolean
-                  default: false
-                  show_subquestions_if: true
-                  subquestions:
-                    - variable: hostPath
-                      label: "Specify HostPath for Data"
-                      schema:
-                        type: hostpath
-                        required: true
-              - variable: volume
-                label: "Configure iXVolume"
-                schema:
-                  type: dict
-                  show_if: [["hostPathEnabled", "=", false]]
-                  $ref:
-                    - "normalize/ixVolume"
-                  attrs:
-                    - variable: mountPath
-                      label: "Mount Path"
-                      description: "Path where the volume will be mounted inside the pod"
-                      schema:
-                        type: path
-                        editable: false
-                        default: "/data"
-                    - variable: datasetName
-                      label: "Dataset Name"
-                      schema:
-                        type: string
-                        default: "ix-plex_data"
-                        editable: false
-        - variable: config
-          label: "Configure Config Storage"
+            type: path
+            editable: false
+            default: "/config"
+        - variable: datasetName
+          label: "Dataset Name"
           schema:
-            type: dict
-            attrs:
-              - variable: hostPathEnabled
-                label: "Configure Host Path for Config"
-                schema:
-                  type: boolean
-                  default: false
-                  show_subquestions_if: true
-                  subquestions:
-                    - variable: hostPath
-                      label: "Specify HostPath for Config"
-                      schema:
-                        type: hostpath
-                        required: true
-              - variable: volume
-                label: "Configure iXVolume"
-                schema:
-                  type: dict
-                  show_if: [["hostPathEnabled", "=", false]]
-                  $ref:
-                    - "normalize/ixVolume"
-                  attrs:
-                    - variable: mountPath
-                      label: "Mount Path"
-                      description: "Path where the volume will be mounted inside the pod"
-                      schema:
-                        type: path
-                        editable: false
-                        default: "/config"
-                    - variable: datasetName
-                      label: "Dataset Name"
-                      schema:
-                        type: string
-                        default: "ix-plex_config"
-                        editable: false
+            type: string
+            default: "ix-plex_config"
+            editable: false
 
   # Specify GPU configuration
   - variable: gpuConfiguration

+ 9 - 9
test/plex/2.1.0/templates/_storage.tpl

@@ -15,10 +15,10 @@ Retrieve host path for transcode
 Let's please remove the redundancy
 */}}
 {{- define "configuredHostPathTranscode" -}}
-{{- if .Values.persistence.transcode.hostPathEnabled -}}
-{{- .Values.persistence.transcode.hostPath -}}
+{{- if .Values.transcodeHostPathEnabled -}}
+{{- .Values.transcodeHostPath -}}
 {{- else -}}
-{{- $volDict := dict "datasetName" $.Values.persistence.transcode.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
+{{- $volDict := dict "datasetName" $.Values.transcodeVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
 {{- include "retrieveHostPathFromiXVolume" $volDict -}}
 {{- end -}}
 {{- end -}}
@@ -28,10 +28,10 @@ Retrieve host path for data
 Let's please remove the redundancy
 */}}
 {{- define "configuredHostPathData" -}}
-{{- if .Values.persistence.data.hostPathEnabled -}}
-{{- .Values.persistence.data.hostPath -}}
+{{- if .Values.dataHostPathEnabled -}}
+{{- .Values.dataHostPath -}}
 {{- else -}}
-{{- $volDict := dict "datasetName" $.Values.persistence.data.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
+{{- $volDict := dict "datasetName" $.Values.dataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
 {{- include "retrieveHostPathFromiXVolume" $volDict -}}
 {{- end -}}
 {{- end -}}
@@ -41,10 +41,10 @@ Retrieve host path for transcode
 Let's please remove the redundancy
 */}}
 {{- define "configuredHostPathConfig" -}}
-{{- if .Values.persistence.config.hostPathEnabled -}}
-{{- .Values.persistence.config.hostPath -}}
+{{- if .Values.configHostPathEnabled -}}
+{{- .Values.configHostPath -}}
 {{- else -}}
-{{- $volDict := dict "datasetName" $.Values.persistence.config.volume.datasetName "ixVolumes" $.Values.ixVolumes -}}
+{{- $volDict := dict "datasetName" $.Values.configVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
 {{- include "retrieveHostPathFromiXVolume" $volDict -}}
 {{- end -}}
 {{- end -}}

+ 12 - 0
test/plex/2.1.0/templates/deployment.yaml

@@ -143,14 +143,26 @@ spec:
           {{- end }}
       volumes:
       - name: data
+        {{- if .Values.emptyDirVolumes }}
+        emptyDir: {}
+        {{- else }}
         hostPath:
           path: {{ template "configuredHostPathData" . }}
+        {{- end }}
       - name: config
+        {{- if .Values.emptyDirVolumes }}
+        emptyDir: {}
+        {{- else }}
         hostPath:
           path: {{ template "configuredHostPathConfig" . }}
+        {{- end }}
       - name: transcode
+        {{- if .Values.emptyDirVolumes }}
+        emptyDir: {}
+        {{- else }}
         hostPath:
           path: {{ template "configuredHostPathTranscode" . }}
+        {{- end }}
       - name: shared
         emptyDir: {}
       - name: shared-logs

+ 3 - 7
test/plex/2.1.0/values.yaml

@@ -57,13 +57,9 @@ plexServiceTCP:
 
 hostNetwork: false
 
-persistence:
-  transcode:
-    hostPathEnabled: false
-  data:
-    hostPathEnabled: false
-  config:
-    hostPathEnabled: false
+transcodeHostPathEnabled: false
+dataHostPathEnabled: false
+configHostPathEnabled: false
 
 proxy:
   # This allows to set a proxy environment variable, which PMS uses to fetch the token and assets like movie cover