Skip to content

Commit

Permalink
support 1 replica api backend with jobs runner
Browse files Browse the repository at this point in the history
  • Loading branch information
avimoondra committed Nov 19, 2023
1 parent 9296ef8 commit aa6f5c3
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 37 deletions.
2 changes: 1 addition & 1 deletion charts/retool/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: retool
description: A Helm chart for Kubernetes
type: application
version: 6.0.6
version: 6.0.7
maintainers:
- name: Retool Engineering
email: [email protected]
Expand Down
12 changes: 12 additions & 0 deletions charts/retool/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ Set postgresql user
{{- end -}}
{{- end -}}

{{/*
Set Jobs Runner enabled
Usage: (include "retool.jobRunner.enabled" .)
*/}}
{{- define "retool.jobRunner.enabled" -}}
{{- $output := "" -}}
{{- if or (gt (int (toString (.Values.replicaCount))) 1) (eq .Values.jobRunner.enabled true) }}
{{- $output = "1" -}}
{{- end -}}
{{- $output -}}
{{- end -}}

{{/*
Set Workflows enabled
Usage: (include "retool.workflows.enabled" .)
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
env:
- name: NODE_ENV
value: production
{{- if gt (int (toString (.Values.replicaCount))) 1 }}
{{- if include "retool.jobRunner.enabled" . }}
- name: SERVICE_TYPE
value: MAIN_BACKEND,DB_CONNECTOR,DB_SSH_CONNECTOR
{{- else }}
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_jobs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if gt (int (toString (.Values.replicaCount))) 1 }}
{{- if include "retool.jobRunner.enabled" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
47 changes: 30 additions & 17 deletions charts/retool/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ config:

# IMPORTANT: Incompatible with postgresql subchart
# Please disable the subchart in order to use a managed or external postgres instance.
postgresql: {}
postgresql:
{}
# Specify if postgresql subchart is disabled
# host:
# port:
Expand All @@ -58,7 +59,8 @@ env: {}

# Optionally specify additional environment variables to be populated from Kubernetes secrets.
# Useful for passing in SCIM_AUTH_TOKEN or other secret environment variables from Kubernetes secrets.
environmentSecrets: []
environmentSecrets:
[]
# - name: SCIM_AUTH_TOKEN
# secretKeyRef:
# name: retool-scim-auth-token
Expand All @@ -70,7 +72,8 @@ environmentSecrets: []

# Optionally specify environmental variables. Useful for variables that are not key-value, as env: {} above requires.
# Can also include environment secrets here instead of in environmentSecrets
environmentVariables: []
environmentVariables:
[]
# - name: SCIM_AUTH_TOKEN
# valueFrom:
# secretKeyRef:
Expand All @@ -94,7 +97,8 @@ externalSecrets:
enabled: false
name: retool-config
# Array of secrets to be use as env variables. (Optional)
secrets: []
secrets:
[]
# - name: retool-config
# - name: retool-db
# Support for External Secrets Operator: https://github.com/external-secrets/external-secrets
Expand All @@ -104,7 +108,8 @@ externalSecrets:
# Default set to AWS Secrets Manager.
backendType: secretsManager
# Array of name/path key/value pairs to use for the External Secrets Objects.
secretRef: []
secretRef:
[]
# - name: retool-config
# path: global-retool-config
# - name: retool-db
Expand Down Expand Up @@ -244,15 +249,15 @@ priorityClassName: ""
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- retool
topologyKey: "kubernetes.io/hostname"
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- retool
topologyKey: "kubernetes.io/hostname"

# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Expand All @@ -265,9 +270,6 @@ nodeSelector: {}
# Common annotations for all pods (backend and job runner).
podAnnotations: {}

# Increasing replica count will deploy a separate pod for backend and jobs
# Example: with 3 replicas, you will end up with 3 backends + 1 jobs pod
replicaCount: 2
revisionHistoryLimit: 3

# Optional pod disruption budget, for ensuring higher availability of the
Expand All @@ -282,7 +284,18 @@ revisionHistoryLimit: 3
# Common labels for all pods (backend and job runner) for pod assignment
podLabels: {}

# Increasing replica count will deploy a separate pod for backend and jobs
# Example 1: with 1 replicas, you will end up with 1 combined backend and jobs pod (unless jobRunner.enabled is true, see below)
# Example 2: with 2 replicas, you will end up with 2 backends + 1 jobs pod
# Example 3: with 3 replicas, you will end up with 3 backends + 1 jobs pod
replicaCount: 2

jobRunner:
# explicitly enable this pod if exactly 1 api backend container and
# 1 jobs runner container is desired. otherwise a replicaCount of 2
# will already launch a job runner pod
# enabled: true

# Annotations for job runner pods
annotations: {}

Expand Down
47 changes: 30 additions & 17 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ config:

# IMPORTANT: Incompatible with postgresql subchart
# Please disable the subchart in order to use a managed or external postgres instance.
postgresql: {}
postgresql:
{}
# Specify if postgresql subchart is disabled
# host:
# port:
Expand All @@ -58,7 +59,8 @@ env: {}

# Optionally specify additional environment variables to be populated from Kubernetes secrets.
# Useful for passing in SCIM_AUTH_TOKEN or other secret environment variables from Kubernetes secrets.
environmentSecrets: []
environmentSecrets:
[]
# - name: SCIM_AUTH_TOKEN
# secretKeyRef:
# name: retool-scim-auth-token
Expand All @@ -70,7 +72,8 @@ environmentSecrets: []

# Optionally specify environmental variables. Useful for variables that are not key-value, as env: {} above requires.
# Can also include environment secrets here instead of in environmentSecrets
environmentVariables: []
environmentVariables:
[]
# - name: SCIM_AUTH_TOKEN
# valueFrom:
# secretKeyRef:
Expand All @@ -94,7 +97,8 @@ externalSecrets:
enabled: false
name: retool-config
# Array of secrets to be use as env variables. (Optional)
secrets: []
secrets:
[]
# - name: retool-config
# - name: retool-db
# Support for External Secrets Operator: https://github.com/external-secrets/external-secrets
Expand All @@ -104,7 +108,8 @@ externalSecrets:
# Default set to AWS Secrets Manager.
backendType: secretsManager
# Array of name/path key/value pairs to use for the External Secrets Objects.
secretRef: []
secretRef:
[]
# - name: retool-config
# path: global-retool-config
# - name: retool-db
Expand Down Expand Up @@ -244,15 +249,15 @@ priorityClassName: ""
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- retool
topologyKey: "kubernetes.io/hostname"
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values:
- retool
topologyKey: "kubernetes.io/hostname"

# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Expand All @@ -265,9 +270,6 @@ nodeSelector: {}
# Common annotations for all pods (backend and job runner).
podAnnotations: {}

# Increasing replica count will deploy a separate pod for backend and jobs
# Example: with 3 replicas, you will end up with 3 backends + 1 jobs pod
replicaCount: 2
revisionHistoryLimit: 3

# Optional pod disruption budget, for ensuring higher availability of the
Expand All @@ -282,7 +284,18 @@ revisionHistoryLimit: 3
# Common labels for all pods (backend and job runner) for pod assignment
podLabels: {}

# Increasing replica count will deploy a separate pod for backend and jobs
# Example 1: with 1 replicas, you will end up with 1 combined backend and jobs pod (unless jobRunner.enabled is true, see below)
# Example 2: with 2 replicas, you will end up with 2 backends + 1 jobs pod
# Example 3: with 3 replicas, you will end up with 3 backends + 1 jobs pod
replicaCount: 2

jobRunner:
# explicitly enable this pod if exactly 1 api backend container and
# 1 jobs runner container is desired. otherwise a replicaCount of 2
# will already launch a job runner pod
# enabled: true

# Annotations for job runner pods
annotations: {}

Expand Down

0 comments on commit aa6f5c3

Please sign in to comment.