Skip to content

Commit 67245f5

Browse files
✨ Add Availability and ReadinessGates to ClusterClass (#11868)
* Add Availability and ReadinessGates to ClusterClass * Address comments * More comments
1 parent 6bac35b commit 67245f5

28 files changed

+896
-47
lines changed

api/v1beta1/cluster_types.go

+33
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ type ClusterSpec struct {
493493

494494
// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
495495
//
496+
// If this field is not defined and the Cluster implements a managed topology, availabilityGates
497+
// from the corresponding ClusterClass will be used, if any.
498+
//
496499
// NOTE: this field is considered only for computing v1beta2 conditions.
497500
// +optional
498501
// +listType=map
@@ -594,6 +597,22 @@ type ControlPlaneTopology struct {
594597
// +optional
595598
NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
596599

600+
// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
601+
//
602+
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
603+
// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
604+
//
605+
// If this field is not defined, readinessGates from the corresponding ControlPlaneClass will be used, if any.
606+
//
607+
// NOTE: This field is considered only for computing v1beta2 conditions.
608+
// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
609+
// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
610+
// +optional
611+
// +listType=map
612+
// +listMapKey=conditionType
613+
// +kubebuilder:validation:MaxItems=32
614+
ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"`
615+
597616
// variables can be used to customize the ControlPlane through patches.
598617
// +optional
599618
Variables *ControlPlaneVariables `json:"variables,omitempty"`
@@ -674,6 +693,20 @@ type MachineDeploymentTopology struct {
674693
// +optional
675694
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
676695

696+
// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
697+
//
698+
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
699+
// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
700+
//
701+
// If this field is not defined, readinessGates from the corresponding MachineDeploymentClass will be used, if any.
702+
//
703+
// NOTE: This field is considered only for computing v1beta2 conditions.
704+
// +optional
705+
// +listType=map
706+
// +listMapKey=conditionType
707+
// +kubebuilder:validation:MaxItems=32
708+
ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"`
709+
677710
// strategy is the deployment strategy to use to replace existing machines with
678711
// new ones.
679712
// +optional

api/v1beta1/clusterclass_types.go

+41
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ type ClusterClass struct {
8181

8282
// ClusterClassSpec describes the desired state of the ClusterClass.
8383
type ClusterClassSpec struct {
84+
// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
85+
//
86+
// NOTE: this field is considered only for computing v1beta2 conditions.
87+
// NOTE: If a Cluster is using this ClusterClass, and this Cluster defines a custom list of availabilityGates,
88+
// such list overrides availabilityGates defined in this field.
89+
// +optional
90+
// +listType=map
91+
// +listMapKey=conditionType
92+
// +kubebuilder:validation:MaxItems=32
93+
AvailabilityGates []ClusterAvailabilityGate `json:"availabilityGates,omitempty"`
94+
8495
// infrastructure is a reference to a provider-specific template that holds
8596
// the details for provisioning infrastructure specific cluster
8697
// for the underlying provider.
@@ -165,6 +176,22 @@ type ControlPlaneClass struct {
165176
// NOTE: This value can be overridden while defining a Cluster.Topology.
166177
// +optional
167178
NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
179+
180+
// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
181+
//
182+
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
183+
// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
184+
//
185+
// NOTE: This field is considered only for computing v1beta2 conditions.
186+
// NOTE: If a Cluster defines a custom list of readinessGates for the control plane,
187+
// such list overrides readinessGates defined in this field.
188+
// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
189+
// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
190+
// +optional
191+
// +listType=map
192+
// +listMapKey=conditionType
193+
// +kubebuilder:validation:MaxItems=32
194+
ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"`
168195
}
169196

170197
// ControlPlaneClassNamingStrategy defines the naming strategy for control plane objects.
@@ -250,6 +277,20 @@ type MachineDeploymentClass struct {
250277
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
251278
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
252279

280+
// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
281+
//
282+
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
283+
// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
284+
//
285+
// NOTE: This field is considered only for computing v1beta2 conditions.
286+
// NOTE: If a Cluster defines a custom list of readinessGates for a MachineDeployment using this MachineDeploymentClass,
287+
// such list overrides readinessGates defined in this field.
288+
// +optional
289+
// +listType=map
290+
// +listMapKey=conditionType
291+
// +kubebuilder:validation:MaxItems=32
292+
ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"`
293+
253294
// strategy is the deployment strategy to use to replace existing machines with
254295
// new ones.
255296
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.

api/v1beta1/zz_generated.deepcopy.go

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)