Skip to content

Commit 6fc73d9

Browse files
Refactor ControlPlane contract
1 parent 7b752c6 commit 6fc73d9

File tree

9 files changed

+858
-312
lines changed

9 files changed

+858
-312
lines changed

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,11 @@ type KubeadmControlPlaneStatus struct {
271271
// +optional
272272
UnavailableReplicas int32 `json:"unavailableReplicas"`
273273

274-
// Initialized denotes whether or not the control plane has the
275-
// uploaded kubeadm-config configmap.
274+
// Initialized denotes that the KubeadmControlPlane API Server is initialized and thus
275+
// it can accept requests.
276+
// NOTE: this field is part of the Cluster API contract and it is used to orchestrate provisioning.
277+
// The value of this field is never updated after provisioning is completed. Please use conditions
278+
// to check the operational state of the control plane.
276279
// +optional
277280
Initialized bool `json:"initialized"`
278281

controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/src/SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
- [Machine](./developer/core/controllers/machine.md)
7979
- [MachinePool](./developer/core/controllers/machine-pool.md)
8080
- [MachineHealthCheck](./developer/core/controllers/machine-health-check.md)
81-
- [Control Plane](./developer/core/controllers/control-plane.md)
8281
- [Logging](developer/core/logging.md)
8382
- [Testing](developer/core/testing.md)
8483
- [Developing E2E tests](developer/core/e2e.md)

docs/book/src/developer/core/controllers/cluster.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Among those rules:
1818
Similarly, in order to support different solutions for control plane management, The Cluster resource references
1919
an ControlPlane object, e.g. KubeadmControlPlane, EKSControlPlane etc.
2020

21-
The [ControlPlane resource contract](../../providers/contracts/control-plane.md) defines a set of rules a provider is expected to comply with in order to allow
22-
the expected interactions with the Cluster controller.
21+
Among those rules:
22+
- ControlPlane SHOULD report a [controlplane endpoint](../../providers/contracts/control-plane.md#controlplane-endpoint) for the Cluster
23+
- ControlPlane MUST report when Cluster's control plane is [fully provisioned](../../providers/contracts/control-plane.md#controlplane-initialization-completed)
24+
- ControlPlane MUST manage a [KubeConfig secret](../../providers/contracts/control-plane.md#cluster-kubeconfig-management)
25+
- ControlPlane SHOULD report [conditions](../../providers/contracts/control-plane.md#controlplane-conditions)
26+
- ControlPlane SHOULD report [terminal failures](../../providers/contracts/control-plane.md#controlplane-terminal-failures)
2327

2428
Considering all the info above, the Cluster controller's main responsibilities are:
2529

docs/book/src/developer/core/controllers/control-plane.md

-47
This file was deleted.

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

+12-9
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ Each BootstrapConfig MUST report when the bootstrap data secret is fully provisi
221221

222222
```go
223223
type FooConfigStatus struct {
224-
// Ready denotes that the foo bootstrap data secret is fully provisioned.
224+
// ready denotes that the foo bootstrap data secret is fully provisioned.
225+
// NOTE: this field is part of the Cluster API contract and it is used to orchestrate provisioning.
226+
// The value of this field is never updated after provisioning is completed. Please use conditions
227+
// to check the operational state of the bootstrap config.
225228
// +optional
226229
Ready bool `json:"ready"`
227230

@@ -284,28 +287,22 @@ the implication of this choice which are described both in the document above an
284287

285288
</aside>
286289

287-
### BootstrapConfig: pausing
288-
289-
Providers SHOULD implement the pause behaviour for every object with a reconciliation loop. This is done by checking if `spec.paused` is set on the Cluster object and by checking for the `cluster.x-k8s.io/paused` annotation on the BootstrapConfig object.
290-
291-
If implementing the pause behavior, providers SHOULD surface the paused status of an object using the Paused condition: `Status.Conditions[Paused]`.
292-
293290
### BootstrapConfig: terminal failures
294291

295292
Each BootstrapConfig SHOULD report when BootstrapConfig's enter in a state that cannot be recovered (terminal failure) by
296293
setting `status.failureReason` and `status.failureMessage` in the BootstrapConfig resource.
297294

298295
```go
299296
type FooConfigStatus struct {
300-
// FailureReason will be set in the event that there is a terminal problem reconciling the FooConfig
297+
// failureReason will be set in the event that there is a terminal problem reconciling the FooConfig
301298
// and will contain a succinct value suitable for machine interpretation.
302299
//
303300
// This field should not be set for transitive errors that can be fixed automatically or with manual intervention,
304301
// but instead indicate that something is fundamentally wrong with the FooConfig and that it cannot be recovered.
305302
// +optional
306303
FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"`
307304

308-
// FailureMessage will be set in the event that there is a terminal problem reconciling the FooConfig
305+
// failureMessage will be set in the event that there is a terminal problem reconciling the FooConfig
309306
// and will contain a more verbose string suitable for logging and human consumption.
310307
//
311308
// This field should not be set for transitive errors that can be fixed automatically or with manual intervention,
@@ -432,6 +429,12 @@ Please, read carefully the page linked above to fully understand implications an
432429

433430
The clusterctl command is designed to work with all the providers compliant with the rules defined in the [clusterctl provider contract].
434431

432+
### BootstrapConfig: pausing
433+
434+
Providers SHOULD implement the pause behaviour for every object with a reconciliation loop. This is done by checking if `spec.paused` is set on the Cluster object and by checking for the `cluster.x-k8s.io/paused` annotation on the BootstrapConfig object.
435+
436+
If implementing the pause behavior, providers SHOULD surface the paused status of an object using the Paused condition: `Status.Conditions[Paused]`.
437+
435438
## Typical BootstrapConfig reconciliation workflow
436439

437440
A bootstrap provider must respond to changes to its BootstrapConfig resources. This process is

0 commit comments

Comments
 (0)