Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

helm: Support 0 replicas for server

Chirag Jain2e3c348b75dd
diff --git a/charts/trueforge/README.md b/charts/trueforge/README.md
index 218d9c7f4..47cbecea1 100644
--- a/charts/trueforge/README.md
+++ b/charts/trueforge/README.md
@@ -153,7 +153,8 @@ The chart's own value wins on conflict; `tolerations` append to
`resourceTier` (`small` / `medium` / `large`) selects sizing presets for the
server and the controller, and sets the server replica count (an explicit
-`server.replicaCount` overrides it; the controller is always 1 replica). When
+`server.replicaCount` overrides it, including `0` to scale the server down; the
+controller is always 1 replica). When
set, it **replaces** the `resources` tables; an unknown tier fails the render.
Empty (the default) keeps the explicit `resources` / `controller.resources`
and 1 server replica. A parent chart may set `global.resourceTier` instead;
@@ -363,7 +364,7 @@ extraObjects:
| Value | Default | Description |
| --------------------- | ----------------------------------- | ------------------------------------- |
| `resourceTier` | `""` | Optional `small` / `medium` / `large` preset for resources and server replicas; empty uses `resources`. |
-| `server.replicaCount` | `""` | Number of server replicas. Empty derives from the resource tier (small=1, medium=2, large=3; 1 with no tier). |
+| `server.replicaCount` | `null` | Number of server replicas (`0` allowed to scale down). Empty/`null` derives from the resource tier (small=1, medium=2, large=3; 1 with no tier). |
| `server.deploymentAnnotations` | `{}` | Annotations on the server Deployment, such as an Argo CD sync wave. |
| `controller.deploymentAnnotations` | `{}` | Annotations on the controller Deployment, such as an Argo CD sync wave. |
| `image.registry` | `""` | Image registry. Empty uses `global.image.registry`, then `tfy.jfrog.io`. |
diff --git a/charts/trueforge/templates/_helpers.tpl b/charts/trueforge/templates/_helpers.tpl
index 2e6665a31..f8f52cb03 100644
--- a/charts/trueforge/templates/_helpers.tpl
+++ b/charts/trueforge/templates/_helpers.tpl
@@ -254,14 +254,16 @@ chart's global.resourceTier.
{{- end }}
{{/*
-Server replica count. An explicit server.replicaCount wins; otherwise the
-resource tier decides (small=1, medium=2, large=3), falling back to 1 when no
-tier is set.
+Server replica count. An explicit server.replicaCount wins (including 0 to
+scale down); otherwise the resource tier decides (small=1, medium=2, large=3),
+falling back to 1 when no tier is set. Use kindIs so integer 0 is not treated
+as unset (if/with treat 0 as falsy).
*/}}
{{- define "trueforge.replicas" -}}
{{- $tier := include "trueforge.resourceTier" . | trim -}}
-{{- if .Values.server.replicaCount -}}
-{{- .Values.server.replicaCount -}}
+{{- $count := .Values.server.replicaCount -}}
+{{- if or (kindIs "int" $count) (kindIs "int64" $count) (kindIs "float64" $count) -}}
+{{- $count | int -}}
{{- else if eq $tier "small" -}}
1
{{- else if eq $tier "medium" -}}
diff --git a/charts/trueforge/values.yaml b/charts/trueforge/values.yaml
index 8a3f1294c..9328950b3 100644
--- a/charts/trueforge/values.yaml
+++ b/charts/trueforge/values.yaml
@@ -91,7 +91,8 @@ service:
server:
# Number of server replicas (ignored when autoscaling.enabled is true).
# null = derived from the resource tier (small=1, medium=2, large=3),
- # or 1 when no tier is set. Set a number to override the tier.
+ # or 1 when no tier is set. Set a number (including 0 to scale down) to
+ # override the tier.
replicaCount: null
# Annotations on the server Deployment object (for example, Argo CD sync waves).
deploymentAnnotations: {}