Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi Moondra authored and Avi Moondra committed Sep 15, 2023
1 parent f48fa0a commit 2aa778a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
29 changes: 13 additions & 16 deletions charts/retool/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,28 @@ Set postgresql user

{{/*
Set Workflows enabled
Usage: (include "retool.workflows.enabled" .)
*/}}
{{- define "retool.workflows.enabled" -}}
{{- $output := "" -}}
{{- if or (eq .Values.workflows.enabled true) (eq .Values.workflows.enabled false) -}}
{{- .Values.workflows.enabled | default false }}
{{- if eq .Values.workflows.enabled true -}}
{{- $output = "1" -}}
{{- else }}
{{- $output = "" -}}
{{- end -}}
{{- else if empty .Values.image.tag }}
{{- false }}
{{- $output = "" -}}
{{- else if eq .Values.image.tag "latest" }}
{{- true }}
{{- $output = "1" -}}
{{- else if semverCompare ">= 3.6.11" .Values.image.tag }}
{{- $output = "1" -}}
{{- else }}
{{- semverCompare ">= 3.6.11" .Values.image.tag }}
{{- $output = "" -}}
{{- end }}
{{ $output }}
{{- end }}

{{/*
Custom template function to cast a string to a boolean.
Usage: {{ toBool .SomeString }}
*/}}
{{- define "strToBool" -}}
{{- $output := "" -}}
{{- if (eq . "true") -}}
{{- $output = "1" -}}
{{- end -}}
{{ $output }}
{{- end -}}

{{/*
Set Temporal frontend host
*/}}
Expand Down
4 changes: 2 additions & 2 deletions charts/retool/templates/deployment_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ spec:
- name: DBCONNECTOR_QUERY_TIMEOUT_MS
value: {{ .Values.config.dbConnectorTimeout | quote }}
{{- end }}
{{- if and ((include "retool.workflows.enabled" .) | include "strToBool") (or (index .Values "retool-temporal-services-helm" "enabled") (.Values.workflows.temporal.enabled)) }}
{{- if and (include "retool.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 ((include "retool.workflows.enabled" .) | include "strToBool") }}
{{- if include "retool.workflows.enabled" . }}
- name: WORKFLOW_BACKEND_HOST
value: http://{{ template "retool.fullname" . }}-workflow-backend
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_workflows.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if ((include "retool.workflows.enabled" .) | include "strToBool") }}
{{- if include "retool.workflows.enabled" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_workflows_worker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if ((include "retool.workflows.enabled" .) | include "strToBool") }}
{{- if include "retool.workflows.enabled" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
3 changes: 1 addition & 2 deletions charts/retool/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ data:
postgresql-password: {{ .Values.config.postgresql.password | default "" | b64enc | quote }}
{{ end }}

{{ if .Values.workflows.temporal.sslKey }}
{{ if (.Values.workflows.temporal).sslKey }}
temporal-tls-key: {{ .Values.workflows.temporal.sslKey | default "" | b64enc | quote }}
{{ end }}

{{- end }}

0 comments on commit 2aa778a

Please sign in to comment.