Skip to content

Commit

Permalink
Support retool workflows
Browse files Browse the repository at this point in the history
Adds dependency on temporal and fully configures retool to use that temporal instance.  Need to create an annoying migration job manually since retool doesn't do that for us.
  • Loading branch information
michaeljguarino committed Sep 13, 2023
1 parent 5c1fe4b commit c5381a8
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 19 deletions.
6 changes: 3 additions & 3 deletions retool/helm/retool/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 0.1.5
- name: retool
repository: https://charts.retool.com
version: 5.0.10
digest: sha256:8254af8ff85a722613df60d3917966ebbc323578d31d97778544b005c5b15d71
generated: "2023-08-29T12:22:50.026082-04:00"
version: 6.0.0
digest: sha256:e9f0184bb0773073c0f1c8c6fb87edfd187534312cdd22e59bbc4bb99e869fda
generated: "2023-09-12T10:07:27.403885-04:00"
4 changes: 2 additions & 2 deletions retool/helm/retool/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apiVersion: v2
name: retool
description: helm chart for retool
type: application
version: 0.1.4
version: 0.1.5
appVersion: "v3.4.14"
dependencies:
- name: postgres
version: 0.1.5
repository: https://pluralsh.github.io/module-library
- name: retool
version: 5.0.10
version: 6.0.0
repository: https://charts.retool.com
Binary file removed retool/helm/retool/charts/retool-5.0.10.tgz
Binary file not shown.
Binary file added retool/helm/retool/charts/retool-6.0.0.tgz
Binary file not shown.
8 changes: 4 additions & 4 deletions retool/helm/retool/deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ spec:
name: bootstrap
repo: bootstrap
version: '>= 0.5.1'

- type: helm
name: ingress-nginx
repo: ingress-nginx
version: ">= 0.1.2"


- type: helm
name: postgres
repo: postgres
version: ">= 0.1.6"

- type: helm
name: temporal
repo: temporal
version: ">= 0.0.1"
- type: terraform
name: aws
repo: retool
Expand Down
20 changes: 10 additions & 10 deletions retool/helm/retool/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "retool.name" -}}
{{- define "retool-plural.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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 "retool.fullname" -}}
{{- define "retool-plural.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "retool.chart" -}}
{{- define "retool-plural.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "retool.labels" -}}
helm.sh/chart: {{ include "retool.chart" . }}
{{ include "retool.selectorLabels" . }}
{{- define "retool-plural.labels" -}}
helm.sh/chart: {{ include "retool-plural.chart" . }}
{{ include "retool-plural.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "retool.selectorLabels" -}}
app.kubernetes.io/name: {{ include "retool.name" . }}
{{- define "retool-plural.selectorLabels" -}}
app.kubernetes.io/name: {{ include "retool-plural.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "retool.serviceAccountName" -}}
{{- define "retool-plural.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "retool.fullname" .) .Values.serviceAccount.name }}
{{- default (include "retool-plural.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
44 changes: 44 additions & 0 deletions retool/helm/retool/templates/temporal-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: temporal-admintools
labels:
{{ include "retool-plural.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: tctl
{{ include "retool-plural.labels" . | nindent 6 }}
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: tctl
{{ include "retool-plural.labels" . | nindent 8 }}
spec:
containers:
- env:
- name: TEMPORAL_CLI_ADDRESS
value: "{{ .Values.retool.workflows.temporal.host }}.svc.cluster.local:{{ .Values.retool.workflows.temporal.port }}"
- name: TEMPORAL_ADDRESS
value: "{{ .Values.retool.workflows.temporal.host }}.svc.cluster.local:{{ .Values.retool.workflows.temporal.port }}"
image: temporalio/admin-tools:1.21.5
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- ls
- /
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
name: admin-tools
resources: {}
terminationGracePeriodSeconds: 30
28 changes: 28 additions & 0 deletions retool/helm/retool/templates/temporal-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ if .Values.setupTemporal }}
apiVersion: batch/v1
kind: Job
metadata:
name: temporal-setup
labels:
{{ include "retool-plural.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
spec:
template:
spec:
containers:
- name: create-namespace
image: temporalio/admin-tools:1.21.5
imagePullPolicy: Always
command:
- /bin/sh
- -c
- "until tctl cluster health &> /dev/null; do echo 'waiting for cluster' && sleep 1; done && tctl --namespace {{ .Values.retool.workflows.temporal.namespace }} namespace describe || tctl --namespace {{ .Values.retool.workflows.temporal.namespace }} namespace register"
env:
- name: TEMPORAL_CLI_ADDRESS
value: "{{ .Values.retool.workflows.temporal.host }}.svc.cluster.local:{{ .Values.retool.workflows.temporal.port }}"
- name: TEMPORAL_ADDRESS
value: "{{ .Values.retool.workflows.temporal.host }}.svc.cluster.local:{{ .Values.retool.workflows.temporal.port }}"
restartPolicy: Never
backoffLimit: 5
{{ end }}
9 changes: 9 additions & 0 deletions retool/helm/retool/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ postgres:
ownerChart: retool
infix: -postgres

setupTemporal: true

retool:
replicaCount: 2

image:
repository: tryretool/backend
tag: 3.4.14

workflows:
temporal:
enabled: true
port: 7233
namespace: retool
host: temporal-frontend.temporal

postgresql:
enabled: false
Expand Down
3 changes: 3 additions & 0 deletions retool/helm/retool/values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ global:
url: {{ .Values.hostname }}

retool:
workflows:
temporal:
host: temporal-frontend.{{ namespace "temporal" }}
config:
licenseKey: {{ .Values.licenseKey }}
encryptionKey: {{ dedupe . "retool.retool.config.encryptionKey" (randAlphaNum 26) }}
Expand Down

0 comments on commit c5381a8

Please sign in to comment.