Skip to content

Commit 43bd3c7

Browse files
authored
[fix] Retool internal versions are not semver compliant, so ensure that our helm chart is able to support all version formats (#196)
1 parent c7d8d30 commit 43bd3c7

9 files changed

+68
-22
lines changed

.github/kubeconform.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ for CHART_DIR in ${CHART_DIRS}; do
2121
echo "Running kubeconform for folder: '$CHART_DIR'"
2222
helm dep up "${CHART_DIR}"
2323
for VALUES_FILE in $(find "${CHART_DIR}/ci" -name '*values.yaml'); do
24-
echo "== Checking values file: ${VALUES_FILE}"
2524
helm template --kube-version "${KUBERNETES_VERSION#v}" --values "${VALUES_FILE}" "${CHART_DIR}" \
2625
| ./kubeconform --strict --summary --kubernetes-version "${KUBERNETES_VERSION#v}"
26+
for OPTION_FILE in $(find "${CHART_DIR}/ci" -name '*option.yaml'); do
27+
echo "== Checking values file: ${VALUES_FILE} and option file: ${OPTION_FILE}"
28+
helm template --kube-version "${KUBERNETES_VERSION#v}" --values "${VALUES_FILE}" --values "${OPTION_FILE}" "${CHART_DIR}" \
29+
| ./kubeconform --strict --summary --kubernetes-version "${KUBERNETES_VERSION#v}"
30+
done
2731
done
2832
done

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
version: v3.6.3
2828
- uses: actions/setup-python@v4
2929
with:
30-
python-version: 3.7
30+
python-version: 3.12
3131
- name: Set up chart-testing
3232
uses: helm/[email protected]
3333
- name: Run chart-testing (list-changed)
@@ -64,7 +64,7 @@ jobs:
6464
fetch-depth: 0
6565
- uses: actions/setup-python@v4
6666
with:
67-
python-version: 3.7
67+
python-version: 3.12
6868
- name: Set up chart-testing
6969
uses: helm/[email protected]
7070
- name: Run chart-testing (lint)

charts/retool/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: retool
33
description: A Helm chart for Kubernetes
44
type: application
5-
version: 6.2.14
5+
version: 6.2.15
66
maintainers:
77
- name: Retool Engineering
88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
image:
2+
tag: "100.100.0-edge"
3+
dbconnector:
4+
java:
5+
enabled: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
image:
2+
tag: "i.am.not-a.real-version"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
image:
2+
tag: "3.0.0-stable"

charts/retool/templates/_helpers.tpl

+23-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
5050
{{/*
5151
Selector labels for main backend. Note changes here will require deployment
5252
recreation and incur downtime. The "app.kubernetes.io/instance" label should
53-
also be included in all deployments, so telemetry knows how to find logs.
53+
also be included in all deployments, so telemetry knows how to find logs.
5454
*/}}
5555
{{- define "retool.selectorLabels" -}}
5656
app.kubernetes.io/name: {{ include "retool.name" . }}
@@ -200,6 +200,8 @@ Usage: (include "retool.workflows.enabled" .)
200200
*/}}
201201
{{- define "retool.workflows.enabled" -}}
202202
{{- $output := "" -}}
203+
{{- $valid_retool_version_regexp := "([0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-zA-Z0-9]+)?)" }}
204+
{{- $retool_version_with_workflows := ( and ( regexMatch $valid_retool_version_regexp $.Values.image.tag ) ( semverCompare ">= 3.6.11-0" ( regexFind $valid_retool_version_regexp $.Values.image.tag ) ) ) }}
203205
{{- if or
204206
(eq (toString .Values.workflows.enabled) "true")
205207
(eq (toString .Values.workflows.enabled) "false")
@@ -213,7 +215,7 @@ Usage: (include "retool.workflows.enabled" .)
213215
{{- $output = "" -}}
214216
{{- else if eq .Values.image.tag "latest" -}}
215217
{{- $output = "1" -}}
216-
{{- else if semverCompare ">= 3.6.11-0" .Values.image.tag -}}
218+
{{- else if $retool_version_with_workflows -}}
217219
{{- $output = "1" -}}
218220
{{- else -}}
219221
{{- $output = "" -}}
@@ -227,6 +229,8 @@ Usage: (include "retool.codeExecutor.enabled" .)
227229
*/}}
228230
{{- define "retool.codeExecutor.enabled" -}}
229231
{{- $output := "" -}}
232+
{{- $valid_retool_version_regexp := "([0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-zA-Z0-9]+)?)" }}
233+
{{- $retool_version_with_ce := ( and ( regexMatch $valid_retool_version_regexp (include "retool.codeExecutor.image.tag" .) ) ( semverCompare ">= 3.20.15-0" ( regexFind $valid_retool_version_regexp (include "retool.codeExecutor.image.tag" .) ) ) ) }}
230234
{{- if or
231235
(eq (toString .Values.codeExecutor.enabled) "true")
232236
(eq (toString .Values.codeExecutor.enabled) "false")
@@ -240,7 +244,7 @@ Usage: (include "retool.codeExecutor.enabled" .)
240244
{{- $output = "" -}}
241245
{{- else if (or (contains "stable" (include "retool.codeExecutor.image.tag" .)) (contains "edge" (include "retool.codeExecutor.image.tag" .))) -}}
242246
{{- $output = "1" -}}
243-
{{- else if semverCompare ">= 3.20.15-0" (include "retool.codeExecutor.image.tag" .) -}}
247+
{{- else if $retool_version_with_ce -}}
244248
{{- $output = "1" -}}
245249
{{- else -}}
246250
{{- $output = "" -}}
@@ -319,11 +323,13 @@ Usage: (template "retool.codeExecutor.image.tag" .)
319323
{{- if .Values.codeExecutor.image.tag -}}
320324
{{- .Values.codeExecutor.image.tag -}}
321325
{{- else if .Values.image.tag -}}
326+
{{- $valid_retool_version_regexp := "([0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-zA-Z0-9]+)?)" }}
327+
{{- $retool_version_with_ce := ( and ( regexMatch $valid_retool_version_regexp $.Values.image.tag ) ( semverCompare ">= 3.20.15-0" ( regexFind $valid_retool_version_regexp $.Values.image.tag ) ) ) }}
322328
{{- if and (eq .Values.image.tag "latest") (eq (toString .Values.codeExecutor.enabled) "true") -}}
323329
{{- fail "If using image.tag=latest (not recommended, select an explicit tag instead) and enabling codeExecutor, explicitly set codeExecutor.image.tag" }}
324330
{{- else if (eq .Values.image.tag "latest") -}}
325331
{{- "" -}}
326-
{{- else if semverCompare ">= 3.20.15-0" .Values.image.tag -}}
332+
{{- else if $retool_version_with_ce -}}
327333
{{- .Values.image.tag -}}
328334
{{- else -}}
329335
{{- "1.1.0" -}}
@@ -332,3 +338,16 @@ Usage: (template "retool.codeExecutor.image.tag" .)
332338
{{- fail "Please set a value for .Values.image.tag" }}
333339
{{- end -}}
334340
{{- end -}}
341+
342+
{{- define "retool_version_with_java_dbconnector_opt_out" -}}
343+
{{- $output := "" -}}
344+
{{- $valid_retool_version_regexp := "([0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-zA-Z0-9]+)?)" }}
345+
{{- if not ( regexMatch $valid_retool_version_regexp .Values.image.tag ) -}}
346+
{{- $output = "1" -}}
347+
{{- else if semverCompare ">= 3.93.0-0" ( regexFind $valid_retool_version_regexp .Values.image.tag ) -}}
348+
{{- $output = "1" -}}
349+
{{- else -}}
350+
{{- $output = "" -}}
351+
{{- end -}}
352+
{{- $output -}}
353+
{{- end -}}

charts/retool/templates/deployment_backend.yaml

+17-11
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,27 @@ spec:
7777
value: {{ template "retool.deploymentTemplateVersion" . }}
7878
- name: NODE_ENV
7979
value: production
80-
{{- if include "retool.jobRunner.enabled" . }}
81-
{{ if ( not $.Values.dbconnector.java.enabled ) }}
82-
- name: DISABLE_JAVA_DBCONNECTOR
83-
value: "true"
84-
{{ end }}
80+
{{- $serviceType := list "MAIN_BACKEND" "DB_CONNECTOR" "DB_SSH_CONNECTOR" }}
81+
{{- /*
82+
JAVA_DBCONNECTOR in the service type only applies before the version of Retool that changes it to opt-out (3.93.0-edge),
83+
and only if the Java dbconnector is enabled in values.yaml.
84+
*/}}
85+
{{- if and ( not ( include "retool_version_with_java_dbconnector_opt_out" . ) ) ( $.Values.dbconnector.java.enabled ) }}
86+
{{- $serviceType = append $serviceType "JAVA_DBCONNECTOR" }}
87+
{{- end }}
88+
{{- /*
89+
It may seem counterintuitive to add the JOBS_RUNNER service type only without a jobs runner.
90+
The reason for this is that the backend needs to act as a jobs runner, if the jobs runner is not enabled.
91+
*/}}
92+
{{- if not .Values.jobRunner.enabled }}
93+
{{- $serviceType = append $serviceType "JOBS_RUNNER" }}
94+
{{- end }}
8595
- name: SERVICE_TYPE
86-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR
87-
{{- else }}
88-
{{ if ( not $.Values.dbconnector.java.enabled ) }}
96+
value: {{ join "," $serviceType }}
97+
{{ if and ( include "retool_version_with_java_dbconnector_opt_out" . ) ( not $.Values.dbconnector.java.enabled ) }}
8998
- name: DISABLE_JAVA_DBCONNECTOR
9099
value: "true"
91100
{{ end }}
92-
- name: SERVICE_TYPE
93-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR,JOBS_RUNNER
94-
{{- end }}
95101
- name: CLIENT_ID
96102
value: {{ default "" .Values.config.auth.google.clientId }}
97103
- name: COOKIE_INSECURE

charts/retool/templates/deployment_workflows.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,20 @@ spec:
6666
value: {{ template "retool.deploymentTemplateVersion" . }}
6767
- name: NODE_ENV
6868
value: production
69-
{{ if ( not $.Values.dbconnector.java.enabled ) }}
69+
{{- $serviceType := list "WORKFLOW_BACKEND" "DB_CONNECTOR" "DB_SSH_CONNECTOR" }}
70+
{{- /*
71+
JAVA_DBCONNECTOR in the service type only applies before the version of Retool that changes it to opt-out (3.93.0-edge),
72+
and only if the Java dbconnector is enabled in values.yaml.
73+
*/}}
74+
{{- if and ( not ( include "retool_version_with_java_dbconnector_opt_out" . ) ) ( $.Values.dbconnector.java.enabled ) }}
75+
{{- $serviceType = append $serviceType "JAVA_DBCONNECTOR" }}
76+
{{- end }}
77+
- name: SERVICE_TYPE
78+
value: {{ join "," $serviceType }}
79+
{{ if and ( include "retool_version_with_java_dbconnector_opt_out" . ) ( not $.Values.dbconnector.java.enabled ) }}
7080
- name: DISABLE_JAVA_DBCONNECTOR
7181
value: "true"
7282
{{ end }}
73-
- name: SERVICE_TYPE
74-
value: WORKFLOW_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR
7583
- name: DBCONNECTOR_POSTGRES_POOL_MAX_SIZE
7684
value: "100"
7785
- name: DBCONNECTOR_QUERY_TIMEOUT_MS

0 commit comments

Comments
 (0)