From 17966e29271a4054d06b1b977881039788d09141 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 3 Feb 2021 17:43:58 +0500 Subject: [PATCH] Update plex chart format --- test/plex/1.0.1/migrations/migrate.py | 16 ++ test/plex/1.0.1/questions.yaml | 253 ++++++++++++---------- test/plex/1.0.1/templates/deployment.yaml | 45 +--- 3 files changed, 164 insertions(+), 150 deletions(-) create mode 100644 test/plex/1.0.1/migrations/migrate.py diff --git a/test/plex/1.0.1/migrations/migrate.py b/test/plex/1.0.1/migrations/migrate.py new file mode 100644 index 0000000000..d35e3a6aca --- /dev/null +++ b/test/plex/1.0.1/migrations/migrate.py @@ -0,0 +1,16 @@ +def migrate(values): + values['appVolumeMounts'] = { + 'transcode': { + 'hostPathEnabled': values['transcodeHostPathEnabled'], + **({'hostPath': values['transcodeHostPath']} if values.get('transcodeHostPath') else {}) + }, + 'config': { + 'hostPathEnabled': values['configHostPathEnabled'], + **({'hostPath': values['configHostPath']} if values.get('configHostPath') else {}) + }, + 'data': { + 'hostPathEnabled': values['dataHostPathEnabled'], + **({'hostPath': values['dataHostPath']} if values.get('dataHostPath') else {}) + }, + } + return values diff --git a/test/plex/1.0.1/questions.yaml b/test/plex/1.0.1/questions.yaml index 2107548760..9dba0e4288 100644 --- a/test/plex/1.0.1/questions.yaml +++ b/test/plex/1.0.1/questions.yaml @@ -141,117 +141,6 @@ questions: max: 65535 default: 32400 - - 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" - schema: - type: hostpath - required: true - - - variable: transcodeVolume - label: "Transcode Volume Defaults" - 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: "Transcode 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 - subquestions: - - variable: dataHostPath - label: "Specify HostPath for Data" - schema: - type: hostpath - required: true - - - variable: dataVolume - label: "Data Volume Defaults" - group: "Storage" - schema: - type: dict - show_if: [["dataHostPathEnabled", "=", 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: "Data 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" - schema: - type: hostpath - required: true - - - variable: configVolume - label: "Configuration Volume Defaults" - 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: path - editable: false - default: "/config" - - variable: datasetName - label: "Configuration Dataset Name" - schema: - type: string - default: "ix-plex_config" - editable: false - # Specify GPU configuration - variable: gpuConfiguration label: "GPU Configuration" @@ -260,3 +149,145 @@ questions: type: dict $ref: - "definitions/gpuConfiguration" + + - variable: appVolumeMounts + label: "Plex Storage" + group: "Storage" + schema: + type: dict + attrs: + - variable: transcode + label: "Transcode Volume" + schema: + type: dict + attrs: + - variable: datasetName + label: "Plex Transcode Volume Dataset Name" + schema: + type: string + $ref: + - "normalize/ixVolume" + show_if: [["hostPathEnabled", "=", false]] + default: "ix-plex_transcode" + editable: false + - variable: mountPath + label: "Plex Transcode Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/transcode" + - variable: hostPathEnabled + label: "Enable Host Path for Plex Transcode Volume" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: hostPath + label: "Host Path for Plex Transcode Volume" + schema: + type: hostpath + required: true + - variable: data + label: "Data Volume" + schema: + type: dict + attrs: + - variable: datasetName + label: "Plex Data Volume Dataset Name" + schema: + type: string + $ref: + - "normalize/ixVolume" + show_if: [["hostPathEnabled", "=", false]] + default: "ix-plex_data" + editable: false + - variable: mountPath + label: "Plex Data Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/data" + - variable: hostPathEnabled + label: "Enable Host Path for Plex Data Volume" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: hostPath + label: "Host Path for Plex Data Volume" + schema: + type: hostpath + required: true + - variable: config + label: "Config Volume" + schema: + type: dict + attrs: + - variable: datasetName + label: "Plex Config Volume Dataset Name" + schema: + type: string + $ref: + - "normalize/ixVolume" + show_if: [["hostPathEnabled", "=", false]] + default: "ix-plex_config" + editable: false + - variable: mountPath + label: "Plex Config Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/config" + - variable: hostPathEnabled + label: "Enable Host Path for Plex Config Volume" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: hostPath + label: "Host Path for Plex Config Volume" + schema: + type: hostpath + required: true + - variable: shared + label: "Shared Volume" + schema: + type: dict + attrs: + - variable: emptyDir + label: "Temporary Volume" + schema: + type: boolean + default: true + editable: false + - variable: mountPath + label: "Plex Shared Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/shared" + - variable: shared-logs + label: "Shared Logs Volume" + schema: + type: dict + attrs: + - variable: emptyDir + label: "Temporary Volume" + schema: + type: boolean + default: true + editable: false + - variable: mountPath + label: "Plex Shared Logs Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/config/Library/Application Support/Plex Media Server/Logs" diff --git a/test/plex/1.0.1/templates/deployment.yaml b/test/plex/1.0.1/templates/deployment.yaml index 6e74f64090..42626ced23 100644 --- a/test/plex/1.0.1/templates/deployment.yaml +++ b/test/plex/1.0.1/templates/deployment.yaml @@ -1,19 +1,8 @@ apiVersion: apps/v1 kind: Deployment -metadata: - name: {{ include "common.names.fullname" . }} - labels: {{ include "common.labels" . | nindent 4 }} -spec: - replicas: 1 - revisionHistoryLimit: 3 - strategy: - type: {{ .Values.strategyType }} - selector: - matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: {{ include "common.labels.selectorLabels" . | nindent 8 }} - annotations: {{ include "common.annotations" . | nindent 8 }} +{{ include "common.deployment.metadata" . | nindent 0 }} +spec: {{ include "common.deployment.common_spec" . | nindent 2 }} + template: {{ include "common.deployment.pod.metadata" . | nindent 4 }} spec: {{- if .Values.hostNetwork }} hostNetwork: {{ .Values.hostNetwork }} @@ -22,6 +11,8 @@ spec: containers: - name: {{ .Chart.Name }} {{ include "common.containers.imageConfig" .Values.image | nindent 10 }} + {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }} + {{ include "common.containers.gpuConfiguration" .Values | nindent 10 }} ports: - name: pms protocol: TCP @@ -77,28 +68,4 @@ spec: initialDelaySeconds: 5 failureThreshold: 40 periodSeconds: 15 - volumeMounts: - - name: data - mountPath: /data - - name: config - mountPath: /config - - name: transcode - mountPath: /transcode - - name: shared - mountPath: /shared - - name: shared-logs - mountPath: "/config/Library/Application Support/Plex Media Server/Logs" - {{- if .Values.gpuConfiguration }} - resources: - limits: - {{- toYaml .Values.gpuConfiguration | nindent 14 }} - {{- end }} - volumes: - {{ $emptyDir := .Values.emptyDirVolumes }} - {{ $vols := list }} - {{ $vols = mustAppend $vols (dict "name" "data" "emptyDirVolumes" $emptyDir "hostPathEnabled" .Values.dataHostPathEnabled "pathField" .Values.dataHostPath "datasetName" (.Values.dataVolume | default dict).datasetName ) }} - {{ $vols = mustAppend $vols (dict "name" "config" "emptyDirVolumes" $emptyDir "hostPathEnabled" .Values.configHostPathEnabled "pathField" .Values.configHostPath "datasetName" (.Values.configVolume | default dict).datasetName ) }} - {{ $vols = mustAppend $vols (dict "name" "transcode" "emptyDirVolumes" $emptyDir "hostPathEnabled" .Values.transcodeHostPathEnabled "pathField" .Values.transcodeHostPath "datasetName" (.Values.transcodeVolume | default dict).datasetName ) }} - {{ $vols = mustAppend $vols (dict "name" "shared" "emptyDirVolumes" true "hostPathEnabled" false "pathField" nil "datasetName" nil) }} - {{ $vols = mustAppend $vols (dict "name" "shared-logs" "emptyDirVolumes" true "hostPathEnabled" false "pathField" nil "datasetName" nil) }} - {{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8 }} +{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}