-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from restackio/main
Add Ingress Support
- Loading branch information
Showing
6 changed files
with
214 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters