From bb72a124eb5ef7f2b7fef5107612bb004344515c Mon Sep 17 00:00:00 2001 From: Hunter Nield Date: Fri, 16 Dec 2016 05:13:49 +0800 Subject: [PATCH] Minio Chart (#280) * Basic Minio Chart - Single export with a default Access Key and Secret * Fix keywords * Fixed incorrect secret name * Added namespace to portforwarding in NOTES.txt --- stable/minio/.helmignore | 21 +++++ stable/minio/Chart.yaml | 14 +++ stable/minio/README.md | 94 ++++++++++++++++++++ stable/minio/templates/NOTES.txt | 14 +++ stable/minio/templates/_helpers.tpl | 16 ++++ stable/minio/templates/minio_deployment.yaml | 64 +++++++++++++ stable/minio/templates/minio_pvc.yaml | 14 +++ stable/minio/templates/minio_secret.yaml | 13 +++ stable/minio/templates/minio_svc.yaml | 16 ++++ stable/minio/values.yaml | 28 ++++++ 10 files changed, 294 insertions(+) create mode 100644 stable/minio/.helmignore create mode 100755 stable/minio/Chart.yaml create mode 100644 stable/minio/README.md create mode 100644 stable/minio/templates/NOTES.txt create mode 100644 stable/minio/templates/_helpers.tpl create mode 100644 stable/minio/templates/minio_deployment.yaml create mode 100644 stable/minio/templates/minio_pvc.yaml create mode 100644 stable/minio/templates/minio_secret.yaml create mode 100644 stable/minio/templates/minio_svc.yaml create mode 100644 stable/minio/values.yaml diff --git a/stable/minio/.helmignore b/stable/minio/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/minio/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/minio/Chart.yaml b/stable/minio/Chart.yaml new file mode 100755 index 0000000000..0e46961cf0 --- /dev/null +++ b/stable/minio/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +description: A Minio Helm chart for Kubernetes +name: minio +version: 0.0.1 +keywords: +- storage +- object-storage +- S3 +home: https://minio.io +sources: +- https://github.com/minio/minio +maintainers: +- name: Acaleph + email: hello@acale.ph diff --git a/stable/minio/README.md b/stable/minio/README.md new file mode 100644 index 0000000000..628ee51ffe --- /dev/null +++ b/stable/minio/README.md @@ -0,0 +1,94 @@ +Minio +===== + +[Minio](https://minio.io) is a distributed S3-compatible object storage server built for cloud applications and devops. + +Introduction +------------ + +This chart bootstraps a single node 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 +- PV provisioner support in the underlying infrastructure + +Installing the Chart +-------------------- + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/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. + +By default a pre-generated Access Key and Secret will be used. If you'd like to set your own password change the AccessKey and SecretKey in the values.yaml. + +Uninstalling the Chart +---------------------- + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +Configuration +------------- + +The following tables lists the configurable parameters of the Minio chart and their default values. + +| Parameter | Description | Default | +|----------------------------|-------------------------------------|---------------------------------------------------------| +| `image` | `minio` image. | `minio/minio` The official release on Docker Hub | +| `imageTag` | `minio` image tag. | The latest release | +| `imagePullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` | +| `ServiceType` | Kubernetes Service Type | `ClusterIP` | +| `ServicePort` | Kuberntes Service Port | `9000` | +| `AccessKey` | Default Access Key | `AKIAIOSFODNN7EXAMPLE` | +| `SecretKey` | Default Secret Key | `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` | +| `persistence.enabled` | Create a volume to store data | true | +| `persistence.size` | Size of persistent volume claim | 8Gi RW | +| `persistence.storageClass` | Type of persistent volume claim | generic | +| `persistence.accessMode` | ReadWriteOnce or ReadOnly | ReadWriteOnce | +| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` | + +Some of the parameters above map to the env variables defined in the [Minio DockerHub image](https://hub.docker.com/r/minio/minio/). + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set AccessKey=myaccesskey,SecretKey=mysecretkey \ + stable/minio +``` + +The above command sets the Minio Access Key to `myaccesskey` and Secret Key to `mysecretkey`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/minio +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +Persistence +----------- + +The [Minio](https://hub.docker.com/r/minio/minio/) image stores the Minio data at the `/export` path of the container. + +By default a PersistentVolumeClaim is created and mounted into that directory. In order to disable this functionality you can change the values.yaml to disable persistence and use an emptyDir instead. + +> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."* + +TODO: +----- + +- Erasure encoding and distributed server +- Configmap for the Minio config diff --git a/stable/minio/templates/NOTES.txt b/stable/minio/templates/NOTES.txt new file mode 100644 index 0000000000..ece22db320 --- /dev/null +++ b/stable/minio/templates/NOTES.txt @@ -0,0 +1,14 @@ +Minio can be accessed via port {{ .Values.ServicePort }} on the following DNS name from within your cluster: +{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +To connect to minio: + + 1. Download the Minio mc client - https://docs.minio.io/docs/minio-client-quickstart-guide + + 2. export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + + 3. kubectl port-forward $POD_NAME 9000 --namespace {{ .Release.Namespace }} + + 4. mc config host add {{ template "fullname" . }}-local http://localhost:9000 {{ .Values.AccessKey }} {{ .Values.SecretKey }} S3v4 + + 5. mc ls {{ template "fullname" . }}-local diff --git a/stable/minio/templates/_helpers.tpl b/stable/minio/templates/_helpers.tpl new file mode 100644 index 0000000000..dfae90a3fb --- /dev/null +++ b/stable/minio/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- end -}}s \ No newline at end of file diff --git a/stable/minio/templates/minio_deployment.yaml b/stable/minio/templates/minio_deployment.yaml new file mode 100644 index 0000000000..33a667930a --- /dev/null +++ b/stable/minio/templates/minio_deployment.yaml @@ -0,0 +1,64 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + replicas: 1 + selector: + matchLabels: + app: {{ template "fullname" . }} + template: + metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + spec: + volumes: + - name: export + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + - name: minio-user + secret: + secretName: {{ template "fullname" . }}-user + containers: + - name: minio + image: {{ .Values.Image }}:{{ .Values.ImageTag }} + imagePullPolicy: {{ .Values.ImagePullPolicy }} + args: + - server + - /export + volumeMounts: + - name: export + mountPath: /export + ports: + - name: service + containerPort: 9000 + 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 + livenessProbe: + tcpSocket: + port: 9000 + timeoutSeconds: 1 + resources: +{{ toYaml .Values.resources | indent 12 }} diff --git a/stable/minio/templates/minio_pvc.yaml b/stable/minio/templates/minio_pvc.yaml new file mode 100644 index 0000000000..db19bb97d9 --- /dev/null +++ b/stable/minio/templates/minio_pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }} + annotations: + volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/stable/minio/templates/minio_secret.yaml b/stable/minio/templates/minio_secret.yaml new file mode 100644 index 0000000000..6b8294c6d9 --- /dev/null +++ b/stable/minio/templates/minio_secret.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }}-user + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + accesskey: {{ .Values.AccessKey | b64enc }} + secretkey: {{ .Values.SecretKey | b64enc }} diff --git a/stable/minio/templates/minio_svc.yaml b/stable/minio/templates/minio_svc.yaml new file mode 100644 index 0000000000..6e8c6041e4 --- /dev/null +++ b/stable/minio/templates/minio_svc.yaml @@ -0,0 +1,16 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + selector: + app: {{ template "fullname" . }} + ports: + - name: service + port: 9000 + targetPort: {{ .Values.ServicePort }} diff --git a/stable/minio/values.yaml b/stable/minio/values.yaml new file mode 100644 index 0000000000..78323ab8ce --- /dev/null +++ b/stable/minio/values.yaml @@ -0,0 +1,28 @@ + +Image: "minio/minio" +ImageTag: "latest" +ImagePullPolicy: "Always" + +ServiceType: ClusterIP +ServicePort: 9000 + +## Set default access key and secret +AccessKey: "AKIAIOSFODNN7EXAMPLE" +SecretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 256Mi + cpu: 250m