Skip to content

Commit f975d43

Browse files
Masatoshi TanidaCopilot
andcommitted
feat(gantry): make the agent DaemonSet update strategy configurable
The agent DaemonSet hard-codes maxUnavailable: 50%, so every rollout replaces half of a cluster's agents at once. Expose updateStrategy as a value so installers on large clusters can bound how many nodes lose their local mirror during a rollout. The default is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 866228da-74dc-450c-9aa8-e22099bbd779
1 parent 3e9506d commit f975d43

5 files changed

Lines changed: 95 additions & 3 deletions

File tree

‎deploy/gantry/README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ Do not combine these stages in one Helm upgrade. A new pod can create a
9090
higher-numbered Lease while old pods are still running, which makes the old
9191
pods reject their next chair snapshot.
9292

93+
## Agent rollout
94+
95+
`updateStrategy` is the agent DaemonSet's update strategy. The default
96+
`maxUnavailable: 50%` replaces half of the agents at once; lower it on large
97+
clusters to bound how many nodes lose their local mirror during a rollout:
98+
99+
```sh
100+
--set-string updateStrategy.rollingUpdate.maxUnavailable=10%
101+
```
102+
93103
## Operator Profile
94104

95105
```sh

‎deploy/gantry/chart/templates/daemonset.yaml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ spec:
1212
matchLabels:
1313
app.kubernetes.io/name: gantry
1414
updateStrategy:
15-
type: RollingUpdate
16-
rollingUpdate:
17-
maxUnavailable: 50%
15+
{{- toYaml .Values.updateStrategy | nindent 4 }}
1816
template:
1917
metadata:
2018
labels:

‎deploy/gantry/chart/values.schema.json‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"image",
77
"namespace",
88
"manager",
9+
"updateStrategy",
910
"nodeSelector",
1011
"tolerations",
1112
"containerd",
@@ -68,6 +69,52 @@
6869
"helm"
6970
]
7071
},
72+
"updateStrategy": {
73+
"type": "object",
74+
"additionalProperties": false,
75+
"required": [
76+
"type"
77+
],
78+
"properties": {
79+
"type": {
80+
"type": "string",
81+
"enum": [
82+
"RollingUpdate",
83+
"OnDelete"
84+
]
85+
},
86+
"rollingUpdate": {
87+
"type": "object",
88+
"additionalProperties": false,
89+
"properties": {
90+
"maxUnavailable": {
91+
"anyOf": [
92+
{
93+
"type": "integer",
94+
"minimum": 1
95+
},
96+
{
97+
"type": "string",
98+
"pattern": "^([1-9][0-9]?|100)%$"
99+
}
100+
]
101+
},
102+
"maxSurge": {
103+
"anyOf": [
104+
{
105+
"type": "integer",
106+
"minimum": 0
107+
},
108+
{
109+
"type": "string",
110+
"pattern": "^([0-9]|[1-9][0-9]|100)%$"
111+
}
112+
]
113+
}
114+
}
115+
}
116+
}
117+
},
71118
"nodeSelector": {
72119
"type": "object",
73120
"required": [

‎deploy/gantry/chart/values.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ namespace:
1010

1111
manager: helm
1212

13+
# Rollout strategy for the agent DaemonSet. Lower maxUnavailable on large
14+
# clusters to bound how many nodes lose the local mirror at once.
15+
updateStrategy:
16+
type: RollingUpdate
17+
rollingUpdate:
18+
maxUnavailable: 50%
19+
1320
nodeSelector:
1421
kubernetes.io/os: linux
1522

‎deploy/gantry/render_test.go‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,36 @@ func TestRendersFixedChairLeaseSet(t *testing.T) {
157157
}
158158
}
159159

160+
func TestRendersConfiguredAgentUpdateStrategy(t *testing.T) {
161+
t.Parallel()
162+
163+
for _, tc := range []struct {
164+
name string
165+
args []string
166+
want string
167+
}{
168+
{name: "default", want: "maxUnavailable: 50%"},
169+
{
170+
name: "override",
171+
args: []string{"--set-string", "updateStrategy.rollingUpdate.maxUnavailable=10%"},
172+
want: "maxUnavailable: 10%",
173+
},
174+
} {
175+
t.Run(tc.name, func(t *testing.T) {
176+
t.Parallel()
177+
178+
raw, err := os.ReadFile(filepath.Join(renderChart(t, false, tc.args...), "daemonset.yaml"))
179+
if err != nil {
180+
t.Fatalf("read rendered agent DaemonSet: %v", err)
181+
}
182+
183+
if !bytes.Contains(raw, []byte(tc.want)) {
184+
t.Fatalf("rendered agent DaemonSet does not contain %q", tc.want)
185+
}
186+
})
187+
}
188+
}
189+
160190
func TestRendersConfiguredChairAndSeedCounts(t *testing.T) {
161191
t.Parallel()
162192

0 commit comments

Comments
 (0)