You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/src/tasks/experimental-features/runtime-sdk/implement-lifecycle-hooks.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -336,7 +336,7 @@ For additional details, you can see the full schema in <button onclick="openSwag
336
336
This hook is called after all the workers have been upgraded to the version specified in `spec.topology.version`
337
337
or to an intermediate version in the upgrade plan, and:
338
338
- if the upgrade plan is completed and the entire cluster is at `spec.topology.version`, immediately before calling the AfterClusterUpgrade hook
339
-
- if the upgrade plan is not complete and the entrire cluster is now at one of the intermediate versions, immediately before calling BeforeControlPlaneUpgrade hook for the next intermediate step
339
+
- if the upgrade plan is not complete and the entire cluster is now at one of the intermediate versions, immediately before calling BeforeControlPlaneUpgrade hook for the next intermediate step
340
340
341
341
Runtime Extension implementers can use this hook to execute post-upgrade add-on tasks; if the upgrade plan is not completed,
342
342
this hook allows to block upgrades to the next version of the control plane until everything is ready.
see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md) for more options
394
-
for configuring Kubernetes version upgrade of clusters using managed topologies.
383
+
kubernetesVersions:
384
+
- v1.28.0
385
+
- v1.29.0
386
+
- v1.30.0
387
+
- v1.30.1
388
+
- v1.31.2
389
+
- ...
390
+
```
391
+
392
+
see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md) for more options
393
+
for configuring Kubernetes version upgrade of clusters using managed topologies.
395
394
396
395
2. User creates a cluster using the class name and defining the topology.
# Chained and efficient upgrades for Clusters with managed topologies
@@ -46,15 +46,15 @@ see-also:
46
46
## Glossary
47
47
48
48
-**Chained upgrade**: an upgrade sequence that goes from one Kubernetes version to another
49
-
by passing through a set of intermediate versions. e.g., Upgrading from v1.31.0 to v1.33.0 requires
50
-
a chained upgrade with the following intermediate steps: v1.31.0 (initial state) -> v1.32.0 (intermediate version)
49
+
by passing through a set of intermediate versions. e.g., Upgrading from v1.31.0 (current state) to v1.34.0 (target version) requires
50
+
a chained upgrade with the following steps: v1.32.0 (first intermediate version)-> v1.32.0 (second intermediate version)
51
51
-> v1.33.0 (target version)
52
52
53
-
-**Efficient upgrade**: a chained upgrade where workers node skips some of the intermediate versions,
54
-
when allowed by the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/).
53
+
-**Upgrade plan**: the sequence of intermediate versions ... target version that a Cluster must upgrade to when
54
+
performing a chained upgrade;
55
55
56
-
-**Upgrade plan**: the sequence of intermediate versions that a Cluster must upgrade to when
57
-
performing a chained upgrade; when the chained upgrade is also an efficient upgrade,
56
+
-**Efficient upgrade**: a chained upgrade where worker nodes skip some of the intermediate versions,
57
+
when allowed by the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/) when the chained upgrade is also an efficient upgrade,
58
58
the upgrade plan for worker machines is a subset of the upgrade plan for control plane machines.
59
59
60
60
## Summary
@@ -78,14 +78,14 @@ by more than one minor Kubernetes version by performing chained and efficient up
78
78
79
79
### Goals
80
80
81
-
- Allow Cluster API users using managed topologies to perform chained upgrades.
Note: in this case the system will infer the list of intermediate version for workers from the list of control plane versions, taking
202
+
care of performing the minimum number of workers upgrade by taking into account the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/).
203
+
200
204
Implementers of this runtime extension can also support more sophisticated use cases, e.g.
201
205
202
206
- Go through more patch release for a minor if necessary, e.g., v1.30.0 -> v1.30.1 -> etc.
@@ -209,6 +213,9 @@ Implementers of this runtime extension can also support more sophisticated use c
209
213
- ...
210
214
```
211
215
216
+
Note: in this case the system will infer the list of intermediate version for workers from the list of control plane versions, taking
217
+
care of performing the minimum number of workers upgrade by taking into account the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/).
218
+
212
219
- Force workers to upgrade to specific versions, e.g., force workers upgrade to v1.30.0 when doing v1.29.0 -> v1.32.3
213
220
(in this example, worker upgrade to 1.30.0 is not required by the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/), so it would
214
221
be skipped under normal circumstances).
@@ -223,6 +230,9 @@ Implementers of this runtime extension can also support more sophisticated use c
223
230
- v1.30.0
224
231
```
225
232
233
+
Note: in this case the system will take into consideration the provided `workersVersions`, but if required by the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/),
234
+
also add necessary intermediate version for workers inferred from the list of control plane versions.
235
+
226
236
- Force workers to upgrade to all the intermediate steps (opt out from efficient upgrades).
227
237
228
238
```yaml
@@ -240,11 +250,13 @@ Implementers of this runtime extension can also support more sophisticated use c
240
250
Please note:
241
251
- In case both the list of Kubernetes versions and the runtime extension definition will be left empty in a cluster class,
242
252
Cluster API will behave as of today: only upgrades to the next minor are allowed for the corresponding clusters.
243
-
- If the list of Kubernetes versions is defined in a ClusterClass, the system is going to use this info to:
244
-
- Validate the target version for an upgrade of a corresponding cluster
245
-
- Check if there is a valid upgrade path from the current version to the target version.
246
-
- If instead, the ClusterClass is reading upgrade plans from a runtime extension, the system is NOT going to use it
247
-
to validate the target version for an upgrade of a corresponding cluster.
253
+
- If the list of Kubernetes versions is defined in a ClusterClass, the system is going to use this info also in
254
+
the Cluster validation webhook in order to:
255
+
- Validate the initial version of a corresponding cluster (on create)
256
+
- Validate the target version for an upgrade of a corresponding cluster (on update)
257
+
- Check if there is a valid upgrade path from the current version to the target version (on update)
258
+
- If instead, the ClusterClass is reading upgrade plans from a runtime extension, the Cluster validation webhook is
259
+
NOT going to call this runtime extension, and thus it won't validate the initial/target version of a corresponding cluster.
248
260
- This limitation is driven by the fact that adding nested http calls into webhooks might lead to performance
249
261
issues; also, in most cases advanced users already are implementing additional checks for cluster upgrades, and they
250
262
need full flexibility in how to integrate the upgrade plan checks.
@@ -258,12 +270,12 @@ Please note:
258
270
The topology controller is the component responsible to orchestrate upgrades for clusters using a managed topology,
259
271
and it will be improved to:
260
272
- compute the upgrade plan (when an upgrade is required/in progress)
261
-
- perform the upgrade sequence accordingly
273
+
- perform the chained upgrade going through all the intermediate steps in the upgrade plan
262
274
263
275
While the first change can be inferred from the previous paragraph, the second change requires some additional details.
264
276
265
277
The topology controller is already capable of performing two atomic operations used during upgrades, "upgrade control
266
-
plane" and "upgrade workers"; as of today, these two operations are performed sequentially, one after the other.
278
+
plane" and "upgrade workers". Today for an upgrade we run "upgrade control plane" and then "upgrade workers".
267
279
268
280
This proposal is planning to use existing "upgrade control plane" and "upgrade workers" primitives multiple times
269
281
to perform chained and efficient upgrades, e.g., v1.29.0 -> v1.33.0 will be executed as:
@@ -273,7 +285,7 @@ to perform chained and efficient upgrades, e.g., v1.29.0 -> v1.33.0 will be exec
273
285
| CP upgrade v1.29.0 -> v1.30.0 | workers can remain on v1.29.0 |
274
286
| CP upgrade v1.30.0 -> v1.31.0 | workers can remain on v1.29.0 |
275
287
| CP upgrade v1.31.0 -> v1.32.0 | |
276
-
| Workers upgrade v1.31.0 -> v1.32.0 | workers must upgrade to prevent violation of Kubernetes version skew rules |
288
+
| Workers upgrade v1.29.0 -> v1.32.0 | workers must upgrade to prevent violation of Kubernetes version skew rules |
277
289
| CP upgrade v1.32.0 -> v1.33.0 | |
278
290
| Workers upgrade v1.32.0 -> v1.33.0 | |
279
291
@@ -296,9 +308,9 @@ are upgraded to the intermediate/target version of this iteration, which is poss
296
308
`topology.cluster.x-k8s.io/hold-upgrade-sequence`annotations are removed.
297
309
298
310
However, it might be worth to notice that:
299
-
- While performing different "upgrade workers" iterations, the target version all Machine deployment should upgrade to also changes.
311
+
- While performing different "upgrade workers" operations, the target version all MachineDeployments should upgrade to also changes.
300
312
- `topology.cluster.x-k8s.io/defer-upgrade`and `topology.cluster.x-k8s.io/hold-upgrade-sequence` annotations, must be
301
-
applied before each upgrade step (lifecycle hooks described in the next paragraph can be used to orchestrate this process).
313
+
applied before each upgrade operation (lifecycle hooks described in the next paragraph can be used to orchestrate this process).
302
314
303
315
#### Lifecycle hooks
304
316
@@ -320,7 +332,7 @@ More specifically:
320
332
request and response payload will be similar to corresponding messages for `BeforeControlPlaneUpgrade`
321
333
- A new `AfterWorkersUpgrade` hook will be added and called after each "upgrade workers" step;
322
334
request and response payload will be similar to corresponding messages for `AfterControlPlaneUpgrade`, but the
323
-
hook will be considered blocking only for the intermediate steps of the upgrade (not blocking for the final step).
335
+
hook will be considered blocking only for the intermediate steps of the upgrade.
324
336
- `AfterClusterUpgrade`will remain as of today, but the system will ensure that a new upgrade
325
337
can't start until `AfterClusterUpgrade` is completed.
0 commit comments