Skip to content

Commit ec04dcb

Browse files
authored
Merge pull request #11364 from fabriziopandini/update-v1beta2-status-cluster-controller
✨ Add v1beta2 condition to Cluster controller
2 parents 30fa2d8 + f766393 commit ec04dcb

23 files changed

+4158
-162
lines changed

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ linters-settings:
168168
alias: runtimeregistry
169169
- pkg: sigs.k8s.io/cluster-api/internal/webhooks/runtime
170170
alias: runtimewebhooks
171+
# CAPI utils
172+
- pkg: sigs.k8s.io/cluster-api/util/conditions/v1beta2
173+
alias: v1beta2conditions
171174
# CAPD
172175
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3
173176
alias: infrav1alpha3

api/v1beta1/cluster_types.go

+232
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,238 @@ const (
4040
ClusterKind = "Cluster"
4141
)
4242

43+
// Cluster's Available condition and corresponding reasons that will be used in v1Beta2 API version.
44+
const (
45+
// ClusterAvailableV1Beta2Condition is true if the Cluster is not deleted, and RemoteConnectionProbe, InfrastructureReady,
46+
// ControlPlaneAvailable, WorkersAvailable, TopologyReconciled (if present) conditions are true.
47+
// If conditions are defined in spec.availabilityGates, those conditions must be true as well.
48+
ClusterAvailableV1Beta2Condition = AvailableV1Beta2Condition
49+
50+
// ClusterAvailableInternalErrorV1Beta2Reason surfaces unexpected error when computing the Available condition.
51+
ClusterAvailableInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
52+
)
53+
54+
// Cluster's TopologyReconciled condition and corresponding reasons that will be used in v1Beta2 API version.
55+
const (
56+
// ClusterTopologyReconciledV1Beta2Condition is true if the topology controller is working properly.
57+
// Note: This condition is added only if the Cluster is referencing a ClusterClass / defining a managed Topology.
58+
ClusterTopologyReconciledV1Beta2Condition = "TopologyReconciled"
59+
)
60+
61+
// Cluster's InfrastructureReady condition and corresponding reasons that will be used in v1Beta2 API version.
62+
const (
63+
// ClusterInfrastructureReadyV1Beta2Condition mirrors Cluster's infrastructure Ready condition.
64+
ClusterInfrastructureReadyV1Beta2Condition = InfrastructureReadyV1Beta2Condition
65+
66+
// ClusterInfrastructureInvalidConditionReportedV1Beta2Reason surfaces a infrastructure Ready condition (read from an infra cluster object) which is invalid
67+
// (e.g. its status is missing).
68+
ClusterInfrastructureInvalidConditionReportedV1Beta2Reason = InvalidConditionReportedV1Beta2Reason
69+
70+
// ClusterInfrastructureReadyNoReasonReportedV1Beta2Reason applies to a infrastructure Ready condition (read from an infra cluster object) that reports no reason.
71+
ClusterInfrastructureReadyNoReasonReportedV1Beta2Reason = NoReasonReportedV1Beta2Reason
72+
73+
// ClusterInfrastructureInternalErrorV1Beta2Reason surfaces unexpected failures when reading an infra cluster object.
74+
ClusterInfrastructureInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
75+
76+
// ClusterInfrastructureDoesNotExistV1Beta2Reason surfaces when a referenced infrastructure object does not exist.
77+
// Note: this could happen when creating the Cluster. However, this state should be treated as an error if it lasts indefinitely.
78+
ClusterInfrastructureDoesNotExistV1Beta2Reason = ObjectDoesNotExistV1Beta2Reason
79+
80+
// ClusterInfrastructureDeletedV1Beta2Reason surfaces when a referenced infrastructure object has been deleted.
81+
// Note: controllers can't identify if the infrastructure object was deleted by the controller itself, e.g.
82+
// during the deletion workflow, or by a users.
83+
ClusterInfrastructureDeletedV1Beta2Reason = ObjectDeletedV1Beta2Reason
84+
)
85+
86+
// Cluster's ControlPlaneInitialized condition and corresponding reasons that will be used in v1Beta2 API version.
87+
const (
88+
// ClusterControlPlaneInitializedV1Beta2Condition is true when the Cluster's control plane is functional enough
89+
// to accept requests. This information is usually used as a signal for starting all the provisioning operations
90+
// that depends on a functional API server, but do not require a full HA control plane to exists.
91+
// Note: Once set to true, this condition will never change.
92+
ClusterControlPlaneInitializedV1Beta2Condition = "ControlPlaneInitialized"
93+
94+
// ClusterControlPlaneInitializedV1Beta2Reason surfaces when the cluster control plane is initialized.
95+
ClusterControlPlaneInitializedV1Beta2Reason = "Initialized"
96+
97+
// ClusterControlPlaneNotInitializedV1Beta2Reason surfaces when the cluster control plane is not yet initialized.
98+
ClusterControlPlaneNotInitializedV1Beta2Reason = "NotInitialized"
99+
100+
// ClusterControlPlaneInitializedInternalErrorV1Beta2Reason surfaces unexpected failures when computing the
101+
// ControlPlaneInitialized condition.
102+
ClusterControlPlaneInitializedInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
103+
)
104+
105+
// Cluster's ControlPlaneAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
106+
const (
107+
// ClusterControlPlaneAvailableV1Beta2Condition is a mirror of Cluster's control plane Available condition.
108+
ClusterControlPlaneAvailableV1Beta2Condition = "ControlPlaneAvailable"
109+
110+
// ClusterControlPlaneInvalidConditionReportedV1Beta2Reason surfaces a control plane Available condition (read from a control plane object) which is invalid.
111+
// (e.g. its status is missing).
112+
ClusterControlPlaneInvalidConditionReportedV1Beta2Reason = InvalidConditionReportedV1Beta2Reason
113+
114+
// ClusterControlPlaneAvailableNoReasonReportedV1Beta2Reason applies to a control plane Available condition (read from a control plane object) that reports no reason.
115+
ClusterControlPlaneAvailableNoReasonReportedV1Beta2Reason = NoReasonReportedV1Beta2Reason
116+
117+
// ClusterControlPlaneInternalErrorV1Beta2Reason surfaces unexpected failures when reading a control plane object.
118+
ClusterControlPlaneInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
119+
120+
// ClusterControlPlaneDoesNotExistV1Beta2Reason surfaces when a referenced control plane object does not exist.
121+
// Note: this could happen when creating the Cluster. However, this state should be treated as an error if it lasts indefinitely.
122+
ClusterControlPlaneDoesNotExistV1Beta2Reason = ObjectDoesNotExistV1Beta2Reason
123+
124+
// ClusterControlPlaneDeletedV1Beta2Reason surfaces when a referenced control plane object has been deleted.
125+
// Note: controllers can't identify if the control plane object was deleted by the controller itself, e.g.
126+
// during the deletion workflow, or by a users.
127+
ClusterControlPlaneDeletedV1Beta2Reason = ObjectDeletedV1Beta2Reason
128+
)
129+
130+
// Cluster's WorkersAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
131+
const (
132+
// ClusterWorkersAvailableV1Beta2Condition is the summary of MachineDeployment and MachinePool's Available conditions.
133+
// Note: Stand-alone MachineSets and stand-alone Machines are not included in this condition.
134+
ClusterWorkersAvailableV1Beta2Condition = "WorkersAvailable"
135+
136+
// ClusterWorkersAvailableNoWorkersV1Beta2Reason surfaces when no MachineDeployment and MachinePool exist for the Cluster.
137+
ClusterWorkersAvailableNoWorkersV1Beta2Reason = "NoWorkers"
138+
139+
// ClusterWorkersAvailableInternalErrorV1Beta2Reason surfaces unexpected failures when listing MachineDeployment and MachinePool
140+
// or aggregating conditions from those objects.
141+
ClusterWorkersAvailableInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
142+
)
143+
144+
// Cluster's MachinesReady condition and corresponding reasons that will be used in v1Beta2 API version.
145+
const (
146+
// ClusterMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any.
147+
ClusterMachinesReadyV1Beta2Condition = MachinesReadyV1Beta2Condition
148+
149+
// ClusterMachinesReadyNoReplicasV1Beta2Reason surfaces when no machines exist for the Cluster.
150+
ClusterMachinesReadyNoReplicasV1Beta2Reason = NoReplicasV1Beta2Reason
151+
152+
// ClusterMachinesReadyInternalErrorV1Beta2Reason surfaces unexpected failures when listing machines
153+
// or aggregating machine's conditions.
154+
ClusterMachinesReadyInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
155+
)
156+
157+
// Cluster's MachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
158+
const (
159+
// ClusterMachinesUpToDateV1Beta2Condition surfaces details of Cluster's machines not up to date, if any.
160+
ClusterMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition
161+
162+
// ClusterMachinesUpToDateNoReplicasV1Beta2Reason surfaces when no machines exist for the Cluster.
163+
ClusterMachinesUpToDateNoReplicasV1Beta2Reason = NoReplicasV1Beta2Reason
164+
165+
// ClusterMachinesUpToDateInternalErrorV1Beta2Reason surfaces unexpected failures when listing machines
166+
// or aggregating status.
167+
ClusterMachinesUpToDateInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
168+
)
169+
170+
// Cluster's RemoteConnectionProbe condition and corresponding reasons that will be used in v1Beta2 API version.
171+
const (
172+
// ClusterRemoteConnectionProbeV1Beta2Condition is true when control plane can be reached; in case of connection problems.
173+
// The condition turns to false only if the cluster cannot be reached for 50s after the first connection problem
174+
// is detected (or whatever period is defined in the --remote-connection-grace-period flag).
175+
ClusterRemoteConnectionProbeV1Beta2Condition = "RemoteConnectionProbe"
176+
177+
// ClusterRemoteConnectionProbeFailedV1Beta2Reason surfaces issues with the connection to the workload cluster.
178+
ClusterRemoteConnectionProbeFailedV1Beta2Reason = "RemoteConnectionProbeFailed"
179+
180+
// ClusterRemoteConnectionProbeSucceededV1Beta2Reason is used to report a working connection with the workload cluster.
181+
ClusterRemoteConnectionProbeSucceededV1Beta2Reason = "RemoteConnectionProbeSucceeded"
182+
)
183+
184+
// Cluster's ScalingUp condition and corresponding reasons that will be used in v1Beta2 API version.
185+
const (
186+
// ClusterScalingUpV1Beta2Condition is the summary of `ScalingUp` conditions from ControlPlane, MachineDeployments,
187+
// MachinePools and stand-alone MachineSets.
188+
ClusterScalingUpV1Beta2Condition = ScalingUpV1Beta2Condition
189+
190+
// ClusterScalingUpV1Beta2Reason surfaces when at least one of the Cluster's control plane, MachineDeployments,
191+
// MachinePools and stand-alone MachineSets are scaling up.
192+
ClusterScalingUpV1Beta2Reason = ScalingUpV1Beta2Reason
193+
194+
// ClusterNotScalingUpV1Beta2Reason surfaces when no one of the Cluster's control plane, MachineDeployments,
195+
// MachinePools and stand-alone MachineSets are scaling up.
196+
ClusterNotScalingUpV1Beta2Reason = NotScalingUpV1Beta2Reason
197+
198+
// ClusterScalingUpInternalErrorV1Beta2Reason surfaces unexpected failures when listing machines
199+
// or computing the ScalingUp condition.
200+
ClusterScalingUpInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
201+
)
202+
203+
// Cluster's ScalingDown condition and corresponding reasons that will be used in v1Beta2 API version.
204+
const (
205+
// ClusterScalingDownV1Beta2Condition is the summary of `ScalingDown` conditions from ControlPlane, MachineDeployments,
206+
// MachinePools and stand-alone MachineSets.
207+
ClusterScalingDownV1Beta2Condition = ScalingDownV1Beta2Condition
208+
209+
// ClusterScalingDownV1Beta2Reason surfaces when at least one of the Cluster's control plane, MachineDeployments,
210+
// MachinePools and stand-alone MachineSets are scaling down.
211+
ClusterScalingDownV1Beta2Reason = ScalingDownV1Beta2Reason
212+
213+
// ClusterNotScalingDownV1Beta2Reason surfaces when no one of the Cluster's control plane, MachineDeployments,
214+
// MachinePools and stand-alone MachineSets are scaling down.
215+
ClusterNotScalingDownV1Beta2Reason = NotScalingUpV1Beta2Reason
216+
217+
// ClusterScalingDownInternalErrorV1Beta2Reason surfaces unexpected failures when listing machines
218+
// or computing the ScalingDown condition.
219+
ClusterScalingDownInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
220+
)
221+
222+
// Cluster's Remediating condition and corresponding reasons that will be used in v1Beta2 API version.
223+
const (
224+
// ClusterRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any.
225+
ClusterRemediatingV1Beta2Condition = RemediatingV1Beta2Condition
226+
227+
// ClusterRemediatingV1Beta2Reason surfaces when the Cluster has at least one machine with HealthCheckSucceeded set to false
228+
// and with the OwnerRemediated condition set to false.
229+
ClusterRemediatingV1Beta2Reason = RemediatingV1Beta2Reason
230+
231+
// ClusterNotRemediatingV1Beta2Reason surfaces when the Cluster does not have any machine with HealthCheckSucceeded set to false
232+
// and with the OwnerRemediated condition set to false.
233+
ClusterNotRemediatingV1Beta2Reason = NotRemediatingV1Beta2Reason
234+
235+
// ClusterRemediatingInternalErrorV1Beta2Reason surfaces unexpected failures when computing the Remediating condition.
236+
ClusterRemediatingInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
237+
)
238+
239+
// Cluster's Deleting condition and corresponding reasons that will be used in v1Beta2 API version.
240+
const (
241+
// ClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the cluster.
242+
ClusterDeletingV1Beta2Condition = DeletingV1Beta2Condition
243+
244+
// ClusterDeletingDeletionTimestampNotSetV1Beta2Reason surfaces when the Cluster is not deleting because the
245+
// DeletionTimestamp is not set.
246+
ClusterDeletingDeletionTimestampNotSetV1Beta2Reason = DeletionTimestampNotSetV1Beta2Reason
247+
248+
// ClusterDeletingWaitingForBeforeDeleteHookV1Beta2Reason surfaces when the Cluster deletion
249+
// waits for the ClusterDelete hooks to allow deletion to complete.
250+
ClusterDeletingWaitingForBeforeDeleteHookV1Beta2Reason = "WaitingForBeforeDeleteHook"
251+
252+
// ClusterDeletingWaitingForWorkersDeletionV1Beta2Reason surfaces when the Cluster deletion
253+
// waits for the workers Machines and the object controlling those machines (MachinePools, MachineDeployments, MachineSets)
254+
// to be deleted.
255+
ClusterDeletingWaitingForWorkersDeletionV1Beta2Reason = "WaitingForWorkersDeletion"
256+
257+
// ClusterDeletingWaitingForControlPlaneDeletionV1Beta2Reason surfaces when the Cluster deletion
258+
// waits for the ControlPlane to be deleted.
259+
ClusterDeletingWaitingForControlPlaneDeletionV1Beta2Reason = "WaitingForControlPlaneDeletion"
260+
261+
// ClusterDeletingWaitingForInfrastructureDeletionV1Beta2Reason surfaces when the Cluster deletion
262+
// waits for the InfraCluster to be deleted.
263+
ClusterDeletingWaitingForInfrastructureDeletionV1Beta2Reason = "WaitingForInfrastructureDeletion"
264+
265+
// ClusterDeletingDeletionCompletedV1Beta2Reason surfaces when the Cluster deletion has been completed.
266+
// This reason is set right after the `cluster.cluster.x-k8s.io` finalizer is removed.
267+
// This means that the object will go away (i.e. be removed from etcd), except if there are other
268+
// finalizers on the Cluster object.
269+
ClusterDeletingDeletionCompletedV1Beta2Reason = DeletionCompletedV1Beta2Reason
270+
271+
// ClusterDeletingInternalErrorV1Beta2Reason surfaces unexpected failures when deleting a cluster.
272+
ClusterDeletingInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
273+
)
274+
43275
// ANCHOR: ClusterSpec
44276

45277
// ClusterSpec defines the desired state of Cluster.

api/v1beta1/clusterclass_types.go

+13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ import (
2828
// ClusterClassKind represents the Kind of ClusterClass.
2929
const ClusterClassKind = "ClusterClass"
3030

31+
// Conditions that will be used for the ClusterClass object in v1Beta2 API version.
32+
const (
33+
// ClusterClassVariablesReadyV1Beta2Condition is true if the ClusterClass variables, including both inline and external
34+
// variables, have been successfully reconciled and thus ready to be used to default and validate variables on Clusters using
35+
// this ClusterClass.
36+
ClusterClassVariablesReadyV1Beta2Condition = "VariablesReady"
37+
38+
// ClusterClassRefVersionsUpToDateV1Beta2Condition documents if the references in the ClusterClass are
39+
// up-to-date (i.e. they are using the latest apiVersion of the current Cluster API contract from
40+
// the corresponding CRD).
41+
ClusterClassRefVersionsUpToDateV1Beta2Condition = "RefVersionsUpToDate"
42+
)
43+
3144
// +kubebuilder:object:root=true
3245
// +kubebuilder:resource:path=clusterclasses,shortName=cc,scope=Namespaced,categories=cluster-api
3346
// +kubebuilder:storageversion

api/v1beta1/machine_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const (
169169
// MachineInfrastructureReadyNoReasonReportedV1Beta2Reason applies to a infrastructure Ready condition (read from an infra machine object) that reports no reason.
170170
MachineInfrastructureReadyNoReasonReportedV1Beta2Reason = NoReasonReportedV1Beta2Reason
171171

172-
// MachineInfrastructureInternalErrorV1Beta2Reason surfaces unexpected failures when reading a infra machine object.
172+
// MachineInfrastructureInternalErrorV1Beta2Reason surfaces unexpected failures when reading an infra machine object.
173173
MachineInfrastructureInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
174174

175175
// MachineInfrastructureDoesNotExistV1Beta2Reason surfaces when a referenced infrastructure object does not exist.

0 commit comments

Comments
 (0)