Skip to content

Commit

Permalink
Merge pull request #13 from restackio/main
Browse files Browse the repository at this point in the history
Add Ingress Support
  • Loading branch information
adishM98 committed Oct 6, 2023
2 parents 8efbf53 + 9b5614f commit c4e57af
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/tooljet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ dependencies:
version: "16.13.2"
repository: "https://charts.bitnami.com/bitnami"

version: 2.6.0
version: 2.6.1
appVersion: "v1.21.5"
42 changes: 42 additions & 0 deletions charts/tooljet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{/*
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 "tooljet.fullname" -}}
{{- $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 }}

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

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

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "tooljet.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
105 changes: 105 additions & 0 deletions charts/tooljet/templates/configmap-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "tooljet.fullname" . }}-nginx-config-template
labels:
app: {{ template "tooljet.fullname" . }}
chart: {{ template "tooljet.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
nginx.conf.template: "
events
{
worker_connections 1024;
}
http
{
server
{
location /
{
root /var/www;
try_files $uri $uri/ /index.html @proxy;
error_page 405 @proxy;
}
location /api/
{
try_files /_bypass_to_proxy @proxy;
}
location /ws
{
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}

location /yjs
{
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}

location @proxy {
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_redirect off;
proxy_set_header Host $host;
}
}

server
{
listen 80;

location /
{
root /var/www;
try_files $uri $uri/ /index.html @proxy;
error_page 405 @proxy;
}

location /api/
{
try_files /_bypass_to_proxy @proxy;
}

location /ws
{
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}

location /yjs
{
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}

location @proxy {
proxy_pass http://{{ template "tooljet.fullname" . }}:3000;
proxy_redirect off;
proxy_set_header Host $host;
}
}

server
{
listen 127.0.0.1:8999;
client_body_buffer_size 128k;
client_max_body_size 128k;
}
}"
55 changes: 55 additions & 0 deletions charts/tooljet/templates/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "tooljet.fullname" . -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "tooljet.fullname" . }}
labels:
{{- include "tooljet.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
tls:
- hosts:
- {{ .Values.ingress.hostname }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- if .Values.ingress.hostname }}
- host: {{ .Values.ingress.hostname }}
http:
paths:
- path: /
pathType: 'Prefix'
backend:
service:
name: {{ template "tooljet.fullname" . }}
port:
number: 3000
{{- end }}
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: /
pathType: 'Prefix'
backend:
service:
name: {{ $fullName }}
port:
number: 3000
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/tooljet/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: tooljet
name: {{ template "tooljet.fullname" . }}
spec:
type: {{ .Values.apps.tooljet.service.type }}
ports:
Expand Down
13 changes: 10 additions & 3 deletions charts/tooljet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apps:
tooljet:
service:
type: ClusterIP
host: "http://localhost"
host: "http://tooljet.localhost"
deployment:
image:
repository: tooljet/tooljet-ce
Expand All @@ -27,7 +27,16 @@ apps:
lockbox_key: "0123456789ABCDEF"
secret_key_base: "0123456789ABCDEF"

ingress:
enabled: true
hostname: tooljet.localhost
ingressClassName: 'nginx'
kubernetes.io/ingress.class: "nginx"
annotations:
{}
tls: []
# https://artifacthub.io/packages/helm/bitnami/postgresql#global-parameters

postgresql:
enabled: true
postgresqlExtendedConf:
Expand Down Expand Up @@ -99,5 +108,3 @@ service:
type: ClusterIP
port: 3000
annotations: {}


0 comments on commit c4e57af

Please sign in to comment.