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
Please see the corresponding [CAEP](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20220414-runtime-hooks.md)
17
+
Please see the corresponding [proposal: Runtime hooks for Add-on Management (lifecycle hooks)](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20220414-lifecycle-hooks.md) and
18
+
also [proposal: Chained and efficient upgrades for Clusters with managed topologies](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md)]
18
19
for additional background information.
19
20
20
21
## Guidelines
@@ -139,8 +140,17 @@ cluster:
139
140
...
140
141
status:
141
142
...
142
-
fromKubernetesVersion: "v1.21.2"
143
-
toKubernetesVersion: "v1.22.0"
143
+
fromKubernetesVersion: "v1.30.0"
144
+
toKubernetesVersion: "v1.33.0"
145
+
upgradePlan:
146
+
controlPlane:
147
+
- v1.30.0
148
+
- v1.31.0
149
+
- v1.32.3
150
+
- v1.33.0
151
+
workers:
152
+
- v1.32.3
153
+
- v1.33.0
144
154
```
145
155
146
156
#### Example Response:
@@ -159,12 +169,68 @@ For additional details, you can see the full schema in <button onclick="openSwag
159
169
if previous upgrades or worker machine rollouts are still in progress, the system waits for those operations
160
170
to complete before starting the new upgrade.
161
171
172
+
### BeforeControlPlaneUpgrade
173
+
174
+
This hook is called before a new version is propagated to the control plane object. Runtime Extension implementers
175
+
can use this hook to execute pre-upgrade add-on tasks and block upgrades of the ControlPlane.
176
+
177
+
Note:
178
+
- When an upgrade is starting, BeforeControlPlaneUpgrade will be called after BeforeClusterUpgrade is completed.
179
+
- When an upgrade is in progress BeforeControlPlaneUpgrade will be called for each intermediate version that will
180
+
be applied to the control plane (instead BeforeClusterUpgrade will be called only once at the beginning of the upgrade).
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
224
+
162
225
### AfterControlPlaneUpgrade
163
226
164
-
This hook is called after the entire control plane has been upgraded to the version specified in `spec.topology.version`,
165
-
and immediately before the new version is going to be propagated to the MachineDeployments of the Cluster.
166
-
Runtime Extension implementers can use this hook to execute post-upgrade add-on tasks and block upgrades to workers
167
-
until everything is ready.
227
+
This hook is called after the entire control plane has been upgraded to the version specified in `spec.topology.version`
228
+
or to an intermediate version in the upgrade plan and:
229
+
- if workers upgrade can be skipped for this version, immediately before the next intermediate version is applied to the control plane
230
+
- if workers upgrade must be performed for this version, immediately before the new version is going to be propagated to the MachineDeployments of the Cluster.
231
+
232
+
Runtime Extension implementers can use this hook to execute post-upgrade add-on tasks and block upgrades to the next
233
+
version of the control plane or to workers until everything is ready.
168
234
169
235
Note: While the MachineDeployments upgrade is blocked changes made to existing MachineDeployments and creating new MachineDeployments
170
236
will be delayed while the object is waiting for upgrade. Example: modifying MachineDeployments (think scale up),
@@ -188,9 +254,122 @@ cluster:
188
254
...
189
255
status:
190
256
...
191
-
kubernetesVersion: "v1.22.0"
257
+
kubernetesVersion: "v1.30.0"
258
+
upgradePlan:
259
+
controlPlane:
260
+
- v1.31.0
261
+
- v1.32.3
262
+
- v1.33.0
263
+
workers:
264
+
- v1.32.3
265
+
- v1.33.0
266
+
```
267
+
268
+
Note: The upgrade plan in the request contains only missing steps to reach the target version, if any.
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
333
+
334
+
### AfterWorkersUpgrade
335
+
336
+
This hook is called after all the workers have been upgraded to the version specified in `spec.topology.version`
337
+
or to an intermediate version in the upgrade plan, and:
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
340
+
341
+
Runtime Extension implementers can use this hook to execute post-upgrade add-on tasks; if the upgrade plan is not completed,
342
+
this hook allows to block upgrades to the next version of the control plane until everything is ready.
Note: The upgrade plan in the request contains only missing steps to reach the target version, if any.
372
+
194
373
#### Example Response:
195
374
196
375
```yaml
@@ -201,6 +380,8 @@ message: "error message if status == Failure"
201
380
retryAfterSeconds: 10
202
381
```
203
382
383
+
Note: retryAfterSeconds is ignored when workers version is equal to `spec.topology.version`.
384
+
204
385
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
205
386
206
387
### AfterClusterUpgrade
@@ -237,8 +418,6 @@ status: Success # or Failure
237
418
message: "error message if status == Failure"
238
419
```
239
420
240
-
For additional details, refer to the [Draft OpenAPI spec](https://editor.swagger.io/?url=https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/docs/proposals/images/runtime-hooks/runtime-hooks-openapi.yaml).
241
-
242
421
### BeforeClusterDelete
243
422
244
423
This hook is called after the Cluster deletion has been triggered by the user and immediately before the topology
Copy file name to clipboardExpand all lines: docs/proposals/20210526-cluster-class-and-managed-topologies.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,8 @@ at high level the new CRD contains:
209
209
- A list of patches, allowing to change above templates for each specific Cluster.
210
210
- A list of variable definitions, defining a set of additional values the users can provide on each specific cluster;
211
211
those values can be used in patches.
212
+
- A list of Kubernetes versions to be used when performing chained upgrades for clusters using this Cluster class, see
213
+
[proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md).
212
214
213
215
The following paragraph provides some additional context on some of the above values; more info can
214
216
be found in [writing a ClusterClass](https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-class/write-clusterclass.html).
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.
395
+
383
396
2. User creates a cluster using the class name and defining the topology.
384
397
```yaml
385
398
apiVersion: cluster.x-k8s.io/v1beta1
@@ -433,6 +446,9 @@ This section talks about updating a Cluster which was created using a `ClusterCl
433
446
434
447

435
448
449
+
see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md)
450
+
for more considerations about Kubernetes version upgrade of clusters using managed topologies.
451
+
436
452
#### Behavior with patches
437
453
438
454
This section highlights how the basic behavior discussed above changes when patches are used. This is an important use case because without
@@ -485,6 +501,9 @@ like e.g. a different HTTP proxy configuration, a different image to be used for
485
501
valueFrom:
486
502
variable: machineType
487
503
```
504
+
505
+
See [proposal: topology mutation hook](20220330-topology-mutation-hook.md) for a powerful alternative to
506
+
inline patches.
488
507
489
508
##### Create a new Cluster with patches
490
509
@@ -613,6 +632,7 @@ The initial plan is to rollout Cluster Class and support for managed topologies
613
632
- 10/04/2021: Added support for patches and variables
614
633
- 01/10/2022: Added support for MachineHealthChecks
615
634
- 12/20/2022: Cleaned up outdated implementation details by linking the book's pages instead. This will make it easier to keep the proposal up to date.
635
+
- 05/13/2025: Added support for Upgrade Plans; see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md)
Copy file name to clipboardExpand all lines: docs/proposals/20220414-lifecycle-hooks.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,15 +115,18 @@ As a developer of an add-ons orchestration solution:
115
115
***Before a Cluster is Created** I want to automatically check if enough disk space is available for allocation to the cluster for persistent storage of collected metrics values.
116
116
***After the Control Plane****is Initialized** I want to automatically install a metrics database and associated add-ons in the workload cluster.
117
117
***Before the Cluster is Upgraded** I want to install a new version of the metrics database with a new version of the custom metrics apiservice to interact directly with the Kubernetes apiserver.
118
-
***After the ControlPlane is Upgraded** I want to automatically check that the new version of the custom metrics apiservice is working and correctly fulfilled by my metrics database.
118
+
***Before the ControlPlane is Upgraded** I want to install a new version of the metrics database with a new version of the custom metrics apiservice to interact directly with the Kubernetes apiserver.
119
+
***After the ControlPlane is Upgraded** I want to install new versions of metrics collectors to each upgraded node in the cluster.
120
+
***Before workers are Upgraded** I want to install a new version of the metrics database with a new version of the custom metrics apiservice to interact directly with the Kubernetes apiserver.
121
+
***After workers are Upgraded** I want to install new versions of metrics collectors to each upgraded node in the cluster
119
122
***After the Cluster is Upgraded** I want to install new versions of metrics collectors to each upgraded node in the cluster.
120
123
***Before the Cluster is Deleted** I want to automatically back up persistent volumes used by the metrics database.
121
124
122
125
### Runtime hook definitions
123
126
124
127
Below is a description for the Runtime Hooks introduced by this proposal.
The remainder of this section has been moved to the Cluster API [book](../../docs/book/src/tasks/experimental-features/runtime-sdk/implement-lifecycle-hooks.md#definitions)
129
132
to avoid duplication.
@@ -210,6 +213,7 @@ See [upgrade strategy](#upgrade-strategy).
210
213
*[x] 2022-04-04: Opened corresponding [issue](https://github.com/kubernetes-sigs/cluster-api/issues/6374)
211
214
*[x] 2022-04-06: Presented proposal at a [community meeting]
212
215
*[x] 2022-04-14: Opened proposal PR
216
+
*[x] 2025-05-13: Added runtime hooks for chained upgrades; see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md)
0 commit comments