Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📖 Refactor ControlPlane contract #11285

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 control plane 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.

21 changes: 12 additions & 9 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 @@ -284,28 +287,22 @@ the implication of this choice which are described both in the document above an

</aside>

### 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]`.

### BootstrapConfig: terminal failures

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

```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 +429,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
Loading