Skip to content

Commit ed15af9

Browse files
committed
docs: incorporate feedback from review
Various updates after review by Fabrizio and Andreas. Specifically: - Making it clearer what is preferred state vs current deprecated - Rewording some parts to be clearer. Signed-off-by: Richard Case <[email protected]>
1 parent c0f0cca commit ed15af9

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

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

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The machines in the pool may be physical or virtual instances (although most lik
88

99
The InfraMachinePool resource will be referenced by one of the Cluster API core resources, MachinePool.
1010

11-
The [MachinePool's controller](../../core/controllers/machine-pool.md) is responsible to coordinate operations of the InfraMachinePool, and the interaction between the MachinePool's controller and the InfraMachinePool is based on the contract rules defined in this page.
11+
The [core MachinePool's controller](../../core/controllers/machine-pool.md) is responsible to coordinate operations of the MachinePool with the InfraMachinePool. The operations are coordinated via the contract rules defined in this page.
1212

1313
Once contract rules are satisfied by an InfraMachinePool implementation, other implementation details
1414
could be addressed according to the specific needs (Cluster API is not prescriptive).
@@ -238,7 +238,7 @@ type FooMachinePoolInstanceStatus struct {
238238

239239
A provider can opt-in to MachinePool Machines (MPM). With MPM machines all the replicas in a MachinePool are represented by a Machine & InfraMachine. This enables core CAPI to perform common operations on single machines (and their Nodes), such as draining a node before scale down, integration with Cluster Autoscaler and also [MachineHealthChecks].
240240

241-
If you want to adopt MPM then you MUST have an `status.infrastructureMachineKind` field and the field must contain the resource kind that represents the replicas in the pool. This is usually named InfraMachine if machine pool machines are representable like regular machines, or InfraMachinePoolMachine in other cases. For example, for the AWS provider the value would be set to `AWSMachine`.
241+
If you want to adopt MPM then you MUST have an `status.infrastructureMachineKind` field and the fields value must be set to the resource kind that represents the replicas in the pool. This is usually the resource kind name for the providers InfraMachine. For example, for the AWS provider the value would be set to `AWSMachine`.
242242

243243
By opting in, the infra provider is expected to create a InfraMachine for every replica in the pool. The lifecycle of these InfraMachines must be managed so that when scale up or scale down happens, the list of InfraMachines is kept up to date.
244244

@@ -302,13 +302,7 @@ Cluster API uses this list to determine the status of the machine pool and to kn
302302

303303
### InfraMachinePool: initialization completed
304304

305-
Each provider MUST indicate when then the InfraMachinePool has been completely provisioned.
306-
307-
Currently this is done by setting `status.ready` to **true**. The value returned here is stored in the MachinePool's `status.infraStructureReady` field.
308-
309-
Additionally providers should set `initialization.provisioned` to **true**. This value isn't currently used by core CAPI for MachinePools. However, MachinePools will start to use this instead and `status.ready` will be deprecated. By setting both these fields it will make the future migration easier.
310-
311-
This indicates to Cluster API that the infrastructure is ready and that it can continue with its processing.
305+
Each InfraMachinePool MUST report when the MachinePool's infrastructure is fully provisioned (initialization) by setting `status.initialization.provisioned` in the InfraMachinePool resource.
312306

313307
```go
314308
type FooMachinePoolStatus struct {
@@ -334,7 +328,22 @@ type FooMachinePoolInitializationStatus struct {
334328

335329
```
336330

337-
Once `status.ready` is set the MachinePool “core” controller will bubble up this info in MachinePool’s `status.initialization.infrastructureProvisioned`; also InfraMachinePools’s `spec.providerIDList` and `status.replicas` will be surfaced on MachinePool’s corresponding fields at the same time.
331+
Once `status.initialization.provisioned` is set the MachinePool "core" controller will bubble this info in the MachinePool's `status.initialization.infrastructureProvisioned`; also InfraMachinePools’s `spec.providerIDList` and `status.replicas` will be surfaced on MachinePool’s corresponding fields at the same time.
332+
333+
<aside class="note warning">
334+
335+
<h1>Compatibility with the deprecated v1beta1 contract</h1>
336+
337+
In order to ease the transition for providers, the v1beta2 version of the Cluster API contract _temporarily_ preserves compatibility with the deprecated v1beta1 contract; compatibility will be removed tentatively in August 2026.
338+
339+
With regard to initialization completed:
340+
341+
Cluster API will continue to temporarily support InfraMachinePool resource using `status.ready` field to report initialization completed.
342+
343+
After compatibility with the deprecated v1beta1 contract will be removed, `status.ready` field in
344+
the InfraMachine resource will be ignored.
345+
346+
</aside>
338347

339348
### InfraMachinePool: pausing
340349

@@ -400,45 +409,30 @@ The value from this field is surfaced via the MachinePool's `status.replicas` fi
400409

401410
### InfraMachinePool: terminal failures
402411

403-
A provider MAY report failure information via their `status.failureReason` and `status.failureMessage` fields.
412+
Starting from the v1beta2 contract version, there is no more special treatment for provider's terminal failures within Cluster API.
404413

405-
```go
406-
type FooMachinePoolStatus struct {
407-
// FailureReason will be set in the event that there is a terminal problem
408-
// reconciling the Machine and will contain a succinct value suitable
409-
// for machine interpretation.
410-
// +optional
411-
FailureReason *string `json:"failureReason,omitempty"`
414+
In case necessary, "terminal failures" should be surfaced using conditions, with a well documented type/reason; it is up to consumers to treat them accordingly.
412415

413-
// FailureMessage will be set in the event that there is a terminal problem
414-
// reconciling the Machine and will contain a more verbose string suitable
415-
// for logging and human consumption.
416-
// +optional
417-
FailureMessage *string `json:"failureMessage,omitempty"`
416+
See [Improving status in CAPI resources] for more context.
418417

419-
// See other rules for more details about mandatory/optional fields in InfraMachinePool status.
420-
// Other fields SHOULD be added based on the needs of your provider.
421-
}
422-
```
418+
<aside class="note warning">
423419

424-
If a provider sets these fields then their value will populated to the same named fields on the the MachinePool.
420+
<h1>Compatibility with the deprecated v1beta1 contract</h1>
425421

426-
<aside class="note warning">
422+
In order to ease the transition for providers, the v1beta2 version of the Cluster API contract _temporarily_ preserves compatibility with the deprecated v1beta1 contract; compatibility will be removed tentatively in August 2026.
427423

428-
<h1>New provider implementations</h1>
424+
With regards to terminal failures:
429425

430-
The use of `failureReason` and `failureMessage` should not be used for new InfraMachinePool implementations. In other areas of the Cluster API, starting from the v1beta2 contract version, there is no more special treatment for provider's terminal failures within Cluster API. These fields should be regarded as deprecated.
426+
In case an infrastructure provider reports that a InfraMachinePool resource is in a state that cannot be recovered (terminal failure) by setting `status.failureReason` and `status.failureMessage` as defined by the deprecated v1beta1 contract, the "core" MachinePool controller will surface those info in the corresponding fields in the MachinePools's `status.deprecated.v1beta1` struct.
431427

432-
In case necessary, "terminal failures" should be surfaced using conditions, with a well documented type/reason;
433-
it is up to consumers to treat them accordingly.
428+
After compatibility with the deprecated v1beta1 contract will be removed, `status.failureReason` and `status.failureMessage` fields in the InfraMachine resource will be ignored and Machine's `status.deprecated.v1beta1` struct will be dropped.
434429

435430
</aside>
436431

437432
### InfraMachinePoolTemplate, InfraMachineTemplatePoolList resource definition
438433

439434
For a given InfraMachinePool resource, you SHOULD also add a corresponding InfraMachinePoolTemplate resource in order to use it in ClusterClasses. The template resource MUST be name `<InfraMachinePool>Template`.
440435

441-
442436
```go
443437
// +kubebuilder:object:root=true
444438
// +kubebuilder:resource:path=foomachinepooltemplates,scope=Namespaced,categories=cluster-api

0 commit comments

Comments
 (0)