kubernetes-sigs / cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Apache License 2.0
3.5k stars 1.3k forks source link

Add conditions to the Machine object #3112

Closed fabriziopandini closed 4 years ago

fabriziopandini commented 4 years ago

User Story

As a developer/user/operator I would like to have conditions documenting the operational state of Machine objects

Detailed Description A Machine object in CAPI is defined by the aggregation of an infrastructure machine and a bootstrap configuration object.

As a consequence, I'm proposing to start implementing the following two conditions for the Machine object:

// BootstrapReady reports a summary of the current status of the bootstrap object defined for this machine.
// This condition is mirrored from the Ready condition in the bootstrap ref object, and
// the absence of this condition might signal problems in the reconcile external loops or the fact that
// the bootstrap provider does not implement the Ready condition yet.
MachineBootstrapReadyCondition ConditionType = "BootstrapReady"

// InfrastructureReady reports a summary of the current status of the infrastructure object defined for this machine.
// This condition is mirrored from the Ready condition in the infrastructure ref object, and
// the absence of this condition might signal problems in the reconcile external loops or the fact that
// the infrastructure provider does not implement the Ready condition yet.
MachineInfrastructureReadyCondition ConditionType = "InfrastructureReady"

Additionally, being the machine responsible to report the ProviderID, I would like to add the following condition:

// NodeStartupSucceeded provides an observation of a node completing startup and reporting the ProviderID.
NodeStartupSucceeded ConditionType = "NodeStartupSucceeded"

The NodeStartupSucceeded state=False will be further detailed by the following reasons:

TBD if to add a NodeReady condition (currently not monitored by the controller).

Anything else you would like to add: As required by the condition CAEP, the Machine objects should also provide a Ready condition describing the overall state of the object, in this case, the summary of ContainerProvisioningSucceeded, BootstrapSucceeded and NodeStartupSucceeded.

Being a machine is a key element in CAPI most probably we are going to add more conditions over time. E.g. for control plane machines based on kubeadm, it might be interesting to consider reporting local etcd status, static pod status, etc. So you should consider this as the first iteration on Machine conditions.

/kind feature

vincepri commented 4 years ago

/milestone v0.3.x

vincepri commented 4 years ago

+1 for the first two and do the rest later

fabriziopandini commented 4 years ago

/assign /lifecycle active