Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add metabase #28

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This repo manage some of our shared [Helm](https://helm.sh) Charts
| [maildev](./charts/maildev) | [maildev](https://github.com/maildev/maildev) SMTP |
| [buildkit-service](./charts/buildkit-service) | [buildkit](https://github.com/moby/buildkit) |
| [pgweb](./charts/pgweb) | [pgweb](https://hub.docker.com/r/sosedoff/pgweb) |
| [metabase](./charts/metabase) | [metabase](https://metabase.com) |

Issues and contributions welcome 🤗

Expand Down
3 changes: 3 additions & 0 deletions charts/metabase/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: metabase
version: 1.161.7
89 changes: 89 additions & 0 deletions charts/metabase/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
component: {{ (or .Values.component .Chart.Name) | lower }}
application: {{ .Values.repositoryName }}
name: {{ (or .Values.component .Chart.Name) | lower }}
namespace: {{ or .Values.namespace .Values.namespace }}
annotations:
{{ if .Values.annotations }}
{{ range $key, $val := .Values.annotations }}
"{{ $key }}": {{ $val | quote }}
{{ end }}
{{ end }}
spec:
replicas: 1
selector:
matchLabels:
component: {{ (or .Values.component .Chart.Name) | lower }}
template:
metadata:
labels:
component: {{ (or .Values.component .Chart.Name) | lower }}
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
containers:
- image: {{ .Values.image }}
name: metabase
securityContext:
allowPrivilegeEscalation: false
env:
{{- if gt (len .Values.env) 0 }}
{{- tpl (.Values.env | toYaml) . | nindent 12 }}
{{- end }}
envFrom:
{{- if gt (len .Values.envFrom) 0 }}
{{- tpl (.Values.envFrom | toYaml) . | nindent 12 }}
{{- end }}
ports:
- containerPort: 3000
name: http
startupProbe:
failureThreshold: 30
httpGet:
path: /api/health
port: http
periodSeconds: 10
initialDelaySeconds: 30
successThreshold: 1
timeoutSeconds: 10
readinessProbe:
failureThreshold: 15
httpGet:
path: /api/health
port: http
initialDelaySeconds: 1
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
failureThreshold: 6
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
{{- if .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.resources }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- else}}
resources:
limits:
cpu: 1000m
memory: 2048Mi
requests:
cpu: 500m
memory: 512Mi
{{- end}}
35 changes: 35 additions & 0 deletions charts/metabase/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
{{ range $key, $val := .Values.ingress.annotations }}
"{{ $key }}": {{ $val | quote }}
{{ end }}
labels:
component: {{ (or .Values.component .Chart.Name) | lower }}
application: {{ .Values.repositoryName }}
name: {{ (or .Values.component .Chart.Name) | lower }}
namespace: {{ .Values.namespace }}
spec:
rules:
- host: {{ .Values.host | quote }}
http:
paths:
- backend:
service:
name: {{ (or .Values.component .Chart.Name) | lower }}
port:
name: http
path: /
pathType: Prefix
tls:
- hosts:
- {{ .Values.host | quote }}
{{- if .Values.certSecretName }}
secretName: {{ .Values.certSecretName }}
{{- else }}
secretName: {{ print (or .Values.component .Chart.Name) "-crt" }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/metabase/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
labels:
component: {{ (or .Values.component .Chart.Name) | lower }}
application: {{ .Values.repositoryName }}
name: {{ (or .Values.component .Chart.Name) | lower }}
namespace: {{ .Values.namespace }}
annotations: {}
spec:
ports:
- name: http
port: 80
targetPort: 3000
selector:
component: {{ (or .Values.component .Chart.Name) | lower }}
type: ClusterIP

186 changes: 186 additions & 0 deletions charts/metabase/tests/__snapshot__/metabase_test.yaml.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
custom resources:
1: |
limits:
cpu: 42m
memory: 100m
requests:
cpu: 12m
memory: 10m
custom tag:
1: |
metabase:42.12.1
should render:
1: |
replicas: 1
selector:
matchLabels:
component: metabase
template:
metadata:
labels:
component: metabase
spec:
containers:
- env: null
envFrom: null
image: metabase/metabase:v0.46.6.1
livenessProbe:
failureThreshold: 6
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: metabase
ports:
- containerPort: 3000
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /api/health
port: http
initialDelaySeconds: 1
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 1000m
memory: 2048Mi
requests:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
startupProbe:
failureThreshold: 30
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
2: |
replicas: 1
selector:
matchLabels:
component: metabase
template:
metadata:
labels:
component: metabase
spec:
containers:
- env: null
envFrom: null
image: metabase/metabase:v0.46.6.1
livenessProbe:
failureThreshold: 6
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: metabase
ports:
- containerPort: 3000
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /api/health
port: http
initialDelaySeconds: 1
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 1000m
memory: 2048Mi
requests:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
startupProbe:
failureThreshold: 30
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
3: |
replicas: 1
selector:
matchLabels:
component: metabase
template:
metadata:
labels:
component: metabase
spec:
containers:
- env: null
envFrom: null
image: metabase/metabase:v0.46.6.1
livenessProbe:
failureThreshold: 6
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: metabase
ports:
- containerPort: 3000
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /api/health
port: http
initialDelaySeconds: 1
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 1000m
memory: 2048Mi
requests:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
startupProbe:
failureThreshold: 30
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
34 changes: 34 additions & 0 deletions charts/metabase/tests/metabase_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
suite: test maildev
#templates:
tests:
- it: should render
asserts:
- template: deployment.yaml
isKind:
of: Deployment
- template: deployment.yaml
hasDocuments:
count: 1
- template: deployment.yaml
matchSnapshot:
path: spec
- template: deployment.yaml
matchSnapshot:
path: spec
- template: deployment.yaml
matchSnapshot:
path: spec
- it: custom resources
values:
- values-resources.yaml
asserts:
- template: deployment.yaml
matchSnapshot:
path: spec.template.spec.containers[0].resources
- it: custom tag
values:
- values-tag.yaml
asserts:
- template: deployment.yaml
matchSnapshot:
path: spec.template.spec.containers[0].image
2 changes: 2 additions & 0 deletions charts/metabase/tests/values-host.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
host: metabase.com
certSecretName: some-cert-secret
7 changes: 7 additions & 0 deletions charts/metabase/tests/values-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
limits:
cpu: 42m
memory: 100m
requests:
cpu: 12m
memory: 10m
1 change: 1 addition & 0 deletions charts/metabase/tests/values-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image: metabase:42.12.1
Loading