Skip to content

Commit 13064d4

Browse files
authored
add agents (#241)
* add agents * templatize temporal workers * refactor temporal out of workflows * better interface * fmt * test agents enabled option * agents enables workflows * use temporalConfig helper * fix label handling * re-refactor workers * fmt * allow overriding worker affinity * add usage note * bump version
1 parent b5c6898 commit 13064d4

11 files changed

+635
-435
lines changed

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.5.0
5+
version: 6.6.0
66
maintainers:
77
- name: Retool Engineering
88
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
agents:
2+
enabled: true

charts/retool/templates/_helpers.tpl

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,39 @@ app.kubernetes.io/instance: {{ .Release.Name }}
125125
telemetry.retool.com/service-name: code-executor
126126
{{- end }}
127127

128+
{{/*
129+
Selector labels for agent worker. Note changes here will require manual
130+
deployment recreation and incur downtime, so should be avoided.
131+
*/}}
132+
{{- define "retool.agentWorker.selectorLabels" -}}
133+
retoolService: {{ include "retool.agentWorker.name" . }}
134+
{{- end }}
135+
136+
{{/*
137+
Extra (non-selector) labels for agent worker.
138+
*/}}
139+
{{- define "retool.agentWorker.labels" -}}
140+
app.kubernetes.io/name: {{ include "retool.agentWorker.name" . }}
141+
app.kubernetes.io/instance: {{ .Release.Name }}
142+
telemetry.retool.com/service-name: agent-worker
143+
{{- end }}
144+
145+
{{/*
146+
Selector labels for agent eval worker. Note changes here will require manual
147+
deployment recreation and incur downtime, so should be avoided.
148+
*/}}
149+
{{- define "retool.agentEvalWorker.selectorLabels" -}}
150+
retoolService: {{ include "retool.agentEvalWorker.name" . }}
151+
{{- end }}
152+
153+
{{/*
154+
Extra (non-selector) labels for agent eval worker.
155+
*/}}
156+
{{- define "retool.agentEvalWorker.labels" -}}
157+
app.kubernetes.io/name: {{ include "retool.agentEvalWorker.name" . }}
158+
app.kubernetes.io/instance: {{ .Release.Name }}
159+
telemetry.retool.com/service-name: agent-eval-worker
160+
{{- end }}
128161

129162
{{/*
130163
Create the name of the service account to use
@@ -237,6 +270,9 @@ Usage: (include "retool.workflows.enabled" .)
237270
{{- else -}}
238271
{{- $output = "" -}}
239272
{{- end -}}
273+
{{- if (eq (toString .Values.agents.enabled) "true") -}} {{/* workflows (backend) is required to use agents */}}
274+
{{- $output = "1" -}}
275+
{{- end -}}
240276
{{- $output -}}
241277
{{- end -}}
242278

@@ -269,13 +305,30 @@ Usage: (include "retool.codeExecutor.enabled" .)
269305
{{- $output -}}
270306
{{- end -}}
271307

308+
{{/*
309+
Set agents enabled
310+
Usage: (include "retool.agents.enabled" .)
311+
*/}}
312+
{{- define "retool.agents.enabled" -}}
313+
{{- $output := "" -}}
314+
{{- if (eq (toString .Values.agents.enabled) "true") -}}
315+
{{- $output = "1" -}}
316+
{{- end -}}
317+
{{- $output -}}
318+
{{- end -}}
319+
320+
{{/* Global Temporal configuration */}}
321+
{{- define "retool.temporalConfig" -}}
322+
{{- .Values.workflows.temporal | default .Values.temporal | toYaml -}}
323+
{{- end -}}
272324

273325
{{/*
274326
Set Temporal frontend host
275327
*/}}
276328
{{- define "retool.temporal.host" -}}
277-
{{- if (.Values.workflows.temporal).enabled -}}
278-
{{- .Values.workflows.temporal.host | quote -}}
329+
{{- $temporalConfig := include "retool.temporalConfig" . | fromYaml -}}
330+
{{- if $temporalConfig.enabled -}}
331+
{{- $temporalConfig.host | quote -}}
279332
{{- else -}}
280333
{{- printf "%s-%s" (include "temporal.fullname" (index .Subcharts "retool-temporal-services-helm")) "frontend" -}}
281334
{{- end -}}
@@ -285,8 +338,9 @@ Set Temporal frontend host
285338
Set Temporal frontend port
286339
*/}}
287340
{{- define "retool.temporal.port" -}}
288-
{{- if (.Values.workflows.temporal).enabled -}}
289-
{{- .Values.workflows.temporal.port | quote -}}
341+
{{- $temporalConfig := include "retool.temporalConfig" . | fromYaml -}}
342+
{{- if $temporalConfig.enabled -}}
343+
{{- $temporalConfig.port | quote -}}
290344
{{- else -}}
291345
{{- "7233" | quote -}}
292346
{{- end -}}
@@ -296,8 +350,9 @@ Set Temporal frontend port
296350
Set Temporal namespace
297351
*/}}
298352
{{- define "retool.temporal.namespace" -}}
299-
{{- if (.Values.workflows.temporal).enabled -}}
300-
{{- .Values.workflows.temporal.namespace | quote -}}
353+
{{- $temporalConfig := include "retool.temporalConfig" . | fromYaml -}}
354+
{{- if $temporalConfig.enabled -}}
355+
{{- $temporalConfig.namespace | quote -}}
301356
{{- else -}}
302357
{{- "workflows" | quote -}}
303358
{{- end -}}
@@ -338,6 +393,19 @@ Set multiplayer service name
338393
{{ template "retool.fullname" . }}-multiplayer-ws
339394
{{- end -}}
340395

396+
{{/*
397+
Set agent worker service name
398+
*/}}
399+
{{- define "retool.agentWorker.name" -}}
400+
{{ template "retool.fullname" . }}-agent-worker
401+
{{- end -}}
402+
403+
{{/*
404+
Set agent eval worker service name
405+
*/}}
406+
{{- define "retool.agentEvalWorker.name" -}}
407+
{{ template "retool.fullname" . }}-agent-eval-worker
408+
{{- end -}}
341409

342410
{{/*
343411
Set code executor image tag

0 commit comments

Comments
 (0)