Skip to content

Commit

Permalink
Merge pull request #63 from it-at-m/openshift-route
Browse files Browse the repository at this point in the history
Add support for OpenShift route
  • Loading branch information
pmint93 authored Apr 7, 2023
2 parents 5536cb7 + 75bc9a3 commit 70793ef
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/metabase/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description:
The easy, open source way for everyone in your company to ask questions
and learn from data.
name: metabase
version: 2.6.4
version: 2.7.0
appVersion: v0.46.0
maintainers:
- name: pmint93
Expand Down
6 changes: 6 additions & 0 deletions charts/metabase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ The following table lists the configurable parameters of the Metabase chart and
| ingress.labels | Ingress labels configuration | null |
| ingress.annotations | Ingress annotations configuration | {} |
| ingress.tls | Ingress TLS configuration | null |
| route.enabled | Enable OpenShift route resource | false |
| route.annotations | Route annotations configuration | {} |
| route.host | Route hostname | null |
| route.path | Route path | "" |
| route.wildcardPolicy | Route wildcard policy | None |
| route.tls | Route tls configuration | {} |
| log4j2XML | Custom `log4j2.xml` file | null |
| log4jProperties | DEPRECATED Custom `log4j.properties` file | null |
| resources | Server resource requests and limits | {} |
Expand Down
15 changes: 15 additions & 0 deletions charts/metabase/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
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}")
Expand Down
50 changes: 50 additions & 0 deletions charts/metabase/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if .Values.route.enabled -}}
{{- $serviceName := include "metabase.fullname" . -}}
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ template "metabase.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "metabase.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.route.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
annotations:
{{- range $key, $value := .Values.route.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
host: {{ .Values.route.host | quote }}
path: {{ .Values.route.path }}
wildcardPolicy: {{ .Values.route.wildcardPolicy }}
{{- if not (empty .Values.route.tls) }}
tls:
{{- with .Values.route.tls }}
termination: {{ .termination }}
insecureEdgeTerminationPolicy: {{ .insecureEdgeTerminationPolicy }}
{{- with .key }}
key: |
{{ . | indent 6 }}
{{- end }}
{{- with .certificate }}
certificate: |
{{ . | indent 6 }}
{{- end }}
{{- with .caCertificate }}
caCertificate: |
{{ . | nindent 6 }}
{{- end }}
{{- with .destinationCACertificate }}
destinationCACertificate: |
{{ . | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
to:
kind: Service
name: {{ $serviceName }}
{{- end }}
18 changes: 17 additions & 1 deletion charts/metabase/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,28 @@ ingress:
# hosts:
# - metabase.domain.com

route:
enabled: false
annotations:
{}
# haproxy.router.openshift.io/timeout: "60s"
# host: ""
path: ""
wildcardPolicy: "None"
tls:
{}
# termination: "Edge"
# insecureEdgeTerminationPolicy: "Redirect"
# key: ""
# certificate: ""
# caCertificate: ""
# destinationCACertificate: ""

# A custom log4j2.xml file can be provided using a multiline YAML string.
# See https://github.com/metabase/metabase/blob/master/resources/log4j2.xml
#
# log4j2XML:


# DEPRECATED; A custom log4j.properties file can be provided using a multiline YAML string.
# See https://github.com/metabase/metabase/blob/master/resources/log4j.properties
#
Expand Down

0 comments on commit 70793ef

Please sign in to comment.