Skip to content

Commit

Permalink
from prestosql to trino helm chart (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriano-manassero authored Jan 8, 2021
1 parent 8265e3f commit 98a9b08
Show file tree
Hide file tree
Showing 11 changed files with 464 additions and 0 deletions.
25 changes: 25 additions & 0 deletions valeriano-manassero/trino/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
appVersion: "351"
description: High performance, distributed SQL query engine for big data
name: trino
version: 1.0.0
home: https://trino.io
icon: https://trino.io/assets/images/trino-logo/trino-ko_tiny-alt.svg
sources:
- https://github.com/valeriano-manassero/helm-charts
- https://github.com/trinodb/trino
maintainers:
- name: valeriano-manassero
email: [email protected]
keywords:
- trino
- trinosql
- trinodb
- presto
- prestosql
- prestodb
- "big data"
- database
- sql
- "query engine"
- "high performance"
51 changes: 51 additions & 0 deletions valeriano-manassero/trino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# trino

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 351](https://img.shields.io/badge/AppVersion-351-informational?style=flat-square)

High performance, distributed SQL query engine for big data

**Homepage:** <https://trino.io>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| valeriano-manassero | [email protected] | |

## Source Code

* <https://github.com/valeriano-manassero/helm-charts>
* <https://github.com/trinodb/trino>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| connectors | object | `{}` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"trinodb/trino"` | |
| image.securityContext.runAsGroup | int | `1000` | |
| image.securityContext.runAsUser | int | `1000` | |
| image.tag | int | `351` | |
| nodeSelector | object | `{}` | |
| resources | object | `{}` | |
| server.config.http.port | int | `8080` | |
| server.config.path | string | `"/usr/lib/trino/etc"` | |
| server.config.query.maxMemory | string | `"3GB"` | |
| server.config.query.maxMemoryPerNode | string | `"1GB"` | |
| server.config.query.maxTotalMemory | string | `"6GB"` | |
| server.config.query.maxTotalMemoryPerNode | string | `"2GB"` | |
| server.jvm.gcMethod.g1.heapRegionSize | string | `"32M"` | |
| server.jvm.gcMethod.type | string | `"UseG1GC"` | |
| server.jvm.maxHeapSize | string | `"7G"` | |
| server.log.trino.level | string | `"INFO"` | |
| server.node.dataDir | string | `"/data/trino"` | |
| server.node.environment | string | `"production"` | |
| server.node.pluginDir | string | `"/usr/lib/trino/plugin"` | |
| server.workers | int | `3` | |
| service.type | string | `"ClusterIP"` | |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.4.0](https://github.com/norwoodj/helm-docs/releases/v1.4.0)
10 changes: 10 additions & 0 deletions valeriano-manassero/trino/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 "trino.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 "trino.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 }}
60 changes: 60 additions & 0 deletions valeriano-manassero/trino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "trino.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 "trino.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 "trino.coordinator" -}}
{{ template "trino.fullname" . }}-coordinator
{{- end -}}

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

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "trino.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "trino.labels" -}}
helm.sh/chart: {{ include "trino.chart" . }}
{{ include "trino.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "trino.selectorLabels" -}}
app.kubernetes.io/name: {{ include "trino.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
43 changes: 43 additions & 0 deletions valeriano-manassero/trino/templates/configmap-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "trino.coordinator" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
data:
node.properties: |
node.environment={{ .Values.server.node.environment }}
node.data-dir={{ .Values.server.node.dataDir }}
plugin.dir={{ .Values.server.node.pluginDir }}
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
-Djdk.attach.allowAttachSelf=true
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 }}
query.max-memory={{ .Values.server.config.query.maxTotalMemory }}
query.max-total-memory-per-node={{ .Values.server.config.query.maxTotalMemoryPerNode }}
discovery-server.enabled=true
discovery.uri=http://localhost:{{ .Values.server.config.http.port }}

log.properties: |
io.trino={{ .Values.server.log.trino.level }}
---
43 changes: 43 additions & 0 deletions valeriano-manassero/trino/templates/configmap-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if gt (int .Values.server.workers) 0 }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "trino.worker" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
data:
node.properties: |
node.environment={{ .Values.server.node.environment }}
node.data-dir={{ .Values.server.node.dataDir }}
plugin.dir={{ .Values.server.node.pluginDir }}
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
-Djdk.attach.allowAttachSelf=true
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 }}
query.max-memory={{ .Values.server.config.query.maxTotalMemory }}
query.max-total-memory-per-node={{ .Values.server.config.query.maxTotalMemoryPerNode }}
discovery.uri=http://{{ template "trino.fullname" . }}:{{ .Values.server.config.http.port }}
log.properties: |
io.trino={{ .Values.server.log.trino.level }}
health_check.sh: |
#!/bin/bash
curl -H 'X-trino-User: healthCheck' --silent {{ template "trino.fullname" . }}:{{ .Values.server.config.http.port }}/v1/node | tr "," "\n" | grep --silent $(hostname -i)
---
{{- end }}
67 changes: 67 additions & 0 deletions valeriano-manassero/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "trino.coordinator" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
spec:
selector:
matchLabels:
{{- include "trino.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: coordinator
template:
metadata:
labels:
{{- include "trino.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: coordinator
annotations:
checksum/config: {{ printf "%s%s" .Values.server .Values.connectors | sha256sum }}
spec:
{{- with .Values.image.securityContext }}
securityContext:
runAsUser: {{ .runAsUser }}
runAsGroup: {{ .runAsGroup }}
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ template "trino.coordinator" . }}
- name: catalog-volume
secret:
secretName: trino-connectors
containers:
- name: {{ .Chart.Name }}-coordinator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: {{ .Values.server.config.path }}
name: config-volume
- mountPath: {{ .Values.server.config.path }}/catalog
name: catalog-volume
ports:
- name: http-coord
containerPort: {{ .Values.server.config.http.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /v1/status
port: http-coord
readinessProbe:
httpGet:
path: /v1/status
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 }}
68 changes: 68 additions & 0 deletions valeriano-manassero/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{- if gt (int .Values.server.workers) 0 }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "trino.worker" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
app.kubernetes.io/component: worker
spec:
replicas: {{ .Values.server.workers }}
selector:
matchLabels:
{{- include "trino.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: worker
template:
metadata:
labels:
{{- include "trino.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: worker
annotations:
checksum/config: {{ printf "%s%s" .Values.server .Values.connectors | sha256sum }}
spec:
volumes:
- name: config-volume
configMap:
name: {{ template "trino.worker" . }}
- name: catalog-volume
secret:
secretName: trino-connectors
containers:
- name: {{ .Chart.Name }}-worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: {{ .Values.server.config.path }}
name: config-volume
- mountPath: {{ .Values.server.config.path }}/catalog
name: catalog-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 }}
10 changes: 10 additions & 0 deletions valeriano-manassero/trino/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: trino-connectors
labels:
{{- include "trino.labels" . | nindent 4 }}
data:
{{- range $key, $val := .Values.connectors }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
Loading

0 comments on commit 98a9b08

Please sign in to comment.