From 7d54cef34e96ed1847f72686c866502ba2e70440 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 9 Dec 2020 04:35:07 +0500 Subject: [PATCH] Add persistent storage support for minio --- test/minio/8.0.5/README.md | 73 ---------------------- test/minio/8.0.5/questions.yaml | 18 +++--- test/minio/8.0.5/templates/_storage.tpl | 23 +++++++ test/minio/8.0.5/templates/deployment.yaml | 13 ++-- test/minio/8.0.5/templates/pvc.yaml | 28 --------- test/minio/8.0.5/values.yaml | 38 ----------- 6 files changed, 36 insertions(+), 157 deletions(-) create mode 100644 test/minio/8.0.5/templates/_storage.tpl delete mode 100644 test/minio/8.0.5/templates/pvc.yaml diff --git a/test/minio/8.0.5/README.md b/test/minio/8.0.5/README.md index dde5f41722f..e1eaee76058 100755 --- a/test/minio/8.0.5/README.md +++ b/test/minio/8.0.5/README.md @@ -12,79 +12,6 @@ Introduction This chart bootstraps MinIO deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. -Prerequisites -------------- - -- Kubernetes 1.4+ with Beta APIs enabled for default standalone mode. -- Kubernetes 1.5+ with Beta APIs enabled to run MinIO in [distributed mode](#distributed-minio). -- PV provisioner support in the underlying infrastructure. - -Configure MinIO Helm repo --------------------- -```bash -$ helm repo add minio https://helm.min.io/ -``` - -Installing the Chart --------------------- - -Install this chart using: - -```bash -$ helm install --namespace minio --generate-name minio/minio -``` - -The command deploys MinIO on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. - -### Release name - -An instance of a chart running in a Kubernetes cluster is called a release. Each release is identified by a unique name within the cluster. Helm automatically assigns a unique release name after installing the chart. You can also set your preferred name by: - -```bash -$ helm install my-release minio/minio -``` - -### Access and Secret keys - -By default a pre-generated access and secret key will be used. To override the default keys, pass the access and secret keys as arguments to helm install. - -```bash -$ helm install --set accessKey=myaccesskey,secretKey=mysecretkey --generate-name minio/minio -``` - -Uninstalling the Chart ----------------------- - -Assuming your release is named as `my-release`, delete it using the command: - -```bash -$ helm delete my-release -``` - -or - -```bash -$ helm uninstall my-release -``` - -The command removes all the Kubernetes components associated with the chart and deletes the release. - -Upgrading the Chart -------------------- - -You can use Helm to update MinIO version in a live release. Assuming your release is named as `my-release`, get the values using the command: - -```bash -$ helm get values my-release > old_values.yaml -``` - -Then change the field `image.tag` in `old_values.yaml` file with MinIO image tag you want to use. Now update the chart using - -```bash -$ helm upgrade -f old_values.yaml my-release minio/minio -``` - -Default upgrade strategies are specified in the `values.yaml` file. Update these fields if you'd like to use a different strategy. Configuration ------------- diff --git a/test/minio/8.0.5/questions.yaml b/test/minio/8.0.5/questions.yaml index 1bec762afa5..6591a040110 100644 --- a/test/minio/8.0.5/questions.yaml +++ b/test/minio/8.0.5/questions.yaml @@ -13,7 +13,7 @@ portals: protocols: - "http" host: - - "$variable-nextcloud.host" + - "$node_ip" ports: - "$variable-service.nodePort" @@ -119,27 +119,27 @@ questions: default: 9001 required: true - - variable: nextcloudDataHostPathEnabled - label: "Configure Host Path for Nextcloud data" + - variable: minioHostPathEnabled + label: "Configure Host Path for Minio data" group: "Storage" schema: type: boolean default: false show_subquestions_if: true subquestions: - - variable: nextcloudHostPath - label: "Specify HostPath for Nextcloud data" + - variable: minioHostPath + label: "Specify HostPath for Minio data" schema: type: hostpath - - variable: nextcloudDataVolume + - variable: minioDataVolume label: "Configure iXVolume" group: "Storage" schema: type: dict $ref: - "normalize/ixVolume" - show_if: [["nextcloudDataHostPathEnabled", "=", false]] + show_if: [["minioHostPathEnabled", "=", false]] attrs: - variable: mountPath label: "Mount Path" @@ -147,10 +147,10 @@ questions: schema: type: path editable: false - default: "/var/www" + default: "/export" - variable: datasetName label: "Dataset Name" schema: type: string - default: "ix-nextcloud_data" + default: "ix-minio" editable: false diff --git a/test/minio/8.0.5/templates/_storage.tpl b/test/minio/8.0.5/templates/_storage.tpl new file mode 100644 index 00000000000..062eb2cb7c5 --- /dev/null +++ b/test/minio/8.0.5/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* +Retrieve host path from ix volumes based on dataset name +*/}} +{{- define "retrieveHostPathFromiXVolume" -}} +{{- range $index, $hostPathConfiguration := $.ixVolumes }} +{{- $dsName := base $hostPathConfiguration.hostPath -}} +{{- if eq $.datasetName $dsName -}} +{{- $hostPathConfiguration.hostPath -}} +{{- end -}} +{{- end }} +{{- end -}} + +{{/* +Retrieve host path for minio +*/}} +{{- define "configuredMinioHostPath" -}} +{{- if .Values.minioHostPathEnabled -}} +{{- .Values.minioHostPath -}} +{{- else -}} +{{- $volDict := dict "datasetName" $.Values.minioDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} +{{- end -}} +{{- end -}} diff --git a/test/minio/8.0.5/templates/deployment.yaml b/test/minio/8.0.5/templates/deployment.yaml index eaf323a290f..26284e7f55a 100644 --- a/test/minio/8.0.5/templates/deployment.yaml +++ b/test/minio/8.0.5/templates/deployment.yaml @@ -35,13 +35,8 @@ spec: - "-ce" - "/usr/bin/docker-entrypoint.sh minio -S server /export {{- template "minio.extraArgs" . }}" volumeMounts: - {{- if .Values.persistence.enabled }} - name: export mountPath: /export - {{- if .Values.persistence.subPath }} - subPath: "{{ .Values.persistence.subPath }}" - {{- end }} - {{- end }} ports: - name: {{ $scheme }} containerPort: 9000 @@ -62,11 +57,11 @@ spec: {{- end}} volumes: - name: export - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "minio.fullname" .) }} - {{- else }} + {{- if .Values.emptyDirVolumes }} emptyDir: {} + {{- else }} + hostPath: + path: {{ template "configuredMinioHostPath" . }} {{- end }} - name: minio-user secret: diff --git a/test/minio/8.0.5/templates/pvc.yaml b/test/minio/8.0.5/templates/pvc.yaml deleted file mode 100644 index 5a1d093031e..00000000000 --- a/test/minio/8.0.5/templates/pvc.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ template "minio.fullname" . }} - labels: - app: {{ template "minio.name" . }} - chart: {{ template "minio.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} - -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" -{{- end }} -{{- end }} -{{- if .Values.persistence.VolumeName }} - volumeName: "{{ .Values.persistence.VolumeName }}" -{{- end }} -{{- end }} diff --git a/test/minio/8.0.5/values.yaml b/test/minio/8.0.5/values.yaml index 4265d5f848a..9c03aa4a38b 100644 --- a/test/minio/8.0.5/values.yaml +++ b/test/minio/8.0.5/values.yaml @@ -10,44 +10,6 @@ extraArgs: [] updateStrategy: RollingUpdate -## Set default accesskey, secretkey, Minio config file path, volume mount path and -## number of nodes (only used for Minio distributed mode) -## AccessKey and secretKey is generated when not set -## Distributed Minio ref: https://docs.minio.io/docs/distributed-minio-quickstart-guide -## -accessKey: "" -secretKey: "" - -## Enable persistence using Persistent Volume Claims -## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ -## -persistence: - enabled: true - - ## A manually managed Persistent Volume and Claim - ## Requires persistence.enabled: true - ## If defined, PVC must be created manually before volume will be bound - existingClaim: "" - - ## minio data Persistent Volume Storage Class - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - ## Storage class of PV to bind. By default it looks for standard storage class. - ## If the PV uses a different storage class, specify that here. - storageClass: "" - VolumeName: "" - accessMode: ReadWriteOnce - size: 500Gi - - ## If subPath is set mount a sub folder of a volume instead of the root of the volume. - ## This is especially handy for volume plugins that don't natively support sub mounting (like glusterfs). - ## - subPath: "" - service: nodePort: 32000