Add metabase chart (#1617)

This commit is contained in:
Eric
2017-08-13 19:52:51 +02:00
committed by Reinhard Nägele
parent 720747a0c6
commit 15bea92ab0
11 changed files with 416 additions and 0 deletions
+21
View File
@@ -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
View File
@@ -0,0 +1,12 @@
apiVersion: v1
description: The easy, open source way for everyone in your company to ask questions and learn from data.
name: metabase
version: 0.1.0
appVersion: v0.24.2
maintainers:
- name: pmint93
email: phamminhthanh69@gmail.com
home: http://www.metabase.com/
icon: http://www.metabase.com/images/logo.svg
sources:
- https://github.com/metabase/metabase
+96
View File
@@ -0,0 +1,96 @@
# Metabase
[Metabase](http://metabase.com) is the easy, open source way for everyone in your company to ask questions and learn from data.
## TL;DR;
```bash
$ helm install stable/metabase
```
## Introduction
This chart bootstraps a [Metabase](https://github.com/metabase/metabase) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Prerequisites
- Kubernetes 1.4+ with Beta APIs enabled
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/metabase
```
The command deploys Metabase 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 Metabase chart and their default values.
| Parameter | Description | Default |
|------------------------|------------------------------------------------------------|-------------------|
| replicaCount | desired number of controller pods | 1 |
| image.repository | controller container image repository | metabase/metabase |
| image.tag | controller container image tag | v0.24.2 |
| image.pullPolicy | controller container image pull policy | IfNotPresent |
| listen.host | Listening on a specific network host | 0.0.0.0 |
| listen.port | Listening on a specific network port | 3000 |
| ssl.enabled | Enable SSL to run over HTTPS | false |
| ssl.port | SSL port | null |
| ssl.keyStore | The key store in JKS format | null |
| ssl.keyStorePassword | The password for key Store | null |
| database.type | Backend database type | h2 |
| database.encryptionKey | Secret key for encrypt sensitive information into database | null |
| database.host | Database host | null |
| database.port | Database port | null |
| database.dbname | Database name | null |
| database.username | Database username | null |
| database.password | Database password | null |
| password.complexity | Complexity requirement for Metabase account's password | normal |
| password.length | Minimum length required for Metabase account's password | 6 |
| timeZone | Service time zone | UTC |
| emojiLogging | Get a funny emoji in service log | true |
| javaToolOptions | JVM options | null |
| service.type | ClusterIP, NodePort, or LoadBalancer | ClusterIP |
| service.externalPort | Service external port | 80 |
| service.internalPort | Service internal port, should be the same as `listen.port` | 3000 |
| ingress.enabled | Enable ingress controller resource | false |
| ingress.hosts | Ingress resource hostnames | null |
| ingress.annotations | Ingress annotations configuration | null |
| ingress.tls | Ingress TLS configuration | null |
| resources | Server resource requests and limits | {} |
The above parameters map to the env variables defined in [metabase](http://github.com/metabase/metabase). For more information please refer to the [metabase documentations](http://www.metabase.com/docs/v0.24.2/).
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set timeZone=US/Pacific,password.complexity=strong,password.length=10 \
stable/metabase
```
The above command sets the time zone to `US/Pacific`, `strong` user password complexity and minimum length at `10`
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/metabase
```
> **Tip**: You can use the default [values.yaml](values.yaml)
+17
View File
@@ -0,0 +1,17 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.hostname }}
http://{{- .Values.ingress.hostname }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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 "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
{{- end }}
+16
View File
@@ -0,0 +1,16 @@
{{/* 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 -}}
@@ -0,0 +1,15 @@
{{- if ne (.Values.database.type | lower) "h2" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}-database
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
username: {{ .Values.database.username | b64enc | quote }}
password: {{ .Values.database.password | b64enc | quote }}
{{- end }}
+98
View File
@@ -0,0 +1,98 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: MB_JETTY_HOST
value: {{ .Values.listen.host | quote }}
- name: MB_JETTY_PORT
value: {{ .Values.listen.port | quote }}
{{- if .Values.ssl.enabled }}
- name: MB_JETTY_SSL
value: true
- name: MB_JETTY_SSL_Port
value: {{ .Values.ssl.port | quote }}
- name: MB_JETTY_SSL_Keystore
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-ssl
key: keystore
- name: MB_JETTY_SSL_Keystore_Password
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-ssl
key: password
{{- end }}
- name: MB_DB_TYPE
value: {{ .Values.database.type | lower }}
- name: MB_ENCRYPTION_SECRET_KEY
value: {{ .Values.database.encryptionKey | quote }}
{{- if ne (.Values.database.type | lower) "h2" }}
- name: MB_DB_HOST
value: {{ .Values.database.host | quote }}
- name: MB_DB_PORT
value: {{ .Values.database.port | quote }}
- name: MB_DB_DBNAME
value: {{ .Values.database.dbname | quote }}
- name: MB_DB_USER
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-database
key: username
- name: MB_DB_PASS
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-database
key: password
{{- end }}
- name: MB_PASSWORD_COMPLEXITY
value: {{ .Values.password.complexity }}
- name: MB_PASSWORD_LENGTH
value: {{ .Values.password.length | quote }}
- name: JAVA_TIMEZONE
value: {{ .Values.timeZone }}
{{- if .Values.javaToolOptions }}
- name: JAVA_TOOL_OPTIONS
value: {{ .Values.javaToolOptions | quote }}
{{- end }}
- name: MB_EMOJI_IN_LOGS
value: {{ .Values.emojiLogging | quote }}
ports:
- containerPort: {{ .Values.service.internalPort }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.service.internalPort }}
initialDelaySeconds: 120
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /
port: {{ .Values.service.internalPort }}
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 5
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
+32
View File
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
+19
View File
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "name" . }}
release: {{ .Release.Name }}
+15
View File
@@ -0,0 +1,15 @@
{{- if .Values.ssl.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}-ssl
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
keystore: {{ .Values.ssl.keystore | b64enc | quote }}
password: {{ .Values.ssl.keyStorePassword | b64enc | quote }}
{{- end }}
+75
View File
@@ -0,0 +1,75 @@
# Currently Metabase is not horizontly scalable. See
# https://github.com/metabase/metabase/issues/1446 and
# https://github.com/metabase/metabase/issues/2754
# NOTE: Should remain 1
replicaCount: 1
image:
repository: metabase/metabase
tag: v0.24.2
pullPolicy: IfNotPresent
# Config Jetty web server
listen:
host: "0.0.0.0"
port: 3000
ssl:
# If you have an ssl certificate and would prefer to have Metabase run over HTTPS
enabled: false
# port: 8443
# keyStore: |-
# << JKS KEY STORE >>
# keyStorePassword: storepass
# Backend database
database:
# Database type (h2 / mysql / postgres), default: h2
type: h2
# encryptionKey: << YOUR ENCRYPTION KEY >>
## Only need when you use mysql / postgres
# host:
# port:
# dbname:
# username:
# password:
password:
# Changing Metabase password complexity:
# weak: no character constraints
# normal: at least 1 digit (default)
# strong: minimum 8 characters w/ 2 lowercase, 2 uppercase, 1 digit, and 1 special character
complexity: normal
length: 6
timeZone: UTC
emojiLogging: true
# javaToolOptions:
service:
name: metabase
type: ClusterIP
externalPort: 80
internalPort: 3000
ingress:
enabled: false
# Used to create Ingress record (should used with service.type: ClusterIP).
hosts:
# - metabase.domain.com
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: metabase-tls
# hosts:
# - metabase.domain.com
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
#requests:
# cpu: 100m
# memory: 128Mi