Skip to content

Commit 1ade41a

Browse files
Merge branch 'tryretool:main' into remove_unused_domain
2 parents 3b2b74d + 1852808 commit 1ade41a

18 files changed

+254
-43
lines changed

.github/kubeconform.sh

Lines changed: 5 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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.8
5+
version: 6.3.2
66
maintainers:
77
- name: Retool Engineering
88

charts/retool/ci/kubeconform/telemetry-enabled-full-values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ replicaCount: 1
5050

5151
persistentVolumeClaim:
5252
size: '3Gi'
53+
54+
securityContext:
55+
enabled: true
56+
runAsUser: 1000
57+
fsGroup: 2000
58+
extraContainerLevelSecurityContext:
59+
allowPrivilegeEscalation: false
5360
# ================================================
5461

5562
# === New telemetry stuff ===
Lines changed: 5 additions & 0 deletions
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
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# default security context
2+
securityContext:
3+
enabled: true
4+
runAsUser: 10
5+
fsGroup: 20
6+
extraSecurityContext:
7+
runAsNonRoot: true
8+
extraContainerLevelSecurityContext:
9+
allowPrivilegeEscalation: false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
image:
2+
tag: "i.am.not-a.real-version"
Lines changed: 2 additions & 0 deletions
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

Lines changed: 23 additions & 4 deletions
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

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ metadata:
55
labels:
66
{{- include "retool.labels" . | nindent 4 }}
77
{{- include "retool.selectorLabels" . | nindent 4 }}
8+
{{- if .Values.deployment.labels }}
9+
{{ toYaml .Values.deployment.labels | indent 4 }}
10+
{{- end }}
811
{{- if .Values.deployment.annotations }}
912
annotations:
1013
{{ toYaml .Values.deployment.annotations | indent 4 }}
@@ -74,23 +77,27 @@ spec:
7477
value: {{ template "retool.deploymentTemplateVersion" . }}
7578
- name: NODE_ENV
7679
value: production
77-
{{- if include "retool.jobRunner.enabled" . }}
78-
{{ if $.Values.dbconnector.java.enabled }}
79-
- name: SERVICE_TYPE
80-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR,JAVA_DBCONNECTOR
81-
{{ else }}
82-
- name: SERVICE_TYPE
83-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR
84-
{{ end }}
85-
{{- else }}
86-
{{ if $.Values.dbconnector.java.enabled }}
87-
- name: SERVICE_TYPE
88-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR,JAVA_DBCONNECTOR,JOBS_RUNNER
89-
{{ else }}
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 ( include "retool.jobRunner.enabled" . ) }}
93+
{{- $serviceType = append $serviceType "JOBS_RUNNER" }}
94+
{{- end }}
9095
- name: SERVICE_TYPE
91-
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR,JOBS_RUNNER
96+
value: {{ join "," $serviceType }}
97+
{{ if and ( include "retool_version_with_java_dbconnector_opt_out" . ) ( not $.Values.dbconnector.java.enabled ) }}
98+
- name: DISABLE_JAVA_DBCONNECTOR
99+
value: "true"
92100
{{ end }}
93-
{{- end }}
94101
- name: CLIENT_ID
95102
value: {{ default "" .Values.config.auth.google.clientId }}
96103
- name: COOKIE_INSECURE
@@ -263,6 +270,12 @@ spec:
263270
successThreshold: {{ .Values.readinessProbe.successThreshold }}
264271
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
265272
{{- end }}
273+
{{- if .Values.preStopHook.enabled }}
274+
lifecycle:
275+
preStop:
276+
exec:
277+
command: ["sleep", "30"]
278+
{{- end }}
266279
{{- if .Values.startupProbe.enabled }}
267280
startupProbe:
268281
httpGet:
@@ -295,6 +308,10 @@ spec:
295308
- name: {{ .name }}
296309
mountPath: {{ .mountPath }}
297310
subPath: {{ .subPath }}
311+
{{- end }}
312+
{{- if .Values.securityContext.extraContainerSecurityContext }}
313+
securityContext:
314+
{{ toYaml .Values.securityContext.extraContainerSecurityContext | indent 10 }}
298315
{{- end }}
299316
{{- if .Values.image.pullSecrets }}
300317
imagePullSecrets:
@@ -314,6 +331,9 @@ spec:
314331
securityContext:
315332
runAsUser: {{ .Values.securityContext.runAsUser }}
316333
fsGroup: {{ .Values.securityContext.fsGroup }}
334+
{{- if .Values.securityContext.extraSecurityContext }}
335+
{{ toYaml .Values.securityContext.extraSecurityContext | indent 8 }}
336+
{{- end }}
317337
{{- end }}
318338
volumes:
319339
{{- range .Values.extraConfigMapMounts }}

0 commit comments

Comments
 (0)