Skip to content

Commit

Permalink
Add metabase helm chart (#1)
Browse files Browse the repository at this point in the history
Added metabase helm chart with extraObjects parameter

Updated README.md to credit metabase helm chart author

Co-authored-by: Lucas de Assis <[email protected]>
  • Loading branch information
lucas-assis12 and lucas-assis12 authored Oct 19, 2023
1 parent 1b5c396 commit 88d3340
Show file tree
Hide file tree
Showing 18 changed files with 989 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ NOTE: one custom thing that we add to charts is the extra-manifest.yaml that all
| chart | based on
| -- | -- |
| consul | https://artifacthub.io/packages/helm/hashicorp/consul
| metabase | https://artifacthub.io/packages/helm/metabase-helm/metabase
| prometheus-elasticsearch-exporter | https://artifacthub.io/packages/helm/prometheus-community/prometheus-elasticsearch-exporter
| prometheus-kafka-exporter | https://artifacthub.io/packages/helm/prometheus-community/prometheus-kafka-exporter
| raw | https://github.com/bedag/helm-charts/tree/master/charts/raw
Expand Down
13 changes: 13 additions & 0 deletions charts/metabase/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
appVersion: v0.46.0
description: The easy, open source way for everyone in your company to ask questions
and learn from data.
home: http://www.metabase.com/
icon: http://www.metabase.com/images/logo.svg
maintainers:
- email: [email protected]
name: aminaleahmad
name: metabase
sources:
- https://github.com/metabase/metabase
version: 2.7.1
4 changes: 4 additions & 0 deletions charts/metabase/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- pmint93
reviewers:
- pmint93
1 change: 1 addition & 0 deletions charts/metabase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# metabase-helm
32 changes: 32 additions & 0 deletions charts/metabase/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.hostname }}
http://{{- .Values.ingress.hostname }}
{{- else if .Values.route.enabled }}
{{- if .Values.route.host }}
{{- if not (empty .Values.route.tls) }}
https://{{- .Values.route.host }}
{{- else }}
http://{{- .Values.route.host }}
{{- end }}
{{- else }}
export ROUTE_HOST=$(oc get route -n {{ .Release.Namespace }} {{ template "metabase.fullname" . }} -o jsonpath="{.spec.host}")
{{- if not (empty .Values.route.tls) }}
echo https://$ROUTE_HOST
{{- else }}
echo http://$ROUTE_HOST
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "metabase.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 "metabase.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "metabase.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 "metabase.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 --namespace {{ .Release.Namespace }} $POD_NAME 8080:{{ .Values.service.internalPort }}
{{- end }}
47 changes: 47 additions & 0 deletions charts/metabase/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "metabase.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 "metabase.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the apiVersion of deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "metabase.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "metabase.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/metabase/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "metabase.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "metabase.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- if .Values.log4jProperties }}
log4j.properties:
{{ toYaml .Values.log4jProperties | indent 4}}
{{- end}}
{{- if .Values.log4j2XML }}
log4j2.xml:
{{ toYaml .Values.log4j2XML | indent 4}}
{{- end}}
31 changes: 31 additions & 0 deletions charts/metabase/templates/database-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.persistence.enabled }}
{{- $h2database := .Values.persistence.persistentVolumeClaim.h2database -}}
{{- if not $h2database.existingClaim }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "metabase.fullname" . }}
annotations:
{{- range $key, $value := $h2database.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if eq .Values.persistence.resourcePolicy "keep" }}
helm.sh/resource-policy: keep
{{- end }}
labels:
component: h2database
spec:
accessModes:
- {{ $h2database.accessMode }}
resources:
requests:
storage: {{ $h2database.size }}
{{- if $h2database.storageClass }}
{{- if eq "-" $h2database.storageClass }}
storageClassName: ""
{{- else }}
storageClassName: {{ $h2database.storageClass }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/metabase/templates/database-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if not .Values.database.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "metabase.fullname" . }}-database
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "metabase.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
{{- if .Values.database.encryptionKey }}
encryptionKey: {{ .Values.database.encryptionKey | b64enc | quote }}
{{- end }}
{{- if (ne (.Values.database.type | lower) "h2") }}
{{- if .Values.database.connectionURI }}
connectionURI: {{ .Values.database.connectionURI | b64enc | quote }}
{{- end }}
{{- if .Values.database.username }}
username: {{ .Values.database.username | b64enc | quote }}
{{- end }}
{{- if .Values.database.password }}
password: {{ .Values.database.password | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 88d3340

Please sign in to comment.