Skip to content

Commit 79a5e28

Browse files
đź“– Chained and efficient upgrades for Clusters with managed topologies (#12199)
* Chained and efficient upgrades for Clusters with managed topologies * Address feedback * More feedback * Tmp # Conflicts: # docs/proposals/20210526-cluster-class-and-managed-topologies.md * Drop changes to user facing docs * Small fixes * Fix broken links * Fix review findings * More feedback * More feedback --------- Co-authored-by: Stefan Bueringer <[email protected]>
1 parent 98a8ac0 commit 79a5e28

9 files changed

+698
-1216
lines changed

‎docs/book/src/tasks/experimental-features/runtime-sdk/implement-lifecycle-hooks.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Following recommendations are especially relevant:
3535

3636
## Definitions
3737

38+
For additional details about the OpenAPI spec of the lifecycle hooks, please download the [`runtime-sdk-openapi.yaml`]({{#releaselink repo:"https://github.com/kubernetes-sigs/cluster-api" gomodule:"sigs.k8s.io/cluster-api" asset:"runtime-sdk-openapi.yaml" version:"1.11.x"}})
39+
file and then open it from the [Swagger UI](https://editor.swagger.io/).
40+
3841
### BeforeClusterCreate
3942

4043
This hook is called after the Cluster object has been created by the user, immediately before all the objects which
@@ -69,8 +72,6 @@ message: "error message if status == Failure"
6972
retryAfterSeconds: 10
7073
```
7174
72-
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
73-
7475
(*) The objects which are part of a Cluster topology are the infrastructure Cluster, the Control Plane, the
7576
MachineDeployments and the templates derived from the ClusterClass.
7677
@@ -109,8 +110,6 @@ status: Success # or Failure
109110
message: "error message if status == Failure"
110111
```
111112
112-
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
113-
114113
### BeforeClusterUpgrade
115114
116115
This hook is called after the Cluster object has been updated with a new `spec.topology.version` by the user, and
@@ -153,8 +152,6 @@ message: "error message if status == Failure"
153152
retryAfterSeconds: 10
154153
```
155154

156-
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
157-
158155
(*) Under normal circumstances `spec.topology.version` gets propagated to the control plane immediately; however
159156
if previous upgrades or worker machine rollouts are still in progress, the system waits for those operations
160157
to complete before starting the new upgrade.
@@ -201,8 +198,6 @@ message: "error message if status == Failure"
201198
retryAfterSeconds: 10
202199
```
203200

204-
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
205-
206201
### AfterClusterUpgrade
207202

208203
This hook is called after the Cluster, control plane and workers have been upgraded to the version specified in
@@ -237,8 +232,6 @@ status: Success # or Failure
237232
message: "error message if status == Failure"
238233
```
239234

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-
242235
### BeforeClusterDelete
243236

244237
This hook is called after the Cluster deletion has been triggered by the user and immediately before the topology
@@ -272,13 +265,3 @@ status: Success # or Failure
272265
message: "error message if status == Failure"
273266
retryAfterSeconds: 10
274267
```
275-
276-
For additional details, you can see the full schema in <button onclick="openSwaggerUI()">Swagger UI</button>.
277-
278-
<script>
279-
// openSwaggerUI calculates the absolute URL of the RuntimeSDK YAML file and opens Swagger UI.
280-
function openSwaggerUI() {
281-
var schemaURL = new URL("runtime-sdk-openapi.yaml", document.baseURI).href
282-
window.open("https://editor.swagger.io/?url=" + schemaURL)
283-
}
284-
</script>

‎docs/proposals/20210526-cluster-class-and-managed-topologies.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ If instead you are eager to see an example of ClusterClass and how the Cluster o
188188

189189
The ClusterClass CRD allows to define a collection of templates that describe the topology for one or more clusters.
190190

191-
The detailed definition of this type can be found at [ClusterClass CRD reference](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta1);
191+
The detailed definition of this type can be found at [ClusterClass CRD reference](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta2);
192192
at high level the new CRD contains:
193193

194194
- The reference to the InfrastructureCluster template (e.g. AWSClusterTemplate) to be used when creating a Cluster using this ClusterClass
@@ -209,6 +209,8 @@ at high level the new CRD contains:
209209
- A list of patches, allowing to change above templates for each specific Cluster.
210210
- A list of variable definitions, defining a set of additional values the users can provide on each specific cluster;
211211
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).
212214

213215
The following paragraph provides some additional context on some of the above values; more info can
214216
be found in [writing a ClusterClass](https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-class/write-clusterclass.html).
@@ -241,7 +243,7 @@ providing generic information about the cluster or the template being patched.
241243

242244
##### Cluster
243245

244-
The [Cluster CRD](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/Cluster/v1beta1) has been extended
246+
The [Cluster CRD](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/Cluster/v1beta2) has been extended
245247
with a new field allowing to define and control the cluster topology from a single point.
246248

247249
At high level the cluster topology is defined by:
@@ -378,7 +380,17 @@ as well as in
378380
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
379381
kind: VSphereClusterTemplate
380382
name: vsphere-prod-cluster-template
381-
```
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.
382394
383395
2. User creates a cluster using the class name and defining the topology.
384396
```yaml
@@ -433,6 +445,9 @@ This section talks about updating a Cluster which was created using a `ClusterCl
433445

434446
![Update cluster with ClusterClass](./images/cluster-class/update.png)
435447

448+
see [proposal: Chained and efficient upgrades for Clusters with managed topologies](20250513-chained-and-efficient-upgrades-for-clusters-with-managed-topologies.md)
449+
for more considerations about Kubernetes version upgrade of clusters using managed topologies.
450+
436451
#### Behavior with patches
437452

438453
This section highlights how the basic behavior discussed above changes when patches are used. This is an important use case because without
@@ -485,6 +500,9 @@ like e.g. a different HTTP proxy configuration, a different image to be used for
485500
valueFrom:
486501
variable: machineType
487502
```
503+
504+
See [proposal: topology mutation hook](20220330-topology-mutation-hook.md) for a powerful alternative to
505+
inline patches.
488506

489507
##### Create a new Cluster with patches
490508

@@ -581,7 +599,8 @@ In this cases for ServerSideApply to work properly it is required to ensure the
581599
type definitions, like +MapType or +MapTypeKey, see [merge strategy](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy) for more details.
582600

583601
Note: in order to allow the topology controller to execute templates rotation only when strictly necessary, it is necessary
584-
to implement specific handling of dry run operations in the templates webhooks as described in [Required Changes on providers from 1.1 to 1.2](https://release-1-8.cluster-api.sigs.k8s.io/developer/providers/migrations/v1.1-to-v1.2#required-api-changes-for-providers).
602+
to implement specific handling of dry run operations in the templates webhooks as described in the Cluster API contract, see
603+
e.g. [InfraMachineTemplate: support for SSA dry run](https://cluster-api.sigs.k8s.io/developer/providers/contracts/infra-machine#inframachinetemplate-support-for-ssa-dry-run).
585604

586605
### Risks and Mitigations
587606

@@ -613,6 +632,7 @@ The initial plan is to rollout Cluster Class and support for managed topologies
613632
- 10/04/2021: Added support for patches and variables
614633
- 01/10/2022: Added support for MachineHealthChecks
615634
- 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)
616636

617637
<!-- Links -->
618638
[community meeting]: https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY

0 commit comments

Comments
 (0)