Преглед на файлове

Update minio chart to use new format for storage

Waqar Ahmed преди 4 години
родител
ревизия
0d8d1111a0
променени са 4 файла, в които са добавени 50 реда и са изтрити 56 реда
  1. 10 0
      test/minio/1.0.1/migrations/migrate.py
  2. 34 30
      test/minio/1.0.1/questions.yaml
  3. 5 23
      test/minio/1.0.1/templates/deployment.yaml
  4. 1 3
      test/plex/1.0.1/templates/deployment.yaml

+ 10 - 0
test/minio/1.0.1/migrations/migrate.py

@@ -0,0 +1,10 @@
+def migrate(values):
+    values.update({
+        'appVolumeMounts': {
+            'export': {
+                'hostPathEnabled': values['minioHostPathEnabled'],
+                **({'hostPath': values['minioHostPath']} if values.get('minioHostPath') else {})
+            },
+        },
+    })
+    return values

+ 34 - 30
test/minio/1.0.1/questions.yaml

@@ -138,38 +138,42 @@ questions:
             default: 9000
             required: true
 
-  - variable: minioHostPathEnabled
-    label: "Configure Host Path for Minio data"
-    group: "Storage"
-    schema:
-      type: boolean
-      default: false
-      show_subquestions_if: true
-      subquestions:
-        - variable: minioHostPath
-          label: "Specify HostPath for Minio data"
-          schema:
-            type: hostpath
-
-  - variable: minioDataVolume
-    label: "Minio Data Volume Defaults"
+  - variable: appVolumeMounts
+    label: "Minio Storage"
     group: "Storage"
     schema:
       type: dict
-      $ref:
-        - "normalize/ixVolume"
-      show_if: [["minioHostPathEnabled", "=", false]]
       attrs:
-        - variable: mountPath
-          label: "Minio Data Mount Path"
-          description: "Path where the volume will be mounted inside the pod"
-          schema:
-            type: path
-            editable: false
-            default: "/export"
-        - variable: datasetName
-          label: "Minio Dataset Name"
+        - variable: export
+          label: "Data Volume"
           schema:
-            type: string
-            default: "ix-minio"
-            editable: false
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Minio Data Volume Dataset Name"
+                schema:
+                  type: string
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [["hostPathEnabled", "=", false]]
+                  default: "ix-minio"
+                  editable: false
+              - variable: mountPath
+                label: "Minio Data Mount Path"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  editable: false
+                  default: "/export"
+              - variable: hostPathEnabled
+                label: "Enable Host Path for Minio Data Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Minio Data Volume"
+                      schema:
+                        type: hostpath
+                        required: true

+ 5 - 23
test/minio/1.0.1/templates/deployment.yaml

@@ -1,32 +1,17 @@
 {{ $scheme := "http" }}
-apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
-kind: Deployment
-metadata:
-  name: {{ template "common.names.fullname" . }}
-  labels: {{ include "common.labels" . | nindent 4 }}
-spec:
-  strategy:
-    type: {{ .Values.updateStrategy }}
-  selector:
-    matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
-  template:
-    metadata:
-      name: {{ template "common.names.fullname" . }}
-      labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
-      annotations:
-        checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
+{{ include "common.deployment.common_config" . | nindent 0 }}
+spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
+  template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
     spec:
       serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
       containers:
         - name: {{ .Chart.Name }}
           {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
+          {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
           command:
             - "/bin/sh"
             - "-ce"
             - "/usr/bin/docker-entrypoint.sh minio server /export {{ (.Values.extraArgs | default list) | join " " }}"
-          volumeMounts:
-            - name: export
-              mountPath: /export
           ports:
             - name: {{ $scheme }}
               containerPort: 9000
@@ -36,7 +21,4 @@ spec:
             {{ $envList = mustAppend $envList (dict "name" "MINIO_ACCESS_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
             {{ $envList = mustAppend $envList (dict "name" "MINIO_SECRET_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
             {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
-      volumes:
-        {{ $vols := list }}
-        {{ $vols = mustAppend $vols (dict "name" "export" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" .Values.minioHostPathEnabled "pathField" .Values.minioHostPath "datasetName" (.Values.minioDataVolume | default dict).datasetName ) }}
-        {{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8 }}
+{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}

+ 1 - 3
test/plex/1.0.1/templates/deployment.yaml

@@ -1,6 +1,4 @@
-apiVersion: apps/v1
-kind: Deployment
-{{ include "common.deployment.metadata" . | nindent 0 }}
+{{ include "common.deployment.common_config" . | nindent 0 }}
 spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
   template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
     spec: