Skip to content

Commit f41acb7

Browse files
authored
Merge pull request #11521 from fabriziopandini/small-improvements-to-v1beta2-conditions-godoc
🌱 Small improvements to v1beta2 conditions godoc
2 parents 5ced868 + d934125 commit f41acb7

File tree

15 files changed

+63
-10
lines changed

15 files changed

+63
-10
lines changed

api/v1beta1/cluster_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ const (
4545
// ClusterAvailableV1Beta2Condition is true if the Cluster is not deleted, and RemoteConnectionProbe, InfrastructureReady,
4646
// ControlPlaneAvailable, WorkersAvailable, TopologyReconciled (if present) conditions are true.
4747
// If conditions are defined in spec.availabilityGates, those conditions must be true as well.
48+
// Note:
49+
// - When summarizing TopologyReconciled, all reasons except TopologyReconcileFailed and ClusterClassNotReconciled will
50+
// be treated as info. This is because even if topology is not fully reconciled, this is an expected temporary state
51+
// and it doesn't impact availability.
52+
// - When summarizing InfrastructureReady, ControlPlaneAvailable, in case the Cluster is deleting, the absence of the
53+
// referenced object won't be considered as an issue.
4854
ClusterAvailableV1Beta2Condition = AvailableV1Beta2Condition
4955

5056
// ClusterAvailableV1Beta2Reason surfaces when the cluster availability criteria is met.
@@ -270,6 +276,7 @@ const (
270276
// Cluster's ControlPlaneMachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
271277
const (
272278
// ClusterControlPlaneMachinesUpToDateV1Beta2Condition surfaces details of control plane machines not up to date, if any.
279+
// Note: New machines are considered 10s after machine creation. This gives time to the machine's owner controller to recognize the new machine and add the UpToDate condition.
273280
ClusterControlPlaneMachinesUpToDateV1Beta2Condition = "ControlPlaneMachinesUpToDate"
274281

275282
// ClusterControlPlaneMachinesUpToDateV1Beta2Reason surfaces when all the control plane machine's UpToDate conditions are true.
@@ -293,6 +300,7 @@ const (
293300
// Cluster's WorkerMachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
294301
const (
295302
// ClusterWorkerMachinesUpToDateV1Beta2Condition surfaces details of worker machines not up to date, if any.
303+
// Note: New machines are considered 10s after machine creation. This gives time to the machine's owner controller to recognize the new machine and add the UpToDate condition.
296304
ClusterWorkerMachinesUpToDateV1Beta2Condition = "WorkerMachinesUpToDate"
297305

298306
// ClusterWorkerMachinesUpToDateV1Beta2Reason surfaces when all the worker machine's UpToDate conditions are true.

api/v1beta1/machine_types.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,19 @@ const (
104104
)
105105

106106
// Machine's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
107-
// Note: when possible, Ready condition will use reasons from the conditions it summarizes.
108107
const (
109108
// MachineReadyV1Beta2Condition is true if the Machine's deletionTimestamp is not set, Machine's BootstrapConfigReady, InfrastructureReady,
110109
// NodeHealthy and HealthCheckSucceeded (if present) conditions are true; if other conditions are defined in spec.readinessGates,
111110
// these conditions must be true as well.
111+
// Note:
112+
// - When summarizing the Deleting condition:
113+
// - Details about Pods stuck in draining or volumes waiting for detach are dropped, in order to improve readability & reduce flickering
114+
// of the condition that bubbles up to the owning resources/ to the Cluster (it also makes it more likely this condition might be aggregated with
115+
// conditions reported by other machines).
116+
// - If deletion is in progress for more than 15m, this surfaces on the summary condition (hint about a possible stale deletion).
117+
// - if drain is in progress for more than 5 minutes, a summery of what is blocking drain also surfaces in the message.
118+
// - When summarizing BootstrapConfigReady, InfrastructureReady, NodeHealthy, in case the Machine is deleting, the absence of the
119+
// referenced object won't be considered as an issue.
112120
MachineReadyV1Beta2Condition = ReadyV1Beta2Condition
113121

114122
// MachineReadyV1Beta2Reason surfaces when the machine readiness criteria is met.
@@ -420,7 +428,11 @@ type MachineSpec struct {
420428
// Another example are external controllers, e.g. responsible to install special software/hardware on the Machines;
421429
// they can include the status of those components with a new condition and add this condition to ReadinessGates.
422430
//
423-
// NOTE: this field is considered only for computing v1beta2 conditions.
431+
// NOTE: This field is considered only for computing v1beta2 conditions.
432+
// NOTE: In case readinessGates conditions start with the APIServer, ControllerManager, Scheduler prefix, and all those
433+
// readiness gates condition are reporting the same message, when computing the Machine's Ready condition those
434+
// readinessGates will be replaced by a single entry reporting "Control plane components: " + message.
435+
// This helps to improve readability of conditions bubbling up to the Machine's owner resource / to the Cluster).
424436
// +optional
425437
// +listType=map
426438
// +listMapKey=conditionType

api/v1beta1/machinedeployment_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const (
128128
// MachineDeployment's MachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
129129
const (
130130
// MachineDeploymentMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any.
131+
// Note: New machines are considered 10s after machine creation. This gives time to the machine's owner controller to recognize the new machine and add the UpToDate condition.
131132
MachineDeploymentMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition
132133

133134
// MachineDeploymentMachinesUpToDateV1Beta2Reason surfaces when all the controlled machine's UpToDate conditions are true.

api/v1beta1/machineset_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type MachineSetSpec struct {
9090
// MachineSet's ScalingUp condition and corresponding reasons that will be used in v1Beta2 API version.
9191
const (
9292
// MachineSetScalingUpV1Beta2Condition is true if actual replicas < desired replicas.
93+
// Note: In case a MachineSet preflight check is preventing scale up, this will surface in the condition message.
9394
MachineSetScalingUpV1Beta2Condition = ScalingUpV1Beta2Condition
9495

9596
// MachineSetScalingUpV1Beta2Reason surfaces when actual replicas < desired replicas.
@@ -153,6 +154,7 @@ const (
153154
// Note: Reason's could also be derived from the aggregation of machine's MachinesUpToDate conditions.
154155
const (
155156
// MachineSetMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any.
157+
// Note: New machines are considered 10s after machine creation. This gives time to the machine's owner controller to recognize the new machine and add the UpToDate condition.
156158
MachineSetMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition
157159

158160
// MachineSetMachinesUpToDateV1Beta2Reason surfaces when all the controlled machine's UpToDate conditions are true.

api/v1beta1/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cluster.x-k8s.io_machinepools.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cluster.x-k8s.io_machines.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cluster.x-k8s.io_machinesets.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const (
3030
// plane cannot be considered operational (if etcd is not operational on a machine, most likely also API server,
3131
// scheduler and controller manager on the same machine will be impacted).
3232
// - In case of external etcd, KCP cannot make any assumption on etcd status, so all the etcd checks are skipped.
33+
//
34+
// Please note that when this condition is true, partial unavailability will be surfaced in the condition message,
35+
// but with a 10s delay to ensure flakes do not impact condition stability.
3336
KubeadmControlPlaneAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition
3437

3538
// KubeadmControlPlaneAvailableInspectionFailedV1Beta2Reason documents a failure when inspecting the status of the
@@ -157,6 +160,7 @@ const (
157160
// KubeadmControlPlane's MachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
158161
const (
159162
// KubeadmControlPlaneMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any.
163+
// Note: New machines are considered 10s after machine creation. This gives time to the machine's owner controller to recognize the new machine and add the UpToDate condition.
160164
KubeadmControlPlaneMachinesUpToDateV1Beta2Condition = clusterv1.MachinesUpToDateV1Beta2Condition
161165

162166
// KubeadmControlPlaneMachinesUpToDateV1Beta2Reason surfaces when all the controlled machine's UpToDate conditions are true.
@@ -191,6 +195,7 @@ const (
191195
// KubeadmControlPlane's ScalingUp condition and corresponding reasons that will be used in v1Beta2 API version.
192196
const (
193197
// KubeadmControlPlaneScalingUpV1Beta2Condition is true if actual replicas < desired replicas.
198+
// Note: In case a KubeadmControlPlane preflight check is preventing scale up, this will surface in the condition message.
194199
KubeadmControlPlaneScalingUpV1Beta2Condition = clusterv1.ScalingUpV1Beta2Condition
195200

196201
// KubeadmControlPlaneScalingUpV1Beta2Reason surfaces when actual replicas < desired replicas.
@@ -207,6 +212,7 @@ const (
207212
// KubeadmControlPlane's ScalingDown condition and corresponding reasons that will be used in v1Beta2 API version.
208213
const (
209214
// KubeadmControlPlaneScalingDownV1Beta2Condition is true if actual replicas > desired replicas.
215+
// Note: In case a KubeadmControlPlane preflight check is preventing scale down, this will surface in the condition message.
210216
KubeadmControlPlaneScalingDownV1Beta2Condition = clusterv1.ScalingDownV1Beta2Condition
211217

212218
// KubeadmControlPlaneScalingDownV1Beta2Reason surfaces when actual replicas > desired replicas.

0 commit comments

Comments
 (0)