Skip to content

Commit 03e02f3

Browse files
committed
Update contract and migration doc
1 parent 10a765d commit 03e02f3

File tree

2 files changed

+61
-38
lines changed

2 files changed

+61
-38
lines changed

docs/book/src/developer/providers/contracts/control-plane.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -428,25 +428,41 @@ the ControlPlane `spec`.
428428
type FooControlPlaneSpec struct {
429429
// machineTemplate contains information about how machines
430430
// should be shaped when creating or updating a control plane.
431+
// +required
431432
MachineTemplate FooControlPlaneMachineTemplate `json:"machineTemplate"`
432433

433434
// See other rules for more details about mandatory/optional fields in ControlPlane spec.
434435
// Other fields SHOULD be added based on the needs of your provider.
435436
}
436437

437438
type FooControlPlaneMachineTemplate struct {
438-
// Standard object's metadata.
439+
// metadata is the standard object's metadata.
439440
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
440441
// +optional
441442
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty,omitzero"`
442-
443-
// infrastructureRef is a required reference to a custom infra machine template resource
444-
// offered by an infrastructure provider.
445-
// +required
446-
InfrastructureRef clusterv1.ContractVersionedObjectReference `json:"infrastructureRef"`
447-
443+
444+
// spec defines the spec for Machines of the control plane.
445+
// +optional
446+
Spec FooControlPlaneMachineTemplateSpec `json:"spec,omitempty,omitzero"`
447+
}
448+
449+
type FooControlPlaneMachineTemplateSpec struct {
450+
// infrastructureRef is a required reference to a custom infra machine template resource
451+
// offered by an infrastructure provider.
452+
// +required
453+
InfrastructureRef clusterv1.ContractVersionedObjectReference `json:"infrastructureRef"`
454+
455+
// deletion contains configuration options for Machine deletion.
456+
// +optional
457+
Deletion FooControlPlaneMachineTemplateDeletionSpec `json:"deletion,omitempty,omitzero"`
458+
}
459+
460+
// FooControlPlaneMachineTemplateDeletionSpec contains configuration options for Machine deletion.
461+
// +kubebuilder:validation:MinProperties=1
462+
type FooControlPlaneMachineTemplateDeletionSpec struct {
448463
// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a controlplane node
449464
// The default value is 0, meaning that the node can be drained without any time limitations.
465+
// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
450466
// +optional
451467
// +kubebuilder:validation:Minimum=0
452468
NodeDrainTimeoutSeconds *int32 `json:"nodeDrainTimeoutSeconds,omitempty"`
@@ -482,14 +498,16 @@ preserves compatibility with the deprecated v1beta1 contract; compatibility will
482498
For reference. The v1beta1 contract had `nodeDrainTimeout`, `nodeVolumeDetachTimeout`, `nodeDeletionTimeout` fields
483499
of type `*metav1.Duration` instead of the new fields with `Seconds` suffix of type `*int32`.
484500
`infrastructureRef` was of type `corev1.ObjectReference`, the new field has the type `clusterv1.ContractVersionedObjectReference`.
501+
In v1beta2 we also moved `infrastructureRef` into the newly introduced `spec.machineTemplate.spec` field and `nodeDrainTimeoutSeconds`,
502+
`nodeVolumeDetachTimeoutSeconds` and `nodeDeletionTimeoutSeconds` into the newly introduced `spec.machineTemplate.spec.deletion` field.
485503

486504
</aside>
487505

488506
In case you are developing a control plane provider that allows definition of machine readiness gates, you SHOULD also implement
489-
the following `machineTemplate` field.
507+
the following `spec.machineTemplate.spec` field.
490508

491509
```go
492-
type FooControlPlaneMachineTemplate struct {
510+
type FooControlPlaneMachineTemplateSpec struct {
493511
// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
494512
//
495513
// This field can be used e.g. by Cluster API control plane providers to extend the semantic of the
@@ -516,6 +534,8 @@ type FooControlPlaneMachineTemplate struct {
516534
}
517535
```
518536

537+
NOTE: In the v1beta1 contract the `readinessGates` field was located directly in the `spec.machineTemplate` field.
538+
519539
In case you are developing a control plane provider where control plane instances uses a Cluster API Machine
520540
object to represent each control plane instance, but those instances do not show up as a Kubernetes node (for example,
521541
managed control plane providers for AKS, EKS, GKE etc), you SHOULD also implement the following `status` field.

docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ proposal because most of the changes described below are a consequence of the wo
120120
- `spec.topology.controlPlane.machineHealthCheck`
121121
- `spec.topology.workers.machineDeployments[].machineHealthCheck`
122122
- All fields of type Duration in `spec.topology.{controlPlane,workers.machineDeployments[],workers.machinePools[]` have
123-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
124-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
125-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
126-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
123+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
124+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
125+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
126+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
127127
- All fields of type Duration in `spec.topology.{controlPlane.machineHealthCheck,workers.machineDeployments[].machineHealthCheck` have
128128
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
129129
- `nodeStartupTimeout` => `nodeStartupTimeoutSeconds`
@@ -155,10 +155,10 @@ proposal because most of the changes described below are a consequence of the wo
155155
- `apiVersion` has been replaced with `apiGroup`. As before, the version will be read from the corresponding CRD.
156156
- The `spec.progressDeadlineSeconds` field (deprecated since CAPI v1.9) has been removed
157157
- All fields of type Duration in `spec.template.spec` have
158-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
159-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
160-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
161-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
158+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
159+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
160+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
161+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
162162
- Replica counters are now consistent with replica counters from other resources
163163
- `status.replicas` was made a pointer and omitempty was added
164164
- `status.readyReplicas` has now a new semantic based on machine's `Ready` condition
@@ -180,10 +180,10 @@ proposal because most of the changes described below are a consequence of the wo
180180
- The following fields have been removed: `namespace`, `uid`, `resourceVersion`, `fieldPath`
181181
- `apiVersion` has been replaced with `apiGroup`. As before, the version will be read from the corresponding CRD.
182182
- All fields of type Duration in `spec.template.spec` have
183-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
184-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
185-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
186-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
183+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
184+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
185+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
186+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
187187
- Replica counters fields are now consistent with replica counters from other resources
188188
- `status.replicas` was made a pointer and omitempty was added
189189
- `status.readyReplicas` has now a new semantic based on machine's `Ready` condition
@@ -201,10 +201,10 @@ proposal because most of the changes described below are a consequence of the wo
201201
- The following fields have been removed: `namespace`, `uid`, `resourceVersion`, `fieldPath`
202202
- `apiVersion` has been replaced with `apiGroup`. As before, the version will be read from the corresponding CRD.
203203
- All fields of type Duration in `spec.template.spec` have
204-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
205-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
206-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
207-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
204+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
205+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
206+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
207+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
208208
- `status.replicas` was made a pointer and omitempty was added
209209
- Support for terminal errors has been dropped.
210210
- `status.failureReason` and `status.failureMessage` will continue to exist temporarily under `status.deprecated.v1beta1`.
@@ -218,10 +218,10 @@ proposal because most of the changes described below are a consequence of the wo
218218
- The following fields have been removed: `namespace`, `uid`, `resourceVersion`, `fieldPath`
219219
- `apiVersion` has been replaced with `apiGroup`. As before, the version will be read from the corresponding CRD.
220220
- All fields of type Duration in `spec` have
221-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
222-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
223-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
224-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
221+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
222+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
223+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
224+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
225225
- Information about the initial provisioning process is now surfacing under the new `status.initialization` field.
226226
- `status.infrastructureReady` has been replaced by `status.initialization.infrastructureProvisioned`
227227
- `status.bootstrapReady` has been replaced by `status.initialization.bootstrapDataSecretCreated`
@@ -243,6 +243,7 @@ proposal because most of the changes described below are a consequence of the wo
243243
- The `spec.unhealthyConditions` field has been renamed to `spec.unhealthyNodeConditions`
244244
- The `spec.remediationTemplate` field has been migrated from type `corev1.ObjectReference` to `MachineHealthCheckRemediationTemplateReference`:
245245
- The following fields have been removed from `remediationTemplate`: `namespace`, `uid`, `resourceVersion`, `fieldPath`
246+
246247
### ClusterClass
247248

248249
- See changes that apply to [all CRDs](#all-crds)
@@ -256,10 +257,10 @@ proposal because most of the changes described below are a consequence of the wo
256257
- These fields are deprecated and will be removed when support for v1beta1 will be dropped.
257258
- Please use `XMetadata` in `JSONSchemaProps` instead.
258259
- All fields of type Duration in `spec.{controlPlane,workers.machineDeployments[],workers.machinePools[]` have
259-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
260-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
261-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
262-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
260+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
261+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
262+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
263+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
263264
- All fields of type Duration in `spec.controlPlane.machineHealthCheck` and `spec.workers.machineDeployments[].machineHealthCheck` have
264265
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
265266
- `nodeStartupTimeout` => `nodeStartupTimeoutSeconds`
@@ -336,10 +337,11 @@ KubeadmConfigTemplate `spec.template.spec` has been aligned to changes in the [K
336337

337338
- KubeadmControlPlane (and the entire KCP provider) now implements the v1beta2 Cluster API contract.
338339
- See changes that apply to [all CRDs](#all-crds)
339-
- The `spec.machineTemplate.infrastructureRef` field is now using `ContractVersionedObjectReference` type instead
340+
- The `spec.machineTemplate.infrastructureRef` field was moved to `spec.machineTemplate.spec.infrastructureRef` and is now using `ContractVersionedObjectReference` type instead
340341
of `corev1.ObjectReference`.
341342
- The following fields have been removed: `namespace`, `uid`, `resourceVersion`, `fieldPath`
342343
- `apiVersion` has been replaced with `apiGroup`. As before, the version will be read from the corresponding CRD.
344+
- The `spec.machineTemplate.readinessGates` field was moved to `spec.machineTemplate.spec.readinessGates`.
343345
- ExtraArg field types have been changed from `map[string]sting` to `[]Arg`, thus aligning with kubeadm v1beta4 API;
344346
however, using multiple args with the same name will be enabled only when v1beta1 is removed, tentatively in August 2026
345347
- `spec.kubeadmConfigSpec.clusterConfiguration.apiServer.extraArgs` type has been changed to `[]Arg`
@@ -381,10 +383,10 @@ KubeadmConfigTemplate `spec.template.spec` has been aligned to changes in the [K
381383
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
382384
- `.ttl` => `.ttlSeconds`
383385
- All fields of type Duration in `spec.machineTemplate` have
384-
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
385-
- `nodeDrainTimeout` => `nodeDrainTimeoutSeconds`
386-
- `nodeVolumeDetachTimeout` => `nodeVolumeDetachTimeoutSeconds`
387-
- `nodeDeletionTimeout` => `nodeDeletionTimeoutSeconds`
386+
been renamed by adding the `Seconds` suffix, moved into the `deletion` section and their type was changed to int32, thus aligning to K8s guidelines.
387+
- `nodeDrainTimeout` => `deletion.nodeDrainTimeoutSeconds`
388+
- `nodeVolumeDetachTimeout` => `deletion.nodeVolumeDetachTimeoutSeconds`
389+
- `nodeDeletionTimeout` => `deletion.nodeDeletionTimeoutSeconds`
388390
- All fields of type Duration in `spec.remediationStrategy` have
389391
been renamed by adding the `Seconds` suffix and their type was changed to int32, thus aligning to K8s guidelines.
390392
- `retryPeriod` => `retryPeriodSeconds`
@@ -497,6 +499,7 @@ for providers still implementing the v1beta1 contract.
497499
- Type of the `status.version` field was changed from `*string` to `string`.
498500
- [ControlPlane: machines](../contracts/control-plane.md#controlplane-machines)
499501
- Type of the `status.externalManagedControlPlane` field was changed from `bool` to `*bool`.
502+
- Fields in `spec.machineTemplate` were restructured.
500503
- [ControlPlane: conditions](../contracts/control-plane.md#controlplane-conditions)
501504
- The fact that Providers are not required to implement conditions remains valid
502505
- In case a provider implements conditions, Cluster API doesn't require anymore usage of a specific condition type,

0 commit comments

Comments
 (0)