Skip to content

Commit

Permalink
Refactor ControlPlane contract
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Oct 15, 2024
1 parent 7b752c6 commit 34202b3
Show file tree
Hide file tree
Showing 9 changed files with 842 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ type KubeadmControlPlaneStatus struct {
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas"`

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

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
- [Machine](./developer/core/controllers/machine.md)
- [MachinePool](./developer/core/controllers/machine-pool.md)
- [MachineHealthCheck](./developer/core/controllers/machine-health-check.md)
- [Control Plane](./developer/core/controllers/control-plane.md)
- [Logging](developer/core/logging.md)
- [Testing](developer/core/testing.md)
- [Developing E2E tests](developer/core/e2e.md)
Expand Down
8 changes: 6 additions & 2 deletions docs/book/src/developer/core/controllers/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ Among those rules:
Similarly, in order to support different solutions for control plane management, The Cluster resource references
an ControlPlane object, e.g. KubeadmControlPlane, EKSControlPlane etc.

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
the expected interactions with the Cluster controller.
Among those rules:
- ControlPlane SHOULD report a [controlplane endpoint](../../providers/contracts/control-plane.md#controlplane-endpoint) for the Cluster
- ControlPlane MUST report when Cluster's infrastructure is [fully provisioned](../../providers/contracts/control-plane.md#controlplane-initialization-completed)
- ControlPlane MUST manage a [KubeConfig secret](../../providers/contracts/control-plane.md#cluster-kubeconfig-management)
- ControlPlane SHOULD report [conditions](../../providers/contracts/control-plane.md#controlplane-conditions)
- ControlPlane SHOULD report [terminal failures](../../providers/contracts/control-plane.md#controlplane-terminal-failures)

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

Expand Down
47 changes: 0 additions & 47 deletions docs/book/src/developer/core/controllers/control-plane.md

This file was deleted.

15 changes: 12 additions & 3 deletions docs/book/src/developer/providers/contracts/bootstrap-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ Each BootstrapConfig MUST report when the bootstrap data secret is fully provisi

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

Expand Down Expand Up @@ -297,15 +300,15 @@ setting `status.failureReason` and `status.failureMessage` in the BootstrapConfi

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

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

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

### BootstrapConfig: pausing

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.

If implementing the pause behavior, providers SHOULD surface the paused status of an object using the Paused condition: `Status.Conditions[Paused]`.

## Typical BootstrapConfig reconciliation workflow

A bootstrap provider must respond to changes to its BootstrapConfig resources. This process is
Expand Down
Loading

0 comments on commit 34202b3

Please sign in to comment.