Skip to content

Commit

Permalink
presto chart (helm#4047)
Browse files Browse the repository at this point in the history
* preso chart

* circle ci comments

* Code review comments:
- use int function instead of using float
- simpler template
- fix list indent

* Fix initialDelaySeconds indentation
  • Loading branch information
bivas authored and k8s-ci-robot committed Mar 13, 2018
1 parent fb9b885 commit 8b53a50
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/presto/.helmignore
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions stable/presto/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
appVersion: 0.196
description: Distributed SQL query engine for running interactive analytic queries
name: presto
version: 0.1
home: https://prestodb.io
icon: https://prestodb.io/static/presto.png
sources:
- https://github.com/facebook/presto
maintainers:
- name: bivas
email: [email protected]
33 changes: 33 additions & 0 deletions stable/presto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Presto Chart

[Presto](http://prestodb.io/) is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.

## Chart Details

This chart will do the following:

* Install a single server which acts both as coordinator and worker
* Install a configmap for it
* Install a service

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install --name my-release stable/presto
```

## Configuration

Configurable values are documented in the `values.yaml`.

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

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/presto
```

> **Tip**: You can use the default [values.yaml](values.yaml)
10 changes: 10 additions & 0 deletions stable/presto/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "presto.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "presto.name" . }},release={{ .Release.Name }},component=coordinator" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8080
{{- end }}
40 changes: 40 additions & 0 deletions stable/presto/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "presto.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "presto.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "presto.coordinator" -}}
{{ template "presto.fullname" . }}-coordinator
{{- end -}}

{{- define "presto.worker" -}}
{{ template "presto.fullname" . }}-worker
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "presto.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
48 changes: 48 additions & 0 deletions stable/presto/templates/configmap-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "presto.coordinator" . }}
labels:
app: {{ template "presto.name" . }}
chart: {{ template "presto.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: coordinator
data:
node.properties: |
node.environment={{ .Values.server.node.environment }}
node.data-dir={{ .Values.server.node.dataDir }}
jvm.config: |
-server
-Xmx{{ .Values.server.jvm.maxHeapSize }}
-XX:+{{ .Values.server.jvm.gcMethod.type }}
-XX:G1HeapRegionSize={{ .Values.server.jvm.gcMethod.g1.heapRegionSize }}
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
config.properties: |
coordinator=true
{{- if gt (int .Values.server.workers) 0 }}
node-scheduler.include-coordinator=false
{{- else }}
node-scheduler.include-coordinator=true
{{- end }}
http-server.http.port={{ .Values.server.config.http.port }}
query.max-memory={{ .Values.server.config.query.maxMemory }}
query.max-memory-per-node={{ .Values.server.config.query.maxMemoryPerNode }}
discovery-server.enabled=true
discovery.uri=http://{{ template "presto.fullname" . }}:{{ .Values.server.config.http.port }}

log.properties: |
com.facebook.presto={{ .Values.server.log.presto.level }}
docker-presto.sh: |
#!/bin/bash
cp {{ .Values.server.config.path }}/*.properties $PRESTO_CONF_DIR
cp {{ .Values.server.config.path }}/*.config $PRESTO_CONF_DIR
launcher run
---
48 changes: 48 additions & 0 deletions stable/presto/templates/configmap-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{- if gt (int .Values.server.workers) 0 }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "presto.worker" . }}
labels:
app: {{ template "presto.name" . }}
chart: {{ template "presto.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: worker
data:
node.properties: |
node.environment={{ .Values.server.node.environment }}
node.data-dir={{ .Values.server.node.dataDir }}
jvm.config: |
-server
-Xmx{{ .Values.server.jvm.maxHeapSize }}
-XX:+{{ .Values.server.jvm.gcMethod.type }}
-XX:G1HeapRegionSize={{ .Values.server.jvm.gcMethod.g1.heapRegionSize }}
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
config.properties: |
coordinator=false
http-server.http.port={{ .Values.server.config.http.port }}
query.max-memory={{ .Values.server.config.query.maxMemory }}
query.max-memory-per-node={{ .Values.server.config.query.maxMemoryPerNode }}
discovery.uri=http://{{ template "presto.fullname" . }}:{{ .Values.server.config.http.port }}
log.properties: |
com.facebook.presto={{ .Values.server.log.presto.level }}
docker-presto.sh: |
#!/bin/bash
cp {{ .Values.server.config.path }}/*.properties $PRESTO_CONF_DIR
cp {{ .Values.server.config.path }}/*.config $PRESTO_CONF_DIR
launcher run
health_check.sh: |
#!/bin/bash
curl --silent {{ template "presto.fullname" . }}:{{ .Values.server.config.http.port }}/v1/node | tr "," "\n" | grep --silent $(hostname -i)
---
{{- end }}
63 changes: 63 additions & 0 deletions stable/presto/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "presto.coordinator" . }}
labels:
app: {{ template "presto.name" . }}
chart: {{ template "presto.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: coordinator
spec:
selector:
matchLabels:
app: {{ template "presto.name" . }}
release: {{ .Release.Name }}
component: coordinator
template:
metadata:
labels:
app: {{ template "presto.name" . }}
release: {{ .Release.Name }}
component: coordinator
spec:
volumes:
- name: config-volume
configMap:
name: {{ template "presto.coordinator" . }}
containers:
- name: {{ .Chart.Name }}-coordinator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/bash"]
args:
- {{ .Values.server.config.path }}/docker-presto.sh
volumeMounts:
- mountPath: {{ .Values.server.config.path }}
name: config-volume
ports:
- name: http-coord
containerPort: {{ .Values.server.config.http.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /v1/cluster
port: http-coord
readinessProbe:
httpGet:
path: /v1/cluster
port: http-coord
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
69 changes: 69 additions & 0 deletions stable/presto/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{- if gt (int .Values.server.workers) 0 }}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "presto.worker" . }}
labels:
app: {{ template "presto.name" . }}
chart: {{ template "presto.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: worker
spec:
replicas: {{ .Values.server.workers }}
selector:
matchLabels:
app: {{ template "presto.name" . }}
release: {{ .Release.Name }}
component: worker
template:
metadata:
labels:
app: {{ template "presto.name" . }}
release: {{ .Release.Name }}
component: worker
spec:
volumes:
- name: config-volume
configMap:
name: {{ template "presto.worker" . }}
containers:
- name: {{ .Chart.Name }}-worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/bash"]
args:
- {{ .Values.server.config.path }}/docker-presto.sh
volumeMounts:
- mountPath: {{ .Values.server.config.path }}
name: config-volume
livenessProbe:
exec:
command:
- /bin/bash
- {{ .Values.server.config.path }}/health_check.sh
initialDelaySeconds: 10
periodSeconds: 25
readinessProbe:
exec:
command:
- /bin/bash
- {{ .Values.server.config.path }}/health_check.sh
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}

{{- end }}
20 changes: 20 additions & 0 deletions stable/presto/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "presto.fullname" . }}
labels:
app: {{ template "presto.name" . }}
chart: {{ template "presto.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.server.config.http.port }}
targetPort: http-coord
protocol: TCP
name: http-coord
selector:
app: {{ template "presto.name" . }}
release: {{ .Release.Name }}
component: coordinator
Loading

0 comments on commit 8b53a50

Please sign in to comment.