[stable/minio] create bucket after install through configuration parameter with tls enabled (#10686)

* [stable/minio] update to choose proper connection scheme for connecting minio from mc when creating buckets after install and tls is enabled

Signed-off-by: rahul rustagi <rahulrastogi2k6@gmail.com>

* Added steps in README.md to create buckets after install

Signed-off-by: rahul rustagi <rahulrastogi2k6@gmail.com>
This commit is contained in:
raru12
2019-01-23 22:27:21 -08:00
committed by Kubernetes Prow Robot
parent bf1e4bd8c5
commit 4d62de6523
5 changed files with 39 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
description: Minio is a high performance distributed object storage server, designed for large-scale private cloud infrastructure.
name: minio
version: 2.3.5
version: 2.3.6
appVersion: RELEASE.2019-01-10T00-21-20Z
keywords:
- storage
+16
View File
@@ -108,6 +108,7 @@ The following table lists the configurable parameters of the Minio chart and the
| `accessKey` | Default access key (5 to 20 characters) | `AKIAIOSFODNN7EXAMPLE` |
| `secretKey` | Default secret key (8 to 40 characters) | `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` |
| `configPath` | Default config file location | `~/.minio` |
| `configPathmc` | Default config file location for minio client - mc | `~/.mc` |
| `mountPath` | Default mount location for persistent drive| `/export` |
| `clusterDomain` | domain name of kubernetes cluster where pod is running.| `cluster.local` |
| `service.type` | Kubernetes service type | `ClusterIP` |
@@ -307,3 +308,18 @@ $ helm install --set environment.MINIO_BROWSER=on,environment.MINIO_DOMAIN=domai
```
You can add as many environment variables as required, using the above format. Just add `environment.<VARIABLE_NAME>=<value>` under `set` flag.
Create buckets after install
---------------------------
Install the chart, specifying the buckets you want to create after install:
```bash
$ helm install --set buckets[0].name=bucket1,buckets[0].policy=none,buckets[0].purge=false stable/minio
```
Description of the configuration parameters used above -
1. `buckets[].name` - name of the bucket to create, must be a string with length > 0
2. `buckets[].policy` - Can be one of none|download|upload|public
3. `buckets[].purge` - Purge if bucket exists already
@@ -4,12 +4,13 @@ set -e ; # Have script exit in the event of a failed command.
# connectToMinio
# Use a check-sleep-check loop to wait for Minio service to be available
connectToMinio() {
SCHEME=$1
ATTEMPTS=0 ; LIMIT=29 ; # Allow 30 attempts
set -e ; # fail if we can't read the keys.
ACCESS=$(cat /config/accesskey) ; SECRET=$(cat /config/secretkey) ;
set +e ; # The connections to minio are allowed to fail.
echo "Connecting to Minio server: http://$MINIO_ENDPOINT:$MINIO_PORT" ;
MC_COMMAND="mc config host add myminio http://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ;
echo "Connecting to Minio server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT" ;
MC_COMMAND="mc config host add myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ;
$MC_COMMAND ;
STATUS=$? ;
until [ $STATUS = 0 ]
@@ -70,7 +71,12 @@ createBucket() {
}
# Try connecting to Minio instance
connectToMinio
{{- if .Values.tls.enabled }}
scheme=https
{{- else }}
scheme=http
{{- end }}
connectToMinio $scheme
{{- if or .Values.defaultBucket.enabled }}
# Create the bucket
@@ -31,6 +31,14 @@ spec:
name: {{ template "minio.fullname" . }}
- secret:
name: {{ template "minio.fullname" . }}
{{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc
secret:
secretName: {{ .Values.tls.certSecret }}
items:
- key: {{ .Values.tls.publicCrt }}
path: CAs/public.crt
{{ end }}
containers:
- name: minio-mc
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
@@ -44,4 +52,8 @@ spec:
volumeMounts:
- name: minio-configuration
mountPath: /config
{{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc
mountPath: {{ .Values.configPathmc }}certs
{{ end }}
{{- end }}
+1
View File
@@ -45,6 +45,7 @@ existingSecret: ""
accessKey: "AKIAIOSFODNN7EXAMPLE"
secretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
configPath: "/root/.minio/"
configPathmc: "/root/.mc/"
mountPath: "/export"
replicas: 4