Skip to content

Commit 2c33545

Browse files
committed
docs: document ClusterClass rotation behavior for MachinePool objects
Signed-off-by: Bharath Nallapeta <nr.bharath97@gmail.com>
1 parent 99872f1 commit 2c33545

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

docs/book/src/developer/providers/contracts/bootstrap-config.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ repo or add an item to the agenda in the [Cluster API community meeting](https:/
5555
| [BootstrapConfig: terminal failures] | No | |
5656
| [BootstrapConfigTemplate, BootstrapConfigTemplateList resource definition] | Yes | |
5757
| [BootstrapConfigTemplate: support for SSA dry run] | No | Mandatory for ClusterClasses support |
58+
| [ClusterClass topology controller behavior for MachinePools] | No | Mandatory for ClusterClasses support |
5859
| [Sentinel file] | No | |
5960
| [Taint Nodes at creation] | No | |
6061
| [Support for running multiple instances] | No | Mandatory for clusterctl CLI support |
@@ -420,6 +421,38 @@ validation behavior for all other cases.
420421

421422
See [the DockerMachineTemplate webhook] as a reference for a compatible implementation.
422423

424+
### ClusterClass topology controller behavior for MachinePools
425+
426+
When using ClusterClass and managed topologies with MachinePools, the topology controller creates BootstrapConfig objects
427+
from BootstrapConfigTemplates. Unlike templates (which are immutable), these BootstrapConfig objects are treated as
428+
**effectively immutable for spec changes**.
429+
430+
When the topology controller detects spec changes to a BootstrapConfig used by a MachinePool (e.g., from template updates
431+
in ClusterClass), it performs a **rotation**:
432+
433+
1. Creates a new BootstrapConfig object with a new name
434+
2. Updates the MachinePool's `spec.template.spec.bootstrap.configRef` to reference the new object
435+
3. The old BootstrapConfig is garbage collected when no longer referenced
436+
437+
<aside class="note">
438+
439+
<h1>Provider expectations for rotation</h1>
440+
441+
Bootstrap providers SHOULD be aware that when used with MachinePools, the BootstrapConfig object may be rotated
442+
(replaced with a new object) rather than updated in-place when spec changes occur.
443+
444+
Infrastructure providers watching for bootstrap changes should monitor the MachinePool's `spec.template.spec.bootstrap.configRef.name`
445+
field. When the reference name changes, this indicates a rotation has occurred and may require triggering a node rollout.
446+
447+
This pattern is consistent with how MachineDeployments handle BootstrapTemplate rotations.
448+
449+
</aside>
450+
451+
Note: Metadata-only changes (labels, annotations) do NOT trigger rotation; they are patched in-place on the existing object.
452+
453+
Note: This rotation behavior is specific to MachinePools. For individual Machines (e.g., in MachineDeployments), BootstrapConfig
454+
objects are created per-Machine and follow the standard Machine lifecycle.
455+
423456
### Sentinel file
424457

425458
A bootstrap provider's bootstrap data must create `/run/cluster-api/bootstrap-success.complete`
@@ -502,6 +535,7 @@ The following diagram shows the typical logic for a bootstrap provider:
502535
[BootstrapConfig: terminal failures]: #bootstrapconfig-terminal-failures
503536
[BootstrapConfigTemplate, BootstrapConfigTemplateList resource definition]: #bootstrapconfigtemplate-bootstrapconfigtemplatelist-resource-definition
504537
[BootstrapConfigTemplate: support for SSA dry run]: #bootstrapconfigtemplate-support-for-ssa-dry-run
538+
[ClusterClass topology controller behavior for MachinePools]: #clusterclass-topology-controller-behavior-for-machinepools
505539
[Sentinel file]: #sentinel-file
506540
[Taint Nodes at creation]: #taint-nodes-at-creation
507541
[Support for running multiple instances]: #support-for-running-multiple-instances

docs/book/src/developer/providers/contracts/infra-machinepool.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ To provide feedback or open a discussion about the provider contract please [ope
5555
| [InfraMachinePool: terminal failures] | No | |
5656
| [InfraMachinePoolTemplate, InfraMachineTemplatePoolList resource definition] | No | Mandatory for ClusterClasses support |
5757
| [InfraMachinePoolTemplate: support for SSA dry run] | No | Mandatory for ClusterClasses support |
58+
| [ClusterClass topology controller behavior] | No | Mandatory for ClusterClasses support |
5859
| [Multi tenancy] | No | Mandatory for clusterctl CLI support |
5960
| [Clusterctl support] | No | Mandatory for clusterctl CLI support |
6061

@@ -495,6 +496,35 @@ The implementation requires to use controller runtime's `CustomValidator`, avail
495496
This will allow to skip the immutability check only when the topology controller is dry running while preserving the
496497
validation behavior for all other cases.
497498

499+
### ClusterClass topology controller behavior
500+
501+
When using ClusterClass and managed topologies, the topology controller creates InfraMachinePool objects from InfraMachinePoolTemplates.
502+
Unlike templates (which are immutable), these InfraMachinePool objects are treated as **effectively immutable for spec changes**.
503+
504+
When the topology controller detects spec changes to an InfraMachinePool (e.g., from template updates in ClusterClass), it performs
505+
a **rotation**:
506+
507+
1. Creates a new InfraMachinePool object with a new name
508+
2. Copies `spec.providerIDList` from the old InfraMachinePool to the new one (to preserve instance tracking)
509+
3. Updates the MachinePool's `spec.template.spec.infrastructureRef` to reference the new object
510+
4. The old InfraMachinePool is garbage collected when no longer referenced
511+
512+
<aside class="note">
513+
514+
<h1>Provider expectations for rotation</h1>
515+
516+
Providers SHOULD watch for changes to the MachinePool's `spec.template.spec.infrastructureRef.name` field.
517+
When the reference name changes, this indicates a rotation has occurred and the provider SHOULD:
518+
519+
- Use the `spec.providerIDList` from the new InfraMachinePool to identify existing instances
520+
- Trigger any necessary rollout or reconciliation based on the spec changes
521+
522+
This pattern is consistent with how MachineDeployments handle InfrastructureMachineTemplate rotations.
523+
524+
</aside>
525+
526+
Note: Metadata-only changes (labels, annotations) do NOT trigger rotation; they are patched in-place on the existing object.
527+
498528
### Multi tenancy
499529

500530
Multi tenancy in Cluster API defines the capability of an infrastructure provider to manage different credentials,
@@ -532,6 +562,7 @@ The clusterctl command is designed to work with all the providers compliant with
532562
[InfraMachinePool: terminal failures]: #inframachinepool-terminal-failures
533563
[InfraMachinePoolTemplate, InfraMachineTemplatePoolList resource definition]: #inframachinepooltemplate-inframachinetemplatepoollist-resource-definition
534564
[InfraMachinePoolTemplate: support for SSA dry run]: #inframachinepooltemplate-support-for-ssa-dry-run
565+
[ClusterClass topology controller behavior]: #clusterclass-topology-controller-behavior
535566
[MachinePoolMachines support]: #machinepoolmachines-support
536567
[Multi tenancy]: #multi-tenancy
537568
[Clusterctl support]: #clusterctl-support

0 commit comments

Comments
 (0)