Skip to content

Commit b25c1ef

Browse files
Feat: add support for deployment strategy (#82)
* chore: update sourcebot version to 0.1.67 and add deployment strategy configuration Signed-off-by: Alexander Chernov <alexander@chernov.it> * Further hardening of values.schema.json * readme * changelog --------- Signed-off-by: Alexander Chernov <alexander@chernov.it> Co-authored-by: Brendan Kellam <brendan@sourcebot.dev>
1 parent d353f4e commit b25c1ef

6 files changed

Lines changed: 89 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Added configurable deployment strategy support, allowing users to switch between `RollingUpdate` and `Recreate` strategies. [#82](https://github.com/sourcebot-dev/sourcebot-helm-chart/pull/82)
12+
1013
## [0.1.71] - 2026-04-09
1114

1215
### Added

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,37 @@ sourcebot:
221221
existingSecretKey: license-key
222222
```
223223

224+
## Deployment Strategy
225+
226+
By default, the chart uses a `RollingUpdate` strategy, which creates the new pod before terminating the old one during upgrades. You can customize the rolling update behavior:
227+
```yaml
228+
sourcebot:
229+
strategy:
230+
type: RollingUpdate
231+
rollingUpdate:
232+
maxUnavailable: 0
233+
maxSurge: 1
234+
```
235+
236+
On multi-node clusters with `ReadWriteOnce` persistent volumes, the new pod may fail to start if it gets scheduled on a different node than the old pod. To avoid this, you can pin pods to the same node using pod affinity:
237+
```yaml
238+
sourcebot:
239+
affinity:
240+
podAffinity:
241+
requiredDuringSchedulingIgnoredDuringExecution:
242+
- labelSelector:
243+
matchLabels:
244+
app.kubernetes.io/name: sourcebot
245+
topologyKey: kubernetes.io/hostname
246+
```
247+
248+
Alternatively, you can use the `Recreate` strategy, which terminates the old pod before creating the new one. This avoids PVC conflicts but causes brief downtime during upgrades:
249+
```yaml
250+
sourcebot:
251+
strategy:
252+
type: Recreate
253+
```
254+
224255
## Persistence
225256

226257
Each component has its own persistent volume for storing data across pod restarts.
@@ -325,6 +356,31 @@ sourcebot:
325356
secretName: sourcebot-tls
326357
```
327358

359+
### Zero-downtime upgrades on multi-node clusters
360+
361+
Use a `ReadWriteMany` access mode so the old and new pods can mount the PVC simultaneously during rolling updates. This requires a storage class that supports `ReadWriteMany` (e.g., EFS on AWS, Filestore on GCP, Azure Files):
362+
363+
```yaml
364+
sourcebot:
365+
persistence:
366+
accessModes:
367+
- ReadWriteMany
368+
storageClass: "efs-sc" # example: AWS EFS storage class
369+
```
370+
371+
Alternatively, you can keep `ReadWriteOnce` and use pod affinity to pin pods to the same node:
372+
373+
```yaml
374+
sourcebot:
375+
affinity:
376+
podAffinity:
377+
requiredDuringSchedulingIgnoredDuringExecution:
378+
- labelSelector:
379+
matchLabels:
380+
app.kubernetes.io/name: sourcebot
381+
topologyKey: kubernetes.io/hostname
382+
```
383+
328384
### Using an existing PVC
329385

330386
```yaml

charts/sourcebot/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Sourcebot is a self-hosted tool that helps you understand your codebase.
130130
| sourcebot.startupProbe.httpGet.path | string | `"/api/health"` | Path to check |
131131
| sourcebot.startupProbe.httpGet.port | string | `"http"` | Port to check |
132132
| sourcebot.startupProbe.periodSeconds | int | `30` | Initial delay before the first probe |
133+
| sourcebot.strategy | object | `{"type":"RollingUpdate"}` | Deployment strategy configuration |
133134
| sourcebot.tolerations | list | `[]` | Set tolerations for pod scheduling See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
134135

135136
----------------------------------------------

charts/sourcebot/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ metadata:
88
{{- include "sourcebot.labels" $ | nindent 4 }}
99
spec:
1010
replicas: {{ $.Values.sourcebot.replicaCount }}
11+
{{- with $.Values.sourcebot.strategy }}
12+
strategy:
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
1115
selector:
1216
matchLabels:
1317
{{- include "sourcebot.selectorLabels" $ | nindent 6 }}

charts/sourcebot/values.schema.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@
3636
"type": "integer",
3737
"minimum": 1
3838
},
39+
"strategy": {
40+
"type": "object",
41+
"oneOf": [
42+
{
43+
"additionalProperties": false,
44+
"properties": {
45+
"type": { "type": "string", "const": "RollingUpdate" },
46+
"rollingUpdate": { "type": "object" }
47+
},
48+
"required": ["type"]
49+
},
50+
{
51+
"additionalProperties": false,
52+
"properties": {
53+
"type": { "type": "string", "const": "Recreate" }
54+
},
55+
"required": ["type"]
56+
}
57+
]
58+
},
3959
"image": {
4060
"type": "object",
4161
"properties": {

charts/sourcebot/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ global:
44
security:
55
# -- Allow insecure images to use bitnami legacy repository. Can be set to false if secure images are being used (Paid).
66
allowInsecureImages: true
7-
7+
88
# -- Global Docker registry secret names as an array
99
imagePullSecrets: []
1010

@@ -19,6 +19,10 @@ sourcebot:
1919
# -- Set the number of replicas for the deployment
2020
replicaCount: 1
2121

22+
# -- Deployment strategy configuration
23+
strategy:
24+
type: RollingUpdate
25+
2226
# Image configuration
2327
image:
2428
# -- Container image repository

0 commit comments

Comments
 (0)