Add persistent storage support for minio

This commit is contained in:
Waqar Ahmed 2020-12-09 04:35:07 +05:00
parent 24f4bad8ed
commit 7d54cef34e
6 changed files with 36 additions and 157 deletions

View File

@ -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
-------------

View File

@ -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

View File

@ -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 -}}

View File

@ -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:

View File

@ -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 }}

View File

@ -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: <storageClass>
## 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