diff --git a/incubator/parse/.helmignore b/incubator/parse/.helmignore new file mode 100644 index 000000000..6b8710a71 --- /dev/null +++ b/incubator/parse/.helmignore @@ -0,0 +1 @@ +.git diff --git a/incubator/parse/Chart.yaml b/incubator/parse/Chart.yaml new file mode 100644 index 000000000..807e717b0 --- /dev/null +++ b/incubator/parse/Chart.yaml @@ -0,0 +1,18 @@ +name: parse +version: 0.1.0 +description: Parse is a platform that enables users to add a scalable and powerful backend to launch a full-featured app for iOS, Android, JavaScript, Windows, Unity, and more. +keywords: +- parse +- backend +- serverless +- platform +- mbaas +- mobile +home: https://parse.com/ +sources: +- https://github.com/bitnami/bitnami-docker-parse +- https://github.com/bitnami/bitnami-docker-parse-dashboard +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl diff --git a/incubator/parse/README.md b/incubator/parse/README.md new file mode 100644 index 000000000..a1e9499a0 --- /dev/null +++ b/incubator/parse/README.md @@ -0,0 +1,106 @@ +# Ghost + +[Ghost](https://ghost.org/) is one of the most versatile open source content management systems on the market. + +## TL;DR; + +```console +$ helm install stable/ghost +``` + +## Introduction + +This chart bootstraps a [Ghost](https://github.com/bitnami/bitnami-docker-ghost) 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 Ghost 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/ghost +``` + +The command deploys Ghost 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 Ghost chart and their default values. + +| Parameter | Description | Default | +| --------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- | +| `image` | Ghost image | `bitnami/ghost:{VERSION}` | +| `imagePullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` | +| `ghostHost` | Ghost host to create application URLs | `nil` | +| `ghostPort` | Ghost port to create application URLs along with host | `80` | +| `ghostLoadBalancerIP` | `loadBalancerIP` for the Ghost Service | `nil` | +| `ghostUsername` | User of the application | `user` | +| `ghostPassword` | Application password | Randomly generated | +| `ghostEmail` | Admin email | `user@example.com` | +| `ghostBlogTitle` | Ghost Blog name | `User's Blog` | +| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` | +| `serviceType` | Kubernetes Service type | `LoadBalancer` | +| `persistence.enabled` | Enable persistence using PVC | `true` | +| `persistence.storageClass` | PVC Storage Class for Ghost volume | `generic` | +| `persistence.accessMode` | PVC Access Mode for Ghost volume | `ReadWriteOnce` | +| `persistence.size` | PVC Storage Request for Ghost volume | `8Gi` | +| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | + +The above parameters map to the env variables defined in [bitnami/ghost](http://github.com/bitnami/bitnami-docker-ghost). For more information please refer to the [bitnami/ghost](http://github.com/bitnami/bitnami-docker-ghost) image documentation. + +> **Note**: +> +> For the Ghost application function correctly, you should specify the `ghostHost` parameter to specify the FQDN (recommended) or the public IP address of the Ghost service. +> +> Optionally, you can specify the `ghostLoadBalancerIP` parameter to assign a reserved IP address to the Ghost 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 ghost-public-ip +> ``` +> +> The reserved IP address can be associated to the Ghost service by specifying it as the value of the `ghostLoadBalancerIP` 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 ghostUsername=admin,ghostPassword=password,mariadb.mariadbRootPassword=secretpassword \ + stable/ghost +``` + +The above command sets the Ghost 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/ghost +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami Ghost](https://github.com/bitnami/bitnami-docker-ghost) image stores the Ghost data and configurations at the `/bitnami/ghost` 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/incubator/parse/charts/mongodb/.helmignore b/incubator/parse/charts/mongodb/.helmignore new file mode 100644 index 000000000..6b8710a71 --- /dev/null +++ b/incubator/parse/charts/mongodb/.helmignore @@ -0,0 +1 @@ +.git diff --git a/incubator/parse/charts/mongodb/Chart.yaml b/incubator/parse/charts/mongodb/Chart.yaml new file mode 100644 index 000000000..341090f01 --- /dev/null +++ b/incubator/parse/charts/mongodb/Chart.yaml @@ -0,0 +1,14 @@ +name: mongodb +version: 0.4.0 +description: Chart for MongoDB +keywords: +- mongodb +- database +- nosql +home: https://mongodb.org +sources: +- https://github.com/bitnami/bitnami-docker-mongodb +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl diff --git a/incubator/parse/charts/mongodb/README.md b/incubator/parse/charts/mongodb/README.md new file mode 100644 index 000000000..ca3733e90 --- /dev/null +++ b/incubator/parse/charts/mongodb/README.md @@ -0,0 +1,83 @@ +# MongoDB + +[MongoDB](https://www.mongodb.com/) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster. + +## TL;DR; + +```bash +$ helm install stable/mongodb +``` + +## Introduction + +This chart bootstraps a [MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) 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/mongodb +``` + +The command deploys MongoDB 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: + +```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 MongoDB chart and their default values. + +| Parameter | Description | Default | +|----------------------------|-------------------------------------|----------------------------------------------------------| +| `image` | MongoDB image | `bitnami/mongodb:{VERSION}` | +| `imagePullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent`. | +| `mongodbRootPassword` | MongoDB admin password | `nil` | +| `mongodbUsername` | MongoDB custom user | `nil` | +| `mongodbPassword` | MongoDB custom user password | `nil` | +| `mongodbDatabase` | Database to create | `nil` | +| `persistence.enabled` | Use a PVC to persist data | `true` | +| `persistence.storageClass` | Storage class of backing PVC | `generic` | +| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | +| `persistence.size` | Size of data volume | `8Gi` | + +The above parameters map to the env variables defined in [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb). For more information please refer to the [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb) image documentation. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set mongodbRootPassword=secretpassword,mongodbUser=my-user,mongodbPassword=my-password,mongodbDatabase=my-database \ + stable/mongodb +``` + +The above command sets the MongoDB `root` account password to `secretpassword`. Additionally it creates a standard database user named `my-user`, with the password `my-password`, who has access to a database named `my-database`. + +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/mongodb +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) image stores the MongoDB data and configurations at the `/bitnami/mongodb` path of the container. + +The chart mounts a [Persistent Volume](kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning. diff --git a/incubator/parse/charts/mongodb/templates/NOTES.txt b/incubator/parse/charts/mongodb/templates/NOTES.txt new file mode 100644 index 000000000..4be5d8864 --- /dev/null +++ b/incubator/parse/charts/mongodb/templates/NOTES.txt @@ -0,0 +1,6 @@ +MongoDB can be accessed via port 27017 on the following DNS name from within your cluster: +{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +To connect to your database run the following command: + + kubectl run {{ template "fullname" . }}-client --rm --tty -i --image bitnami/mongodb --command -- mongo --host {{ template "fullname" . }} {{- if .Values.mongodbRootPassword }} -p {{ .Values.mongodbRootPassword }}{{- end -}} diff --git a/incubator/parse/charts/mongodb/templates/_helpers.tpl b/incubator/parse/charts/mongodb/templates/_helpers.tpl new file mode 100644 index 000000000..234480de7 --- /dev/null +++ b/incubator/parse/charts/mongodb/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 -}} diff --git a/incubator/parse/charts/mongodb/templates/deployment.yaml b/incubator/parse/charts/mongodb/templates/deployment.yaml new file mode 100644 index 000000000..754cd60e2 --- /dev/null +++ b/incubator/parse/charts/mongodb/templates/deployment.yaml @@ -0,0 +1,66 @@ +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: + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: MONGODB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: mongodb-root-password + - name: MONGODB_USERNAME + value: {{ default "" .Values.mongodbUsername | quote }} + - name: MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: mongodb-password + - name: MONGODB_DATABASE + value: {{ default "" .Values.mongodbDatabase | quote }} + ports: + - name: mongodb + containerPort: 27017 + livenessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 5 + timeoutSeconds: 1 + volumeMounts: + - name: data + mountPath: /bitnami/mongodb + resources: +{{ toYaml .Values.resources | indent 10 }} + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/incubator/parse/charts/mongodb/templates/pvc.yaml b/incubator/parse/charts/mongodb/templates/pvc.yaml new file mode 100644 index 000000000..db19bb97d --- /dev/null +++ b/incubator/parse/charts/mongodb/templates/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/incubator/parse/charts/mongodb/templates/secrets.yaml b/incubator/parse/charts/mongodb/templates/secrets.yaml new file mode 100644 index 000000000..b35e2aab5 --- /dev/null +++ b/incubator/parse/charts/mongodb/templates/secrets.yaml @@ -0,0 +1,13 @@ +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: + mongodb-root-password: {{ default "" .Values.mongodbRootPassword | b64enc | quote }} + mongodb-password: {{ default "" .Values.mongodbPassword | b64enc | quote }} diff --git a/incubator/parse/charts/mongodb/templates/svc.yaml b/incubator/parse/charts/mongodb/templates/svc.yaml new file mode 100644 index 000000000..8e3c6d2c8 --- /dev/null +++ b/incubator/parse/charts/mongodb/templates/svc.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + ports: + - name: mongodb + port: 27017 + targetPort: mongodb + selector: + app: {{ template "fullname" . }} diff --git a/incubator/parse/charts/mongodb/values.yaml b/incubator/parse/charts/mongodb/values.yaml new file mode 100644 index 000000000..496e038f8 --- /dev/null +++ b/incubator/parse/charts/mongodb/values.yaml @@ -0,0 +1,39 @@ +## Bitnami MongoDB image version +## ref: https://hub.docker.com/r/bitnami/mongodb/tags/ +## +image: bitnami/mongodb:3.2.10-r0 + +## Specify a imagePullPolicy +## 'Always' if imageTag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## MongoDB admin password +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run +## +# mongodbRootPassword: + +## MongoDB custom user and database +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#creating-a-user-and-database-on-first-run +## +# mongodbUsername: +# mongodbPassword: +# mongodbDatabase: + +## 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: 100m diff --git a/incubator/parse/templates/NOTES.txt b/incubator/parse/templates/NOTES.txt new file mode 100644 index 000000000..719420d49 --- /dev/null +++ b/incubator/parse/templates/NOTES.txt @@ -0,0 +1,78 @@ +Parse Server +------------ + +1. Get your Parse Server URL: + +{{- if contains "NodePort" .Values.serviceType }} + + export NODE_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + export SERVICE_IP=http://$NODE_IP:$NODE_PORT + +{{- 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 SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):{{ .Values.parseServer.port }} +{{- else if contains "ClusterIP" .Values.serviceType }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }},component={{ .Chart.Name }}-server" -o jsonpath="{.items[0].metadata.name}") + export SERVICE_IP=http://127.0.0.1:1337 + kubectl port-forward $POD_NAME 1337:1337 +{{- end }} + +2. Get the Master Key for your Parse Server + + echo $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.master-key[*]}"`)) + +Example Usage: + + curl -X POST \ + -H "X-Parse-Application-Id: {{ .Values.parseServer.appId }}" \ + -H "Content-Type: application/json" \ + -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \ + http://$SERVICE_IP{{ .Values.parseServer.mountPath }}/classes/GameScore + +{{ if .Values.parseDashboard.enabled -}} +Parse Dashboard +--------------- +{{ if empty (include "host" .) }} +############################################################################### +### ERROR: You did not provide an external host in your 'helm install' call ### +############################################################################### + +Your Parse Dashboard deployment will be incomplete until you configure your +Parse Server with a resolvable host. To configure Parse with the URL of your +service: + +1. Get the Parse Server URL by running: + + 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 }}"}}") + +2. Complete your Parse Dashboard deployment by running: + + helm upgrade {{ .Release.Name }} \ + --set parseHost=$APP_HOST stable/parse +{{ else }} +1. Get the Parse Dashboard URL by running: + +{{- if eq .Values.serviceType "ClusterIP" }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }},component={{ .Chart.Name }}-dashboard" -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 Parsh Dashboard login credentials by running: + + echo Email: {{ .Values.parseDashboard.username }} + echo Password: $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.dashboard-password[*]}"`)) +{{- end }} +{{- end }} diff --git a/incubator/parse/templates/_helpers.tpl b/incubator/parse/templates/_helpers.tpl new file mode 100644 index 000000000..674904dae --- /dev/null +++ b/incubator/parse/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 "mongodb.fullname" -}} +{{- printf "%s-%s" .Release.Name "mongodb" | 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/incubator/parse/templates/dashboard-deployment.yaml b/incubator/parse/templates/dashboard-deployment.yaml new file mode 100644 index 000000000..998184304 --- /dev/null +++ b/incubator/parse/templates/dashboard-deployment.yaml @@ -0,0 +1,69 @@ +{{- if and (include "host" .) .Values.parseDashboard.enabled -}} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }}-dashboard + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }} + component: "{{ .Chart.Name }}-dashboard" + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.parseDashboard.image }}" + imagePullPolicy: {{ default "" .Values.parseDashboard.imagePullPolicy | quote }} + env: + - name: PARSE_DASHBOARD_USER + value: {{ .Values.parseDashboard.username }} + - name: PARSE_DASHBOARD_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: dashboard-password + - name: PARSE_SERVER_HOST + value: {{ include "host" . | quote }} + - name: PARSE_SERVER_PORT + value: {{ .Values.parseServer.port | quote }} + - name: PARSE_SERVER_APP_ID + value: {{ .Values.parseServer.appId | quote }} + - name: PARSE_SERVER_MASTER_KEY + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: master-key + - name: PARSE_SERVER_DASHBOARD_APP_NAME + value: {{ .Values.parseDashboard.appName | quote }} + ports: + - name: dashboard-http + containerPort: 4040 + # livenessProbe: + # httpGet: + # path: / + # port: http + # initialDelaySeconds: 120 + # timeoutSeconds: 5 + # readinessProbe: + # exec: + # command: + # - sh + # - -c + # - nami status ghost | grep "ghost is running" + # initialDelaySeconds: 5 + # timeoutSeconds: 1 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: parse-dashboard-data + mountPath: /bitnami/parse-dashboard + volumes: + - name: parse-dashboard-data + emptyDir: {} +{{- end -}} diff --git a/incubator/parse/templates/pvc.yaml b/incubator/parse/templates/pvc.yaml new file mode 100644 index 000000000..2b71f599e --- /dev/null +++ b/incubator/parse/templates/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/incubator/parse/templates/secrets.yaml b/incubator/parse/templates/secrets.yaml new file mode 100644 index 000000000..2aaf14934 --- /dev/null +++ b/incubator/parse/templates/secrets.yaml @@ -0,0 +1,24 @@ +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.parseServer.masterKey }} + master-key: {{ .Values.masterKey | b64enc | quote }} + {{ else }} + master-key: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + + {{ if .Values.parseDashboard.enabled }} + {{ if .Values.parseDashboard.password }} + dashboard-password: {{ .Values.parseDashboard.password | b64enc | quote }} + {{ else }} + dashboard-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + {{ end }} diff --git a/incubator/parse/templates/server-deployment.yaml b/incubator/parse/templates/server-deployment.yaml new file mode 100644 index 000000000..9bf1736de --- /dev/null +++ b/incubator/parse/templates/server-deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }}-server + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }} + component: "{{ .Chart.Name }}-server" + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.parseServer.image }}" + imagePullPolicy: {{ default "" .Values.parseServer.imagePullPolicy | quote }} + env: + - name: PARSE_SERVER_HOST + value: "0.0.0.0" + - name: PARSE_SERVER_PORT + value: {{ .Values.parseServer.port | quote }} + - name: PARSE_SERVER_MOUNT_PATH + value: {{ .Values.parseServer.mountPath | quote }} + - name: PARSE_SERVER_APP_ID + value: {{ .Values.parseServer.appId | quote }} + - name: PARSE_SERVER_MASTER_KEY + value: {{ .Values.parseServer.masterKey | quote }} + - name: MONGODB_HOST + value: {{ template "mongodb.fullname" . }} + - name: MONGODB_PORT + value: "27017" + ports: + - name: server-http + containerPort: 1337 + # livenessProbe: + # httpGet: + # path: / + # port: http + # initialDelaySeconds: 120 + # timeoutSeconds: 5 + # readinessProbe: + # exec: + # command: + # - sh + # - -c + # - nami status ghost | grep "ghost is running" + # initialDelaySeconds: 5 + # timeoutSeconds: 1 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: parse-data + mountPath: /bitnami/parse + volumes: + - name: parse-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} diff --git a/incubator/parse/templates/svc.yaml b/incubator/parse/templates/svc.yaml new file mode 100644 index 000000000..511ec3241 --- /dev/null +++ b/incubator/parse/templates/svc.yaml @@ -0,0 +1,23 @@ +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.parseLoadBalancerIP }} + {{- end }} + ports: + - name: server-http + port: {{ .Values.parseServer.port }} + targetPort: server-http + - name: dashboard-http + port: 80 + targetPort: dashboard-http + selector: + app: {{ template "fullname" . }} diff --git a/incubator/parse/values.yaml b/incubator/parse/values.yaml new file mode 100644 index 000000000..8692590ee --- /dev/null +++ b/incubator/parse/values.yaml @@ -0,0 +1,107 @@ +parseServer: + ## Bitnami Parse image version + ## ref: https://hub.docker.com/r/bitnami/parse/tags/ + ## + image: bitnami/parse:2.2.24-r0 + + ## 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: + + ## Parse Server Port + ## ref: https://github.com/bitnami/bitnami-docker-parse#configuration + ## + port: 1337 + + ## Parse API mount path + ## ref: https://github.com/bitnami/bitnami-docker-parse#configuration + ## + mountPath: /parse + + ## Parse Server App ID + ## ref: https://github.com/bitnami/bitnami-docker-parse#configuration + ## + appId: myAppId + + ## Parse Server Master Key + ## ref: https://github.com/bitnami/bitnami-docker-parse#configuration + ## + # masterKey: + +parseDashboard: + ## Enable deployment of Parse Dashboard + ## + enabled: true + + ## Bitnami Parse Dashboard image version + ## ref: https://hub.docker.com/r/bitnami/parse-dashboard/tags/ + ## + image: bitnami/parse-dashboard:1.0.19-r2 + + ## 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: + + ## Parse Dashboard application username + ## ref: https://github.com/bitnami/bitnami-docker-parse-dashboard#configuration + ## + username: user + + ## Parse Dashboard application password + ## Defaults to a random 10-character alphanumeric string if not set + ## ref: https://github.com/bitnami/bitnami-docker-parse-dashboard#configuration + ## + # password: + + ## Parse Dashboard application name + ## ref: https://github.com/bitnami/bitnami-docker-parse-dashboard#configuration + ## + appName: MyDashboard + +## +## MongoDB chart configuration +## +mongodb: + ## MongoDB admin password + ## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run + ## + # mongodbRootPassword: + + ## 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 +## Note: Parse Dashboard requires your Parse Server to be resolvable from your +## browser. Therefore, you should set a resolvable parseHost for the +## dashboard to function correctly +## +serviceType: LoadBalancer + +## 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/ +## +# TODO: split for dashboard and server +resources: + requests: + memory: 512Mi + cpu: 300m