From 770e28c19fb57d4af0b5619d017cdfd9bcb7d86d Mon Sep 17 00:00:00 2001 From: Yago Nobre Date: Tue, 19 Sep 2017 15:00:15 -0300 Subject: [PATCH] add support to minio bootstrap (#2061) --- stable/minio/Chart.yaml | 2 +- stable/minio/README.md | 4 +++ .../post-install-create-bucket-pod.yaml | 36 +++++++++++++++++++ stable/minio/values.yaml | 11 +++++- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 stable/minio/templates/post-install-create-bucket-pod.yaml diff --git a/stable/minio/Chart.yaml b/stable/minio/Chart.yaml index 03ddf992af2b..3ab87c300ef3 100755 --- a/stable/minio/Chart.yaml +++ b/stable/minio/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Distributed object storage server built for cloud applications and devops. name: minio -version: 0.2.1 +version: 0.3.0 keywords: - storage - object-storage diff --git a/stable/minio/README.md b/stable/minio/README.md index 9de273c21c89..e3c8c677ac26 100644 --- a/stable/minio/README.md +++ b/stable/minio/README.md @@ -90,6 +90,10 @@ The following tables lists the configurable parameters of the Minio chart and th | `persistence.storageClass` | Type of persistent volume claim | `generic` | | `persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce` | | `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` | +| `defaultBucket.enabled` | If true, a bucket will be created after minio +install | `false` | +| `defaultBucket.name` | Bucket name | `nil` | +| `defaultBucket.policy` | Bucket policy | `download` | Some of the parameters above map to the env variables defined in the [Minio DockerHub image](https://hub.docker.com/r/minio/minio/). diff --git a/stable/minio/templates/post-install-create-bucket-pod.yaml b/stable/minio/templates/post-install-create-bucket-pod.yaml new file mode 100644 index 000000000000..14a731b6169a --- /dev/null +++ b/stable/minio/templates/post-install-create-bucket-pod.yaml @@ -0,0 +1,36 @@ +{{- if .Values.defaultBucket.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: {{ template "fullname" . }}-create-bucket + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + "helm.sh/hook": post-install +spec: + restartPolicy: OnFailure + containers: + - name: minio-mc + image: minio/mc + command: ["/bin/sh", "-c", + "/usr/bin/mc config host add myminio http://$MINIO_ENDPOINT:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY; + /usr/bin/mc rm -r --force myminio/{{ .Values.defaultBucket.name }}; + /usr/bin/mc mb myminio/{{ .Values.defaultBucket.name }}; + /usr/bin/mc policy {{ .Values.defaultBucket.policy }} myminio/{{ .Values.defaultBucket.name }};"] + env: + - name: MINIO_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }}-user + key: accesskey + - name: MINIO_SECRET_KEY + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }}-user + key: secretkey + - name: MINIO_ENDPOINT + value: {{ template "fullname" . }}-svc +{{- end }} diff --git a/stable/minio/values.yaml b/stable/minio/values.yaml index 2fea1e57a1ec..3a1e7aa18069 100644 --- a/stable/minio/values.yaml +++ b/stable/minio/values.yaml @@ -54,7 +54,16 @@ resources: memory: 256Mi cpu: 250m -## Below settings can be used to setup event notifications as explained here. + +## Create a bucket after minio install +## +defaultBucket: + enabled: false + ## If enabled, must be a string with length > 0 + # name: example + ## Can be one of none|download|upload|public + # policy: download + ## https://docs.minio.io/docs/minio-bucket-notification-guide ## minioConfig: