Skip to content

Commit e739db1

Browse files
authored
feat: expose collector.updateStrategy for the DaemonSet (#43)
1 parent 5b14d36 commit e739db1

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

templates/daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
{{- include "better-stack-collector.labels" . | nindent 4 }}
88
app.kubernetes.io/component: better-stack-collector
99
spec:
10+
{{- with .Values.collector.updateStrategy }}
11+
updateStrategy:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
1014
selector:
1115
matchLabels:
1216
{{- include "better-stack-collector.selectorLabels" . | nindent 6 }}

tests/17-update-strategy.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
source "$(dirname "$0")/helpers.sh"
4+
5+
output=$(render \
6+
--set collector.env.COLLECTOR_SECRET=test123 \
7+
--set 'collector.updateStrategy.type=RollingUpdate' \
8+
--set 'collector.updateStrategy.rollingUpdate.maxUnavailable=25%' \
9+
--set 'collector.updateStrategy.rollingUpdate.maxSurge=0')
10+
11+
assert_contains "$output" 'updateStrategy:' "Missing updateStrategy block on DaemonSet"
12+
assert_contains "$output" 'type: RollingUpdate' "Missing updateStrategy.type"
13+
assert_contains "$output" 'maxUnavailable: 25%' "Missing maxUnavailable override"
14+
assert_contains "$output" 'maxSurge: 0' "Missing maxSurge override"
15+
16+
pass

tests/18-no-update-strategy.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
source "$(dirname "$0")/helpers.sh"
4+
5+
# Default values must not emit an updateStrategy block, so Kubernetes
6+
# applies its DaemonSet default and existing installs see no change.
7+
output=$(render --set collector.env.COLLECTOR_SECRET=test123)
8+
9+
assert_not_contains "$output" 'updateStrategy:' \
10+
"Unexpected updateStrategy block when collector.updateStrategy is unset"
11+
12+
pass

values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ collector:
4444
# Affinity
4545
affinity: {}
4646

47+
# DaemonSet update strategy. When left empty, Kubernetes applies its default
48+
# for DaemonSets — RollingUpdate with maxUnavailable: 1 and maxSurge: 0 —
49+
# which rolls one pod at a time and serializes the rollout on large clusters
50+
# (e.g. ~15 min for 15 nodes, ~30 min for 32 nodes). Override to roll more
51+
# pods concurrently; a percentage scales naturally with cluster size.
52+
# See https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#rolling-update
53+
updateStrategy: {}
54+
# Example:
55+
# updateStrategy:
56+
# type: RollingUpdate
57+
# rollingUpdate:
58+
# maxUnavailable: 25%
59+
# maxSurge: 0
60+
4761
livenessProbe:
4862
initialDelaySeconds: 180
4963
periodSeconds: 60

0 commit comments

Comments
 (0)