Skip to content

Commit 5366953

Browse files
Allow Helm to omit Deployment replicas
1 parent b4a77e8 commit 5366953

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

charts/ai/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ The following table lists the primary configurable parameters and defaults.
196196
| `serviceAccount.create` | Create a ServiceAccount | `true` |
197197
| `serviceAccount.name` | ServiceAccount name | `codetogether-ai` |
198198
| `replicaCount` | Deployment replica count | `1` |
199+
| `manageReplicas` | Render `spec.replicas`; set `false` when external scaling tools own replica count | `true` |
199200
| `readinessProbe.path` | Readiness endpoint on port 1080 | `/healthz` |
200201
| `livenessProbe.path` | Liveness endpoint on port 8080 | `/actuator/health` |
201202
| `startupProbe.enabled` | Enable startup probe | `true` |
@@ -287,6 +288,27 @@ helm upgrade codetogether-ai codetogether/codetogether-ai \
287288

288289
The Deployment rolls when the chart-managed properties Secret changes.
289290

291+
### Server-side apply replica conflicts
292+
293+
Some clusters use external scaling automation, HPA, or `kubectl scale` to manage
294+
Deployment replica count. If that manager owns `.spec.replicas`, Helm upgrades
295+
can fail with a server-side apply conflict similar to:
296+
297+
```text
298+
conflict with "agent" using apps/v1: .spec.replicas
299+
```
300+
301+
Set `manageReplicas: false` in your custom `values.yaml` to make Helm omit
302+
`spec.replicas` and leave replica ownership to the external tool:
303+
304+
```yaml
305+
manageReplicas: false
306+
```
307+
308+
The default remains `manageReplicas: true`, preserving existing production
309+
behavior. Internal or CI overlays that must pin a replica count should keep
310+
`manageReplicas: true`.
311+
290312
## Uninstall
291313

292314
```bash

charts/ai/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ metadata:
66
labels:
77
{{- include "ctai.labels" . | nindent 4 }}
88
spec:
9+
{{- if .Values.manageReplicas }}
910
replicas: {{ .Values.replicaCount }}
11+
{{- end }}
1012
selector:
1113
matchLabels:
1214
{{- include "ctai.selectorLabels" . | nindent 6 }}

charts/ai/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ nodeSelector: {}
127127
tolerations: []
128128
affinity: {}
129129
replicaCount: 1
130+
# When false, Helm omits spec.replicas so external tools (HPA, kubectl scale,
131+
# cluster automation) can own replica count without SSA conflicts on upgrade.
132+
# Fresh installs still default to 1 pod when replicas is omitted.
133+
manageReplicas: true
130134

131135
extraEnvVars: []
132136
extraVolumes: []

0 commit comments

Comments
 (0)