Skip to content

Commit

Permalink
merge in retool-workflows-helm
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi Moondra authored and Avi Moondra committed Sep 7, 2023
1 parent 60c7051 commit 55ae1e3
Show file tree
Hide file tree
Showing 11 changed files with 1,111 additions and 12 deletions.
File renamed without changes.
7 changes: 5 additions & 2 deletions charts/retool/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.5
digest: sha256:8607eadb8d79b34833608ccbb74e2d45be7ce35545eb8815254d6bed42854f6f
generated: "2023-03-20T13:18:05.170549-07:00"
- name: retool-temporal-services
repository: ""
version: 1.1.2
digest: sha256:5ed0c5db868514a511b428b847d5b8c570cf09bf009177328208989029124e94
generated: "2023-09-07T13:59:44.649522-04:00"
3 changes: 3 additions & 0 deletions charts/retool/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dependencies:
version: 12.1.5
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: retool-temporal-services
version: 1.1.2
condition: retool-temporal-services.enabled,workflows.enabled
40 changes: 40 additions & 0 deletions charts/retool/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,43 @@ Set postgresql user
{{- .Values.config.postgresql.user | quote -}}
{{- end -}}
{{- end -}}

{{/*
Set Temporal frontend host
*/}}
{{- define "retool.temporal.host" -}}
{{- if (.Values.workflows.temporal).enabled -}}
{{- .Values.workflows.temporal.host | quote -}}
{{- else -}}
{{- printf "%s-%s" (include "temporal.fullname" (index .Subcharts "retool-temporal-services")) "frontend" -}}
{{- end -}}
{{- end -}}

{{/*
Set Temporal frontend port
*/}}
{{- define "retool.temporal.port" -}}
{{- if (.Values.workflows.temporal).enabled -}}
{{- .Values.workflows.temporal.port | quote -}}
{{- else -}}
{{- "7233" | quote -}}
{{- end -}}
{{- end -}}

{{/*
Set Temporal namespace
*/}}
{{- define "retool.temporal.namespace" -}}
{{- if (.Values.workflows.temporal).enabled -}}
{{- .Values.workflows.temporal.namespace | quote -}}
{{- else -}}
{{- "workflows" | quote -}}
{{- end -}}
{{- end -}}

