From d22fad2086cdbfc5d9bc6736e828633d367face9 Mon Sep 17 00:00:00 2001 From: gzur Date: Wed, 8 Jan 2020 20:33:42 +0000 Subject: [PATCH] [stable/minio] Decouple directory root from the mountPath (#19949) * [stable/minio] Decouple directory root from the mountPath Introduce a new variable named `.Values.bucketRoot` which defaults to `.Values.mountPath` if unset. This allows the Helm chart to serve only a subset of the mounted drive, which can be useful if the mounted data contains symlinks to locations that should not be accessible directly through minio. Addresses #19939 Signed-off-by: gzur * Remove extra spaces Signed-off-by: gzur --- stable/minio/Chart.yaml | 2 +- stable/minio/README.md | 1 + stable/minio/templates/deployment.yaml | 5 +++-- stable/minio/templates/statefulset.yaml | 3 ++- stable/minio/values.yaml | 5 +++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stable/minio/Chart.yaml b/stable/minio/Chart.yaml index 1ef019cc5f..bba068f9b6 100755 --- a/stable/minio/Chart.yaml +++ b/stable/minio/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: MinIO is a high performance data infrastructure for machine learning, analytics and application data workloads. name: minio -version: 5.0.2 +version: 5.0.3 appVersion: master keywords: - storage diff --git a/stable/minio/README.md b/stable/minio/README.md index 72742756c9..766d80b707 100755 --- a/stable/minio/README.md +++ b/stable/minio/README.md @@ -115,6 +115,7 @@ The following table lists the configurable parameters of the MinIO chart and the | `certsPath` | Default certs path location | `/etc/minio/certs` | | `configPathmc` | Default config file location for MinIO client - mc | `/etc/minio/mc` | | `mountPath` | Default mount location for persistent drive | `/export` | +| `bucketRoot` | Directory from where minio should serve buckets. | Value of `.mountPath` | | `clusterDomain` | domain name of kubernetes cluster where pod is running. | `cluster.local` | | `service.type` | Kubernetes service type | `ClusterIP` | | `service.port` | Kubernetes port where service is exposed | `9000` | diff --git a/stable/minio/templates/deployment.yaml b/stable/minio/templates/deployment.yaml index 29b7811414..83dc2ce9ae 100644 --- a/stable/minio/templates/deployment.yaml +++ b/stable/minio/templates/deployment.yaml @@ -1,4 +1,5 @@ {{- if eq .Values.mode "standalone" }} +{{ $bucketRoot := or ($.Values.bucketRoot) ($.Values.mountPath) }} apiVersion: {{ template "minio.deployment.apiVersion" . }} kind: Deployment metadata: @@ -91,7 +92,7 @@ spec: {{- if .Values.nasgateway.enabled }} command: [ "/bin/sh", "-ce", - "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} gateway nas {{ .Values.mountPath }}" ] + "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} gateway nas {{ $bucketRoot }}" ] {{- else }} {{- if .Values.b2gateway.enabled }} command: [ "/bin/sh", @@ -100,7 +101,7 @@ spec: {{- else }} command: [ "/bin/sh", "-ce", - "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} server {{ .Values.mountPath }}" ] + "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} server {{ $bucketRoot }}" ] {{- end }} {{- end }} {{- end }} diff --git a/stable/minio/templates/statefulset.yaml b/stable/minio/templates/statefulset.yaml index 69c5ba086b..d0d00c554c 100644 --- a/stable/minio/templates/statefulset.yaml +++ b/stable/minio/templates/statefulset.yaml @@ -7,6 +7,7 @@ {{ $scheme := "https" }} {{ end }} {{ $mountPath := .Values.mountPath }} +{{ $bucketRoot := or ($.Values.bucketRoot) ($.Values.mountPath) }} {{ $subPath := .Values.persistence.subPath }} {{ $penabled := .Values.persistence.enabled }} {{ $accessMode := .Values.persistence.accessMode }} @@ -81,7 +82,7 @@ spec: - name: {{ .Chart.Name }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: [ "/bin/sh", "-ce", "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} server {{- range $i := until $zoneCount }}{{ $factor := mul $i $nodeCount }}{{ $endIndex := add $factor $nodeCount }}{{ $beginIndex := mul $i $nodeCount }} {{ $scheme }}://{{ template `minio.fullname` $ }}-{{ `{` }}{{ $beginIndex }}...{{ sub $endIndex 1 }}{{ `}`}}.{{ template `minio.fullname` $ }}-svc.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}{{if (gt $drivesPerNode 1)}}{{ $.Values.mountPath }}-{{ `{` }}0...{{ sub $drivesPerNode 1 }}{{ `}` }}{{else}}{{ $.Values.mountPath }}{{end}}{{- end}}" ] + command: [ "/bin/sh", "-ce", "/usr/bin/docker-entrypoint.sh minio -S {{ .Values.certsPath }} server {{- range $i := until $zoneCount }}{{ $factor := mul $i $nodeCount }}{{ $endIndex := add $factor $nodeCount }}{{ $beginIndex := mul $i $nodeCount }} {{ $scheme }}://{{ template `minio.fullname` $ }}-{{ `{` }}{{ $beginIndex }}...{{ sub $endIndex 1 }}{{ `}`}}.{{ template `minio.fullname` $ }}-svc.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}{{if (gt $drivesPerNode 1)}}{{ $bucketRoot }}-{{ `{` }}0...{{ sub $drivesPerNode 1 }}{{ `}` }}{{else}}{{ $bucketRoot }}{{end}}{{- end}}" ] {{- if .Values.extraArgs }} args: {{ toYaml .Values.extraArgs | indent 12 }} diff --git a/stable/minio/values.yaml b/stable/minio/values.yaml index 5a89386988..7094fede0f 100755 --- a/stable/minio/values.yaml +++ b/stable/minio/values.yaml @@ -60,6 +60,11 @@ certsPath: "/etc/minio/certs/" configPathmc: "/etc/minio/mc/" mountPath: "/export" +## Override the root directory which the minio server should serve from. +## If left empty, it defaults to the value of {{ .Values.mountPath }} +## If defined, it must be a sub-directory of the path specified in {{ .Values.mountPath }} +bucketRoot: "" + # Number of drives attached to a node drivesPerNode: 1 # Number of MinIO containers running