diff --git a/stable/minio/Chart.yaml b/stable/minio/Chart.yaml index 9095680eea..71baa4b3f1 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.4.3 +version: 0.5.0 keywords: - storage - object-storage diff --git a/stable/minio/README.md b/stable/minio/README.md index 4e21a8112a..d576ceb5b3 100644 --- a/stable/minio/README.md +++ b/stable/minio/README.md @@ -75,7 +75,7 @@ The following tables lists the configurable parameters of the Minio chart and th | Parameter | Description | Default | |----------------------------|-------------------------------------|---------------------------------------------------------| | `image` | Minio image name | `minio/minio` | -| `imageTag` | Minio image tag. Possible values listed [here](https://hub.docker.com/r/minio/minio/tags/).| `RELEASE.2017-12-28T01-21-00Z`| +| `imageTag` | Minio image tag. Possible values listed [here](https://hub.docker.com/r/minio/minio/tags/).| `RELEASE.2018-01-18T20-33-21Z`| | `imagePullPolicy` | Image pull policy | `Always` | | `mode` | Minio server mode (`standalone`, `shared` or `distributed`)| `standalone` | | `replicas` | Number of nodes (applicable only for Minio distributed mode). Should be 4 <= x <= 16 | `4` | @@ -92,10 +92,10 @@ The following tables lists the configurable parameters of the Minio chart and th | `persistence.subPath` | Mount a sub directory of the persistent volume if set | `""` | | `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` | | `nodeSelector` | Node labels for pod assignment | `{}` | -| `defaultBucket.enabled` | If true, a bucket will be created after minio -install | `false` | -| `defaultBucket.name` | Bucket name | `nil` | -| `defaultBucket.policy` | Bucket policy | `download` | +| `defaultBucket.enabled` | If set to true, a bucket will be created after minio install | `false` | +| `defaultBucket.name` | Bucket name | `bucket` | +| `defaultBucket.policy` | Bucket policy | `none` | +| `defaultBucket.purge` | Purge the bucket if already exists | `false` | 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/_helper_create_bucket.txt b/stable/minio/templates/_helper_create_bucket.txt new file mode 100644 index 0000000000..766f7aa438 --- /dev/null +++ b/stable/minio/templates/_helper_create_bucket.txt @@ -0,0 +1,75 @@ +#!/bin/sh +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() { + 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" ; + $MC_COMMAND ; + STATUS=$? ; + until [ $STATUS = 0 ] + do + ATTEMPTS=`expr $ATTEMPTS + 1` ; + echo \"Failed attempts: $ATTEMPTS\" ; + if [ $ATTEMPTS -gt $LIMIT ]; then + exit 1 ; + fi ; + sleep 2 ; # 1 second intervals between attempts + $MC_COMMAND ; + STATUS=$? ; + done ; + set -e ; # reset `e` as active + return 0 +} + +# checkBucketExists ($bucket) +# Check if the bucket exists, by using the exit code of `mc ls` +checkBucketExists() { + BUCKET=$1 + CMD=$(/usr/bin/mc ls myminio/$BUCKET > /dev/null 2>&1) + return $? +} + +# createBucket ($bucket, $policy, $purge) +# Ensure bucket exists, purging if asked to +createBucket() { + BUCKET=$1 + POLICY=$2 + PURGE=$3 + + # Purge the bucket, if set & exists + # Since PURGE is user input, check explicitly for `true` + if [ $PURGE = true ]; then + if checkBucketExists $BUCKET ; then + echo "Purging bucket '$BUCKET'." + set +e ; # don't exit if this fails + /usr/bin/mc rm -r --force myminio/$BUCKET + set -e ; # reset `e` as active + else + echo "Bucket '$BUCKET' does not exist, skipping purge." + fi + fi + + # Create the bucket if it does not exist + if ! checkBucketExists $BUCKET ; then + echo "Creating bucket '$BUCKET'" + /usr/bin/mc mb myminio/$BUCKET + else + echo "Bucket '$BUCKET' already exists." + fi + + # At this point, the bucket should exist, skip checking for existance + # Set policy on the bucket + echo "Setting policy of bucket '$BUCKET' to '$POLICY'." + /usr/bin/mc policy $POLICY myminio/$BUCKET +} + +# Try connecting to Minio instance +connectToMinio +# Create the bucket +createBucket {{ .Values.defaultBucket.name }} {{ .Values.defaultBucket.policy }} {{ .Values.defaultBucket.purge }} diff --git a/stable/minio/templates/minio_statefulset.yaml b/stable/minio/templates/minio_statefulset.yaml index c7cd39caf6..bd07779ea5 100644 --- a/stable/minio/templates/minio_statefulset.yaml +++ b/stable/minio/templates/minio_statefulset.yaml @@ -104,14 +104,11 @@ spec: volumeClaimTemplates: - metadata: name: export - annotations: - {{- if .Values.persistence.storageClass }} - volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }} - {{- else }} - volume.alpha.kubernetes.io/storage-class: default - {{- end }} spec: accessModes: [ {{ .Values.persistence.accessMode | quote }} ] + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass }} + {{- end }} resources: requests: storage: {{ .Values.persistence.size }} diff --git a/stable/minio/templates/minioconfig_configmap.yaml b/stable/minio/templates/minioconfig_configmap.yaml index 8c0e6c5f9f..8b6f4da9de 100644 --- a/stable/minio/templates/minioconfig_configmap.yaml +++ b/stable/minio/templates/minioconfig_configmap.yaml @@ -8,9 +8,11 @@ metadata: release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" data: + initialize: |- +{{ include (print $.Template.BasePath "/_helper_create_bucket.txt") . | indent 4 }} config.json: |- { - "version": "20", + "version": "22", "credential": { "accessKey": {{ .Values.accessKey | quote }}, "secretKey": {{ .Values.secretKey | quote }} @@ -18,14 +20,9 @@ data: "region": {{ .Values.minioConfig.region | quote }}, "browser": {{ .Values.minioConfig.browser | quote }}, "domain": {{ .Values.minioConfig.domain | quote }}, - "logger": { - "console": { - "enable": {{ .Values.minioConfig.logger.console.enable }} - }, - "file": { - "enable": {{ .Values.minioConfig.logger.file.enable }}, - "fileName": {{ .Values.minioConfig.logger.file.filename | quote }} - } + "storageclass": { + "standard": {{ .Values.minioConfig.standardStorageClass | quote }}, + "rrs": {{ .Values.minioConfig.reducedRedundancyStorageClass | quote }} }, "notify": { "amqp": { diff --git a/stable/minio/templates/post-install-create-bucket-job.yaml b/stable/minio/templates/post-install-create-bucket-job.yaml new file mode 100644 index 0000000000..674ba40b71 --- /dev/null +++ b/stable/minio/templates/post-install-create-bucket-job.yaml @@ -0,0 +1,46 @@ +{{- if .Values.defaultBucket.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template "minio.fullname" . }}-make-bucket-job + labels: + app: {{ template "minio.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + labels: + app: {{ template "minio.fullname" . }} + release: {{ .Release.Name }} + spec: + restartPolicy: OnFailure +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 4 }} +{{- end }} + volumes: + - name: minio-configuration + projected: + sources: + - configMap: + name: {{ template "minio.fullname" . }}-config-cm + - secret: + name: {{ template "minio.fullname" . }}-user + containers: + - name: minio-mc + image: minio/mc + command: ["/bin/sh", "/config/initialize"] + env: + - name: MINIO_ENDPOINT + value: {{ template "minio.fullname" . }}-svc + - name: MINIO_PORT + value: {{ .Values.servicePort | quote }} + volumeMounts: + - name: minio-configuration + mountPath: /config +{{- end }} diff --git a/stable/minio/templates/post-install-create-bucket-pod.yaml b/stable/minio/templates/post-install-create-bucket-pod.yaml deleted file mode 100644 index 96274f7b57..0000000000 --- a/stable/minio/templates/post-install-create-bucket-pod.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.defaultBucket.enabled }} -apiVersion: v1 -kind: Pod -metadata: - name: {{ template "minio.fullname" . }}-create-bucket - labels: - app: {{ template "minio.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - annotations: - "helm.sh/hook": post-install - "helm.sh/hook-delete-policy": hook-succeeded -spec: - restartPolicy: OnFailure -{{- if .Values.nodeSelector }} - nodeSelector: -{{ toYaml .Values.nodeSelector | indent 4 }} -{{- end }} - 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 "minio.fullname" . }}-user - key: accesskey - - name: MINIO_SECRET_KEY - valueFrom: - secretKeyRef: - name: {{ template "minio.fullname" . }}-user - key: secretkey - - name: MINIO_ENDPOINT - value: {{ template "minio.fullname" . }}-svc -{{- end }} diff --git a/stable/minio/values.yaml b/stable/minio/values.yaml index a6bfdf6fb4..558d397004 100644 --- a/stable/minio/values.yaml +++ b/stable/minio/values.yaml @@ -3,7 +3,7 @@ ## Distributed Minio ref: https://docs.minio.io/docs/distributed-minio-quickstart-guide ## image: "minio/minio" -imageTag: "RELEASE.2017-12-28T01-21-00Z" +imageTag: "RELEASE.2018-01-18T20-33-21Z" imagePullPolicy: "Always" mode: "standalone" @@ -39,10 +39,10 @@ persistence: accessMode: ReadWriteOnce size: 10Gi - ## 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: "" +## 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: "" ## Expose the Minio service to be accessed from outside the cluster (LoadBalancer service). ## or access it from within the cluster (ClusterIP service). Set the service type and the port to serve it. @@ -69,9 +69,11 @@ resources: defaultBucket: enabled: false ## If enabled, must be a string with length > 0 - # name: example + name: bucket ## Can be one of none|download|upload|public - # policy: download + policy: none + ## Purge if bucket exists already + purge: false ## https://docs.minio.io/docs/minio-bucket-notification-guide ## @@ -79,12 +81,8 @@ minioConfig: region: "us-east-1" browser: "on" domain: "" - logger: - console: - enable: true - file: - enable: false - filename: "" + standardStorageClass: "" + reducedRedundancyStorageClass: "" aqmp: enable: false url: ""