diff --git a/stable/owncloud/.helmignore b/stable/owncloud/.helmignore new file mode 100644 index 0000000000..6b8710a711 --- /dev/null +++ b/stable/owncloud/.helmignore @@ -0,0 +1 @@ +.git diff --git a/stable/owncloud/Chart.yaml b/stable/owncloud/Chart.yaml new file mode 100644 index 0000000000..6d2575cb0f --- /dev/null +++ b/stable/owncloud/Chart.yaml @@ -0,0 +1,16 @@ +name: owncloud +version: 0.4.0 +description: A file sharing server that puts the control and security of your own data back into your hands. +keywords: +- owncloud +- storage +- http +- web +- php +home: https://owncloud.org/ +sources: +- https://github.com/bitnami/bitnami-docker-owncloud +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl diff --git a/stable/owncloud/README.md b/stable/owncloud/README.md new file mode 100644 index 0000000000..3ff57348c9 --- /dev/null +++ b/stable/owncloud/README.md @@ -0,0 +1,107 @@ +# ownCloud + +[ownCloud](https://owncloud.org/) is a file sharing server that puts the control and security of your own data back into your hands. + +## TL;DR; + +```console +$ helm install stable/owncloud +``` + +## Introduction + +This chart bootstraps a [ownCloud](https://github.com/bitnami/bitnami-docker-owncloud) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the ownCloud application. + +## 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`: + +```console +$ helm install --name my-release stable/owncloud +``` + +The command deploys ownCloud on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ 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 ownCloud chart and their default values. + +| Parameter | Description | Default | +| --------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- | +| `image` | ownCloud image | `bitnami/owncloud:{VERSION}` | +| `imagePullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` | +| `owncloudHost` | ownCloud host to create application URLs | `nil` | +| `owncloudLoadBalancerIP` | `loadBalancerIP` for the owncloud Service | `nil` | +| `owncloudUsername` | User of the application | `user` | +| `owncloudPassword` | Application password | Randomly generated | +| `owncloudEmail` | Admin email | `user@example.com` | +| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` | +| `serviceType` | Kubernetes Service type | `LoadBalancer` | +| `persistence.enabled` | Enable persistence using PVC | `true` | +| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `generic` | +| `persistence.apache.accessMode` | PVC Access Mode for Apache volume | `ReadWriteOnce` | +| `persistence.apache.size` | PVC Storage Request for Apache volume | `1Gi` | +| `persistence.owncloud.storageClass` | PVC Storage Class for ownCloud volume | `generic` | +| `persistence.owncloud.accessMode` | PVC Access Mode for ownCloud volume | `ReadWriteOnce` | +| `persistence.owncloud.size` | PVC Storage Request for ownCloud volume | `8Gi` | +| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | + +The above parameters map to the env variables defined in [bitnami/owncloud](http://github.com/bitnami/bitnami-docker-owncloud). For more information please refer to the [bitnami/owncloud](http://github.com/bitnami/bitnami-docker-owncloud) image documentation. + +> **Note**: +> +> For ownCloud to function correctly, you should specify the `owncloudHost` parameter to specify the FQDN (recommended) or the public IP address of the ownCloud service. +> +> Optionally, you can specify the `owncloudLoadBalancerIP` parameter to assign a reserved IP address to the ownCloud service of the chart. However please note that this feature is only available on a few cloud providers (f.e. GKE). +> +> To reserve a public IP address on GKE: +> +> ```bash +> $ gcloud compute addresses create owncloud-public-ip +> ``` +> +> The reserved IP address can be associated to the ownCloud service by specifying it as the value of the `owncloudLoadBalancerIP` parameter while installing the chart. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set owncloudUsername=admin,owncloudPassword=password,mariadb.mariadbRootPassword=secretpassword \ + stable/owncloud +``` + +The above command sets the ownCloud administrator account username and password to `admin` and `password` respectively. Additionally it sets the MariaDB `root` user password to `secretpassword`. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml stable/owncloud +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami ownCloud](https://github.com/bitnami/bitnami-docker-owncloud) image stores the ownCloud data and configurations at the `/bitnami/owncloud` and `/bitnami/apache` paths of the container. + +Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. +See the [Configuration](#configuration) section to configure the PVC or to disable persistence. diff --git a/stable/owncloud/requirements.lock b/stable/owncloud/requirements.lock new file mode 100644 index 0000000000..0840100513 --- /dev/null +++ b/stable/owncloud/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: mariadb + repository: http://storage.googleapis.com/kubernetes-charts + version: 0.5.2 +digest: sha256:400ac77ff2337dce024b0225bbfed9f509d77eb6ff6ee10000d59c5f6a367d51 +generated: 2016-10-20T17:55:13.834613554-07:00 diff --git a/stable/owncloud/requirements.yaml b/stable/owncloud/requirements.yaml new file mode 100644 index 0000000000..1417e46ef1 --- /dev/null +++ b/stable/owncloud/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: +- name: mariadb + version: 0.5.2 + repository: http://storage.googleapis.com/kubernetes-charts diff --git a/stable/owncloud/templates/NOTES.txt b/stable/owncloud/templates/NOTES.txt new file mode 100644 index 0000000000..d3614e4869 --- /dev/null +++ b/stable/owncloud/templates/NOTES.txt @@ -0,0 +1,45 @@ +{{- if empty (include "host" .) -}} +############################################################################### +### ERROR: You did not provide an external host in your 'helm install' call ### +############################################################################### + +This deployment will be incomplete until you configure ownCloud with a resolvable +host. To configure ownCloud with the URL of your service: + +1. Get the ownCloud URL by running: + + {{- if contains "NodePort" .Values.serviceType }} + + export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + + {{- else if contains "LoadBalancer" .Values.serviceType }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc -w {{ template "fullname" . }}' + + export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + {{- end }} + +2. Complete your ownCloud deployment by running: + + helm upgrade {{ .Release.Name }} \ + --set owncloudHost=$APP_HOST stable/owncloud +{{- else -}} +1. Get the ownCloud URL by running: + +{{- if eq .Values.serviceType "ClusterIP" }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo http://127.0.0.1:8080/ + kubectl port-forward $POD_NAME 8080:80 +{{- else }} + + echo http://{{ include "host" . }}{{ if .Values.owncloudPort }}:{{ .Values.owncloudPort }}{{ end }}/ +{{- end }} + +2. Get your ownCloud login credentials by running: + + echo Email: {{ .Values.owncloudUsername }} + echo Password: $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.owncloud-password[*]}"`)) +{{- end }} diff --git a/stable/owncloud/templates/_helpers.tpl b/stable/owncloud/templates/_helpers.tpl new file mode 100644 index 0000000000..77da2c6a6e --- /dev/null +++ b/stable/owncloud/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* 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 -}} + +{{/* +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 "mariadb.fullname" -}} +{{- printf "%s-%s" .Release.Name "mariadb" | trunc 24 -}} +{{- end -}} + +{{/* +Get the user defined LoadBalancerIP for this release. +Note, returns 127.0.0.1 if using ClusterIP. +*/}} +{{- define "serviceIP" -}} +{{- if eq .Values.serviceType "ClusterIP" -}} +127.0.0.1 +{{- else -}} +{{- index .Values (printf "%sLoadBalancerIP" .Chart.Name) | default "" -}} +{{- end -}} +{{- end -}} + +{{/* +Gets the host to be used for this application. +If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty. +*/}} +{{- define "host" -}} +{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}} +{{- default (include "serviceIP" .) $host -}} +{{- end -}} diff --git a/stable/owncloud/templates/apache-pvc.yaml b/stable/owncloud/templates/apache-pvc.yaml new file mode 100644 index 0000000000..c4cbd9e11a --- /dev/null +++ b/stable/owncloud/templates/apache-pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }}-apache + annotations: + volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.apache.storageClass | quote }} +spec: + accessModes: + - {{ .Values.persistence.apache.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.apache.size | quote }} +{{- end -}} diff --git a/stable/owncloud/templates/deployment.yaml b/stable/owncloud/templates/deployment.yaml new file mode 100644 index 0000000000..8989b0da0e --- /dev/null +++ b/stable/owncloud/templates/deployment.yaml @@ -0,0 +1,84 @@ +{{- if include "host" . -}} +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 + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: MARIADB_HOST + value: {{ template "mariadb.fullname" . }} + - name: MARIADB_PORT + value: "3306" + - name: MARIADB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.fullname" . }} + key: mariadb-root-password + - name: OWNCLOUD_HOST + value: {{ include "host" . | quote }} + - name: OWNCLOUD_USERNAME + value: {{ default "" .Values.owncloudUsername | quote }} + - name: OWNCLOUD_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: owncloud-password + - name: OWNCLOUD_EMAIL + value: {{ default "" .Values.owncloudEmail | quote }} + ports: + - name: http + containerPort: 80 + livenessProbe: + exec: + command: + - curl + - --fail + - localhost/status.php + initialDelaySeconds: 120 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - curl + - --fail + - localhost/status.php + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: owncloud-data + mountPath: /bitnami/owncloud + - name: apache-data + mountPath: /bitnami/apache + volumes: + - name: owncloud-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }}-owncloud + {{- else }} + emptyDir: {} + {{- end }} + - name: apache-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }}-apache + {{- else }} + emptyDir: {} + {{- end }} +{{- end -}} diff --git a/stable/owncloud/templates/owncloud-pvc.yaml b/stable/owncloud/templates/owncloud-pvc.yaml new file mode 100644 index 0000000000..667b44b055 --- /dev/null +++ b/stable/owncloud/templates/owncloud-pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }}-owncloud + annotations: + volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.owncloud.storageClass | quote }} +spec: + accessModes: + - {{ .Values.persistence.owncloud.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.owncloud.size | quote }} +{{- end -}} diff --git a/stable/owncloud/templates/secrets.yaml b/stable/owncloud/templates/secrets.yaml new file mode 100644 index 0000000000..46f9d59941 --- /dev/null +++ b/stable/owncloud/templates/secrets.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + {{ if .Values.owncloudPassword }} + owncloud-password: {{ .Values.owncloudPassword | b64enc | quote }} + {{ else }} + owncloud-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} diff --git a/stable/owncloud/templates/svc.yaml b/stable/owncloud/templates/svc.yaml new file mode 100644 index 0000000000..80dc1ebde3 --- /dev/null +++ b/stable/owncloud/templates/svc.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.serviceType }} + {{- if eq .Values.serviceType "LoadBalancer" }} + loadBalancerIP: {{ default "" .Values.owncloudLoadBalancerIP }} + {{- end }} + ports: + - name: http + port: 80 + targetPort: http + selector: + app: {{ template "fullname" . }} diff --git a/stable/owncloud/values.yaml b/stable/owncloud/values.yaml new file mode 100644 index 0000000000..5ec50fbbd9 --- /dev/null +++ b/stable/owncloud/values.yaml @@ -0,0 +1,81 @@ +## Bitnami ownCloud image version +## ref: https://hub.docker.com/r/bitnami/owncloud/tags/ +## +image: bitnami/owncloud:9.1.1-r1 + +## Specify a imagePullPolicy +## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## ownCloud host to create application URLs +## ref: https://github.com/bitnami/bitnami-docker-owncloud#configuration +## +# owncloudHost: + +## loadBalancerIP for the ownCloud Service (optional, cloud specific) +## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer +## +# owncloudLoadBalancerIP: + +## User of the application +## ref: https://github.com/bitnami/bitnami-docker-owncloud#configuration +## +owncloudUsername: user + +## Application password +## Defaults to a random 10-character alphanumeric string if not set +## ref: https://github.com/bitnami/bitnami-docker-owncloud#configuration +## +# owncloudPassword: + +## Admin email +## ref: https://github.com/bitnami/bitnami-docker-owncloud#configuration +## +owncloudEmail: user@example.com + +## +## MariaDB chart configuration +## +mariadb: + ## MariaDB admin password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run + ## + # mariadbRootPassword: + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + persistence: + enabled: true + storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Kubernetes configuration +## For minikube, set this to NodePort, elsewhere use LoadBalancer +## +serviceType: LoadBalancer + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + apache: + storageClass: generic + accessMode: ReadWriteOnce + size: 1Gi + owncloud: + storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 512Mi + cpu: 300m