{{/*
Set code executor service name
*/}}
{{- define "retool.codeExecutor.name" -}}
{{ template "retool.fullname" . }}-code-executor
{{- end -}}
49 changes: 47 additions & 2 deletions charts/retool/templates/deployment_backend.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "retool.fullname" . }}
name: {{ template "retool.fullname" . }}-main-backend
labels:
{{- include "retool.labels" . | nindent 4 }}
{{- if .Values.deployment.annotations }}
Expand Down Expand Up @@ -60,6 +60,9 @@ spec:
{{- if gt (int (toString (.Values.replicaCount))) 1 }}
- name: SERVICE_TYPE
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR
{{- else }}
- name: SERVICE_TYPE
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR,JOBS_RUNNER
{{- end }}
- name: CLIENT_ID
value: {{ default "" .Values.config.auth.google.clientId }}
Expand All @@ -77,6 +80,44 @@ spec:
value: {{ template "retool.postgresql.user" . }}
- name: POSTGRES_SSL_ENABLED
value: {{ template "retool.postgresql.ssl_enabled" . }}
{{- if .Values.config.dbConnectorTimeout }}
- name: DBCONNECTOR_QUERY_TIMEOUT_MS
value: {{ .Values.config.dbConnectorTimeout | quote }}
{{- end }}
{{- if and (.Values.workflows.enabled) (or (index .Values "retool-temporal-services-helm" "enabled") (.Values.workflows.temporal.enabled)) }}
- name: WORKFLOW_TEMPORAL_CLUSTER_FRONTEND_HOST
value: {{ template "retool.temporal.host" . }}
- name: WORKFLOW_TEMPORAL_CLUSTER_FRONTEND_PORT
value: {{ template "retool.temporal.port" . }}
- name: WORKFLOW_TEMPORAL_CLUSTER_NAMESPACE
value: {{ template "retool.temporal.namespace" . }}
{{- end }}
{{- if (.Values.workflows.enabled) }}
- name: WORKFLOW_BACKEND_HOST
value: http://{{ template "retool.fullname" . }}-workflow-backend
{{- end }}
{{- if (.Values.workflows.temporal).sslEnabled }}
- name: WORKFLOW_TEMPORAL_TLS_ENABLED
value: "true"
{{- if (and (.Values.workflows.temporal).sslCert (.Values.workflows.temporal).sslKey) }}
- name: WORKFLOW_TEMPORAL_TLS_CRT
value: {{ .Values.workflows.temporal.sslCert }}
- name: WORKFLOW_TEMPORAL_TLS_KEY
valueFrom:
secretKeyRef:
{{- if (.Values.workflows.temporal).sslKeySecretName }}
name: {{ .Values.workflows.temporal.sslKeySecretName }}
key: {{ .Values.workflows.temporal.sslKeySecretKey | default "temporal-tls-key" }}
{{- else }}
name: {{ template "retool.fullname" . }}
key: "temporal-tls-key"
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.codeExecutor.enabled }}
- name: CODE_EXECUTOR_INGRESS_DOMAIN
value: http://{{ template "retool.codeExecutor.name" . }}
{{- end }}
{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
- name: LICENSE_KEY
valueFrom:
Expand Down Expand Up @@ -158,6 +199,10 @@ spec:
envFrom:
- secretRef:
name: {{ .Values.externalSecrets.name }}
{{- range .Values.externalSecrets.secrets }}
- secretRef:
name: {{ .name }}
{{- end }}
{{- end }}
{{- if .Values.externalSecrets.externalSecretsOperator.enabled }}
envFrom:
Expand Down Expand Up @@ -257,7 +302,7 @@ spec:
{{- end }}
---
{{- if .Values.podDisruptionBudget }}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}}
apiVersion: policy/v1
{{- else -}}
apiVersion: policy/v1beta1
Expand Down
125 changes: 125 additions & 0 deletions charts/retool/templates/deployment_code_executor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{{- if .Values.codeExecutor.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "retool.codeExecutor.name" . }}
labels:
retoolService: {{ template "retool.codeExecutor.name" . }}
{{- include "retool.labels" . | nindent 4 }}
{{- if .Values.deployment.annotations }}
annotations:
{{ toYaml .Values.deployment.annotations | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.codeExecutor.replicaCount }}
selector:
matchLabels:
retoolService: {{ template "retool.codeExecutor.name" . }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
annotations:
prometheus.io/job: {{ template "retool.codeExecutor.name" . }}
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.codeExecutor.annotations }}
{{ toYaml .Values.codeExecutor.annotations | indent 8 }}
{{- end }}
labels:
retoolService: {{ template "retool.codeExecutor.name" . }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
{{- if .Values.codeExecutor.labels }}
{{ toYaml .Values.codeExecutor.labels | indent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "retool.serviceAccountName" . }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.initContainers }}
initContainers:
{{- range $key, $value := .Values.initContainers }}
- name: "{{ $key }}"
{{ toYaml $value | indent 8 }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.codeExecutor.image.repository }}:{{ required "Please set a value for .Values.codeExecutor.image.tag" .Values.codeExecutor.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
privileged: true
env:
- name: NODE_ENV
value: production
- name: NODE_OPTIONS
value: {{(.Values.codeExecutor.config).nodeOptions | default "--max_old_space_size=1024" }}
{{- range $key, $value := .Values.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- range .Values.environmentSecrets }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ .secretKeyRef.name }}
key: {{ .secretKeyRef.key }}
{{- end }}
{{- with .Values.environmentVariables }}
{{ toYaml . | indent 10 }}
{{- end }}
ports:
- containerPort: 3004
name: {{ template "retool.name" . }}
protocol: TCP
- containerPort: 9090
name: metrics
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.livenessProbe.path }}
port: 3004
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.readinessProbe.path }}
port: 3004
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
{{- end }}
resources:
{{ toYaml .Values.codeExecutor.resources | indent 10 }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "retool.codeExecutor.name" . }}
spec:
selector:
retoolService: {{ template "retool.codeExecutor.name" . }}
ports:
- protocol: TCP
port: 80
targetPort: 3004
name: {{ template "retool.name" . }}
- protocol: TCP
port: 9090
targetPort: metrics
name: metrics
{{- end }}
4 changes: 4 additions & 0 deletions charts/retool/templates/deployment_jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ spec:
envFrom:
- secretRef:
name: {{ .Values.externalSecrets.name }}
{{- range .Values.externalSecrets.secrets }}
- secretRef:
name: {{ .name }}
{{- end }}
{{- end }}
{{- if .Values.externalSecrets.externalSecretsOperator.enabled }}
envFrom:
Expand Down
Loading

0 comments on commit 55ae1e3

Please sign in to comment.