[stable/parse] adds parse chart (#1256)

* [stable/parse] deploys a parse server and optionally the parse dashboard

* parse: add standard labels to pod metadata

* parse: bump mongodb requirement version

* parse: bump chart images

* parse: bump chart version

* parse: use `name` template for app labels

* parse: fixed app labels

* parse: removed `chart` and `heritage` labels from teh Pod spec

* parse: append `-server` to parse server deployment name

* parse: drop `Chart.Name` from `component` labels

* parse: drop use of `default ""` in templates

* parse: disambiguate server and dashboard pod name's in NOTES.txt

* parse: add Release.Name to service selectors

* parse: disabled default resource limits

* parse: fix pod selector in NOTES.txt

* parse: renamed `parse` and `parseDashboard` value keys to `server` and `dashboard` respectively

* parse: comment out the `loadBalancerIP` field in `values.yaml`

* parse: fix empty resources

* parse: fix requirements.yaml
This commit is contained in:
Sameer Naik
2017-07-31 16:45:47 +02:00
committed by Reinhard Nägele
parent d35d16d79b
commit bbfa0b11af
13 changed files with 593 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.git
+18
View File
@@ -0,0 +1,18 @@
name: parse
version: 0.2.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
+112
View File
@@ -0,0 +1,112 @@
# Parse
[Parse](https://parse.com/) is an open source version of the Parse backend that can be deployed to any infrastructure that can run Node.js.
## TL;DR;
```console
$ helm install stable/parse
```
## Introduction
This chart bootstraps a [Parse](https://github.com/bitnami/bitnami-docker-parse) 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`:
```console
$ helm install --name my-release stable/parse
```
The command deploys Parse 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 Parse chart and their default values.
| Parameter | Description | Default |
|------------------------------------|----------------------------------------|---------------------------------------------|
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `loadBalancerIP` | `loadBalancerIP` for the Parse Service | `nil` |
| `server.image` | Parse server image | `bitnami/parse:{VERSION}` |
| `server.imagePullPolicy` | Parse server image pull policy | `IfNotPresent` |
| `server.port` | Parse server server port | `1337` |
| `server.mountPath` | Parse server API mount path | `/parse` |
| `server.appId` | Parse server App Id | `myappID` |
| `server.masterKey` | Parse server Master Key | `random 10 character alphanumeric string` |
| `server.resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `dashboard.enabled` | Enable parse dashboard | `true` |
| `dashboard.image` | Dashboard image | `bitnami/parse-dashboard:{VERSION}` |
| `dashboard.imagePullPolicy` | Dashboard image pull policy | `IfNotPresent` |
| `dashboard.username` | Dashboard username | `user` |
| `dashboard.password` | Dashboard user password | `random 10 character alphanumeric string` |
| `dashboard.appName` | Dashboard application name | `MyDashboard` |
| `dashboard.resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `persistence.enabled` | Enable Parse persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for Parse volume | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode for Parse volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for Parse volume | `8Gi` |
| `mongodb.persistence.enabled` | Enable MongoDB persistence using PVC | `true` |
| `mongodb.persistence.storageClass` | PVC Storage Class for MongoDB volume | `nil` (uses alpha storage class annotation) |
| `mongodb.persistence.accessMode` | PVC Access Mode for MongoDB volume | `ReadWriteOnce` |
| `mongodb.persistence.size` | PVC Storage Request for MongoDB volume | `8Gi` |
The above parameters map to the env variables defined in [bitnami/parse](http://github.com/bitnami/bitnami-docker-parse). For more information please refer to the [bitnami/parse](http://github.com/bitnami/bitnami-docker-parse) image documentation.
> **Note**:
>
> For the Parse application function correctly, you should specify the `parseHost` parameter to specify the FQDN (recommended) or the public IP address of the Parse service.
>
> Optionally, you can specify the `loadBalancerIP` parameter to assign a reserved IP address to the Parse 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 parse-public-ip
> ```
>
> The reserved IP address can be associated to the Parse service by specifying it as the value of the `loadBalancerIP` 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 dashboard.username=admin,dashboard.password=password \
stable/parse
```
The above command sets the Parse administrator account username and password to `admin` and `password` respectively.
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/parse
```
> **Tip**: You can use the default [values.yaml](values.yaml)
## Persistence
The [Bitnami Parse](https://github.com/bitnami/bitnami-docker-parse) image stores the Parse data and configurations at the `/bitnami/parse` path 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.
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: mongodb
repository: https://kubernetes-charts.storage.googleapis.com/
version: 0.4.12
digest: sha256:f1a7cd7675bd5a500815ab611ec43b6bf493b4df9e6520186b2f9aba979411a3
generated: 2017-07-31T16:13:07.481197576+02:00
+4
View File
@@ -0,0 +1,4 @@
dependencies:
- name: mongodb
version: 0.4.12
repository: https://kubernetes-charts.storage.googleapis.com/
+82
View File
@@ -0,0 +1,82 @@
******************************************************************
*** PLEASE BE PATIENT: Parse may take a few minutes to install ***
******************************************************************
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=$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 --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):{{ .Values.server.port }}
{{- else if contains "ClusterIP" .Values.serviceType }}
export SERVER_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }},component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $SERVER_POD_NAME {{ .Values.server.port }}:{{ .Values.server.port }}
export SERVICE_IP=127.0.0.1:{{ .Values.server.port }}
{{- end }}
Example Usage:
curl -X POST \
-H "X-Parse-Application-Id: {{ .Values.server.appId }}" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://$SERVICE_IP{{ .Values.server.mountPath }}/classes/GameScore
{{ if .Values.dashboard.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 --namespace {{ .Release.Namespace }} -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 server.host=$APP_HOST,server.port={{ .Values.server.port }},server.masterKey=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.master-key}" | base64 --decode),dashboard.username={{ .Values.dashboard.username }},dashboard.password=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.parse-dashboard-password}" | base64 --decode) stable/parse
{{ else }}
1. Get the Parse Dashboard URL by running:
{{- if eq .Values.serviceType "ClusterIP" }}
export DASHBOARD_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }},component=dashboard" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:4040/
kubectl port-forward $DASHBOARD_POD_NAME 4040:4040
{{- else }}
echo http://{{ include "host" . }}/
{{- end }}
2. Get your Parsh Dashboard login credentials by running:
echo Username: {{ .Values.dashboard.username }}
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.parse-dashboard-password}" | base64 --decode)
{{- end }}
{{- end }}
+45
View File
@@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 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 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 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 63 | trimSuffix "-" -}}
{{- 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 -}}
{{- default "" .Values.loadBalancerIP -}}
{{- 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 := default "" .Values.server.host -}}
{{- default (include "serviceIP" .) $host -}}
{{- end -}}
@@ -0,0 +1,67 @@
{{- if and (include "host" .) .Values.dashboard.enabled -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-dashboard
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: "dashboard"
spec:
replicas: 1
template:
metadata:
labels:
app: {{ template "name" . }}
release: "{{ .Release.Name }}"
component: "dashboard"
spec:
containers:
- name: {{ template "fullname" . }}
image: "{{ .Values.dashboard.image }}"
imagePullPolicy: {{ .Values.dashboard.imagePullPolicy | quote }}
env:
- name: PARSE_DASHBOARD_USER
value: {{ .Values.dashboard.username }}
- name: PARSE_DASHBOARD_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: parse-dashboard-password
- name: PARSE_HOST
value: {{ include "host" . | quote }}
- name: PARSE_PORT_NUMBER
value: {{ .Values.server.port | quote }}
- name: PARSE_APP_ID
value: {{ .Values.server.appId | quote }}
- name: PARSE_MASTER_KEY
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: master-key
- name: PARSE_DASHBOARD_APP_NAME
value: {{ .Values.dashboard.appName | quote }}
ports:
- name: dashboard-http
containerPort: 4040
livenessProbe:
httpGet:
path: /
port: dashboard-http
initialDelaySeconds: 120
readinessProbe:
httpGet:
path: /
port: dashboard-http
initialDelaySeconds: 30
resources:
{{ toYaml .Values.dashboard.resources | indent 10 }}
volumeMounts:
- name: parse-dashboard-data
mountPath: /bitnami/parse-dashboard
volumes:
- name: parse-dashboard-data
emptyDir: {}
{{- end -}}
+23
View File
@@ -0,0 +1,23 @@
{{- if .Values.persistence.enabled -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- if .Values.persistence.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end -}}
+23
View File
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ if .Values.server.masterKey }}
master-key: {{ .Values.server.masterKey | b64enc | quote }}
{{ else }}
master-key: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ if .Values.dashboard.enabled }}
{{ if .Values.dashboard.password }}
parse-dashboard-password: {{ .Values.dashboard.password | b64enc | quote }}
{{ else }}
parse-dashboard-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ end }}
@@ -0,0 +1,73 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-server
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: "server"
spec:
replicas: 1
template:
metadata:
labels:
app: {{ template "name" . }}
release: "{{ .Release.Name }}"
component: "server"
spec:
containers:
- name: {{ template "fullname" . }}
image: "{{ .Values.server.image }}"
imagePullPolicy: {{ .Values.server.imagePullPolicy | quote }}
env:
- name: PARSE_HOST
value: "0.0.0.0"
- name: PARSE_PORT_NUMBER
value: {{ .Values.server.port | quote }}
- name: PARSE_MOUNT_PATH
value: {{ .Values.server.mountPath | quote }}
- name: PARSE_APP_ID
value: {{ .Values.server.appId | quote }}
- name: PARSE_MASTER_KEY
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: master-key
- name: MONGODB_HOST
value: {{ template "mongodb.fullname" . }}
- name: MONGODB_PORT
value: "27017"
ports:
- name: server-http
containerPort: {{ .Values.server.port }}
livenessProbe:
httpGet:
path: {{ .Values.server.mountPath }}/users
port: server-http
httpHeaders:
- name: X-Parse-Application-Id
value: {{ .Values.server.appId }}
initialDelaySeconds: 120
readinessProbe:
httpGet:
path: {{ .Values.server.mountPath }}/users
port: server-http
httpHeaders:
- name: X-Parse-Application-Id
value: {{ .Values.server.appId }}
initialDelaySeconds: 30
resources:
{{ toYaml .Values.server.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 }}
+24
View File
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: {{ .Values.serviceType }}
{{- if eq .Values.serviceType "LoadBalancer" }}
loadBalancerIP: {{ .Values.loadBalancerIP | quote }}
{{- end }}
ports:
- name: server-http
port: {{ .Values.server.port }}
targetPort: server-http
- name: dashboard-http
port: 80
targetPort: dashboard-http
selector:
app: {{ template "name" . }}
release: "{{ .Release.Name }}"
+115
View File
@@ -0,0 +1,115 @@
## Kubernetes serviceType for Parse Deployment
## ref: http://kubernetes.io/docs/user-guide/services/#publishing-services---service-types
##
serviceType: LoadBalancer
## loadBalancerIP for the Parse Service (optional, cloud specific)
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
##
# loadBalancerIP:
server:
## Bitnami Parse image version
## ref: https://hub.docker.com/r/bitnami/parse/tags/
##
image: bitnami/parse:2.5.3-r0
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
imagePullPolicy: IfNotPresent
## 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:
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
# requests:
# memory: 512Mi
# cpu: 300m
dashboard:
## 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.1.0-r0
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
imagePullPolicy: IfNotPresent
## 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
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources: {}
# requests:
# memory: 512Mi
# cpu: 300m
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: true
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## Default: volume.alpha.kubernetes.io/storage-class: default
##
# storageClass:
accessMode: ReadWriteOnce
size: 8Gi
##
## MongoDB chart configuration
##
mongodb:
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: true
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## Default: volume.alpha.kubernetes.io/storage-class: default
##
# storageClass:
accessMode: ReadWriteOnce
size: 8Gi