Skip to main content

cluster_api_rs/api/
capi_cluster.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium --smart-derive-elision -D Default -D PartialEq -A -d -f -
3// kopium version: 0.23.0
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
9    pub use kube::CustomResource;
10    pub use schemars::JsonSchema;
11    pub use serde::{Deserialize, Serialize};
12    pub use std::collections::BTreeMap;
13}
14
15use self::prelude::*;
16
17/// spec is the desired state of Cluster.
18#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
19#[kube(
20    group = "cluster.x-k8s.io",
21    version = "v1beta2",
22    kind = "Cluster",
23    plural = "clusters"
24)]
25#[kube(namespaced)]
26#[kube(status = "ClusterStatus")]
27#[kube(derive = "Default")]
28#[kube(derive = "PartialEq")]
29pub struct ClusterSpec {
30    /// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
31    ///
32    /// If this field is not defined and the Cluster implements a managed topology, availabilityGates
33    /// from the corresponding ClusterClass will be used, if any.
34    #[serde(
35        default,
36        skip_serializing_if = "Option::is_none",
37        rename = "availabilityGates"
38    )]
39    pub availability_gates: Option<Vec<ClusterAvailabilityGates>>,
40    /// clusterNetwork represents the cluster network configuration.
41    #[serde(
42        default,
43        skip_serializing_if = "Option::is_none",
44        rename = "clusterNetwork"
45    )]
46    pub cluster_network: Option<ClusterClusterNetwork>,
47    /// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
48    #[serde(
49        default,
50        skip_serializing_if = "Option::is_none",
51        rename = "controlPlaneEndpoint"
52    )]
53    pub control_plane_endpoint: Option<ClusterControlPlaneEndpoint>,
54    /// controlPlaneRef is an optional reference to a provider-specific resource that holds
55    /// the details for provisioning the Control Plane for a Cluster.
56    #[serde(
57        default,
58        skip_serializing_if = "Option::is_none",
59        rename = "controlPlaneRef"
60    )]
61    pub control_plane_ref: Option<ClusterControlPlaneRef>,
62    /// infrastructureRef is a reference to a provider-specific resource that holds the details
63    /// for provisioning infrastructure for a cluster in said provider.
64    #[serde(
65        default,
66        skip_serializing_if = "Option::is_none",
67        rename = "infrastructureRef"
68    )]
69    pub infrastructure_ref: Option<ClusterInfrastructureRef>,
70    /// paused can be used to prevent controllers from processing the Cluster and all its associated objects.
71    #[serde(default, skip_serializing_if = "Option::is_none")]
72    pub paused: Option<bool>,
73    /// topology encapsulates the topology for the cluster.
74    /// NOTE: It is required to enable the ClusterTopology
75    /// feature gate flag to activate managed topologies support.
76    #[serde(default, skip_serializing_if = "Option::is_none")]
77    pub topology: Option<ClusterTopology>,
78}
79
80/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
81#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
82pub struct ClusterAvailabilityGates {
83    /// conditionType refers to a condition with matching type in the Cluster's condition list.
84    /// If the conditions doesn't exist, it will be treated as unknown.
85    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates.
86    #[serde(rename = "conditionType")]
87    pub condition_type: String,
88    /// polarity of the conditionType specified in this availabilityGate.
89    /// Valid values are Positive, Negative and omitted.
90    /// When omitted, the default behaviour will be Positive.
91    /// A positive polarity means that the condition should report a true status under normal conditions.
92    /// A negative polarity means that the condition should report a false status under normal conditions.
93    #[serde(default, skip_serializing_if = "Option::is_none")]
94    pub polarity: Option<ClusterAvailabilityGatesPolarity>,
95}
96
97/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
98#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
99pub enum ClusterAvailabilityGatesPolarity {
100    Positive,
101    Negative,
102}
103
104/// clusterNetwork represents the cluster network configuration.
105#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
106pub struct ClusterClusterNetwork {
107    /// apiServerPort specifies the port the API Server should bind to.
108    /// Defaults to 6443.
109    #[serde(
110        default,
111        skip_serializing_if = "Option::is_none",
112        rename = "apiServerPort"
113    )]
114    pub api_server_port: Option<i32>,
115    /// pods is the network ranges from which Pod networks are allocated.
116    #[serde(default, skip_serializing_if = "Option::is_none")]
117    pub pods: Option<ClusterClusterNetworkPods>,
118    /// serviceDomain is the domain name for services.
119    #[serde(
120        default,
121        skip_serializing_if = "Option::is_none",
122        rename = "serviceDomain"
123    )]
124    pub service_domain: Option<String>,
125    /// services is the network ranges from which service VIPs are allocated.
126    #[serde(default, skip_serializing_if = "Option::is_none")]
127    pub services: Option<ClusterClusterNetworkServices>,
128}
129
130/// pods is the network ranges from which Pod networks are allocated.
131#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
132pub struct ClusterClusterNetworkPods {
133    /// cidrBlocks is a list of CIDR blocks.
134    #[serde(rename = "cidrBlocks")]
135    pub cidr_blocks: Vec<String>,
136}
137
138/// services is the network ranges from which service VIPs are allocated.
139#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
140pub struct ClusterClusterNetworkServices {
141    /// cidrBlocks is a list of CIDR blocks.
142    #[serde(rename = "cidrBlocks")]
143    pub cidr_blocks: Vec<String>,
144}
145
146/// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
147#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
148pub struct ClusterControlPlaneEndpoint {
149    /// host is the hostname on which the API server is serving.
150    #[serde(default, skip_serializing_if = "Option::is_none")]
151    pub host: Option<String>,
152    /// port is the port on which the API server is serving.
153    #[serde(default, skip_serializing_if = "Option::is_none")]
154    pub port: Option<i32>,
155}
156
157/// controlPlaneRef is an optional reference to a provider-specific resource that holds
158/// the details for provisioning the Control Plane for a Cluster.
159#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
160pub struct ClusterControlPlaneRef {
161    /// apiGroup is the group of the resource being referenced.
162    /// apiGroup must be fully qualified domain name.
163    /// The corresponding version for this reference will be looked up from the contract
164    /// labels of the corresponding CRD of the resource being referenced.
165    #[serde(rename = "apiGroup")]
166    pub api_group: String,
167    /// kind of the resource being referenced.
168    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
169    pub kind: String,
170    /// name of the resource being referenced.
171    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
172    pub name: String,
173}
174
175/// infrastructureRef is a reference to a provider-specific resource that holds the details
176/// for provisioning infrastructure for a cluster in said provider.
177#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
178pub struct ClusterInfrastructureRef {
179    /// apiGroup is the group of the resource being referenced.
180    /// apiGroup must be fully qualified domain name.
181    /// The corresponding version for this reference will be looked up from the contract
182    /// labels of the corresponding CRD of the resource being referenced.
183    #[serde(rename = "apiGroup")]
184    pub api_group: String,
185    /// kind of the resource being referenced.
186    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
187    pub kind: String,
188    /// name of the resource being referenced.
189    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
190    pub name: String,
191}
192
193/// topology encapsulates the topology for the cluster.
194/// NOTE: It is required to enable the ClusterTopology
195/// feature gate flag to activate managed topologies support.
196#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
197pub struct ClusterTopology {
198    /// classRef is the ref to the ClusterClass that should be used for the topology.
199    #[serde(rename = "classRef")]
200    pub class_ref: ClusterTopologyClassRef,
201    /// controlPlane describes the cluster control plane.
202    #[serde(
203        default,
204        skip_serializing_if = "Option::is_none",
205        rename = "controlPlane"
206    )]
207    pub control_plane: Option<ClusterTopologyControlPlane>,
208    /// variables can be used to customize the Cluster through
209    /// patches. They must comply to the corresponding
210    /// VariableClasses defined in the ClusterClass.
211    #[serde(default, skip_serializing_if = "Option::is_none")]
212    pub variables: Option<Vec<ClusterTopologyVariables>>,
213    /// version is the Kubernetes version of the cluster.
214    pub version: String,
215    /// workers encapsulates the different constructs that form the worker nodes
216    /// for the cluster.
217    #[serde(default, skip_serializing_if = "Option::is_none")]
218    pub workers: Option<ClusterTopologyWorkers>,
219}
220
221/// classRef is the ref to the ClusterClass that should be used for the topology.
222#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
223pub struct ClusterTopologyClassRef {
224    /// name is the name of the ClusterClass that should be used for the topology.
225    /// name must be a valid ClusterClass name and because of that be at most 253 characters in length
226    /// and it must consist only of lower case alphanumeric characters, hyphens (-) and periods (.), and must start
227    /// and end with an alphanumeric character.
228    pub name: String,
229    /// namespace is the namespace of the ClusterClass that should be used for the topology.
230    /// If namespace is empty or not set, it is defaulted to the namespace of the Cluster object.
231    /// namespace must be a valid namespace name and because of that be at most 63 characters in length
232    /// and it must consist only of lower case alphanumeric characters or hyphens (-), and must start
233    /// and end with an alphanumeric character.
234    #[serde(default, skip_serializing_if = "Option::is_none")]
235    pub namespace: Option<String>,
236}
237
238/// controlPlane describes the cluster control plane.
239#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
240pub struct ClusterTopologyControlPlane {
241    /// deletion contains configuration options for Machine deletion.
242    #[serde(default, skip_serializing_if = "Option::is_none")]
243    pub deletion: Option<ClusterTopologyControlPlaneDeletion>,
244    /// healthCheck allows to enable, disable and override control plane health check
245    /// configuration from the ClusterClass for this control plane.
246    #[serde(
247        default,
248        skip_serializing_if = "Option::is_none",
249        rename = "healthCheck"
250    )]
251    pub health_check: Option<ClusterTopologyControlPlaneHealthCheck>,
252    /// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
253    /// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
254    /// is applied only to the ControlPlane.
255    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
256    #[serde(default, skip_serializing_if = "Option::is_none")]
257    pub metadata: Option<ClusterTopologyControlPlaneMetadata>,
258    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
259    ///
260    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
261    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
262    ///
263    /// If this field is not defined, readinessGates from the corresponding ControlPlaneClass will be used, if any.
264    ///
265    /// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
266    /// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
267    #[serde(
268        default,
269        skip_serializing_if = "Option::is_none",
270        rename = "readinessGates"
271    )]
272    pub readiness_gates: Option<Vec<ClusterTopologyControlPlaneReadinessGates>>,
273    /// replicas is the number of control plane nodes.
274    /// If the value is not set, the ControlPlane object is created without the number of Replicas
275    /// and it's assumed that the control plane controller does not implement support for this field.
276    /// When specified against a control plane provider that lacks support for this field, this value will be ignored.
277    #[serde(default, skip_serializing_if = "Option::is_none")]
278    pub replicas: Option<i32>,
279    /// rollout allows you to configure the behavior of rolling updates to the control plane.
280    #[serde(default, skip_serializing_if = "Option::is_none")]
281    pub rollout: Option<ClusterTopologyControlPlaneRollout>,
282    /// taints are the node taints that Cluster API will manage.
283    /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
284    /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
285    /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
286    ///
287    /// There can be at most 64 taints.
288    /// A pod would have to tolerate all existing taints to run on the corresponding node.
289    ///
290    /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
291    #[serde(default, skip_serializing_if = "Option::is_none")]
292    pub taints: Option<Vec<ClusterTopologyControlPlaneTaints>>,
293    /// variables can be used to customize the ControlPlane through patches.
294    #[serde(default, skip_serializing_if = "Option::is_none")]
295    pub variables: Option<ClusterTopologyControlPlaneVariables>,
296}
297
298/// deletion contains configuration options for Machine deletion.
299#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
300pub struct ClusterTopologyControlPlaneDeletion {
301    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
302    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
303    /// Defaults to 10 seconds.
304    #[serde(
305        default,
306        skip_serializing_if = "Option::is_none",
307        rename = "nodeDeletionTimeoutSeconds"
308    )]
309    pub node_deletion_timeout_seconds: Option<i32>,
310    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
311    /// The default value is 0, meaning that the node can be drained without any time limitations.
312    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
313    #[serde(
314        default,
315        skip_serializing_if = "Option::is_none",
316        rename = "nodeDrainTimeoutSeconds"
317    )]
318    pub node_drain_timeout_seconds: Option<i32>,
319    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
320    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
321    #[serde(
322        default,
323        skip_serializing_if = "Option::is_none",
324        rename = "nodeVolumeDetachTimeoutSeconds"
325    )]
326    pub node_volume_detach_timeout_seconds: Option<i32>,
327}
328
329/// healthCheck allows to enable, disable and override control plane health check
330/// configuration from the ClusterClass for this control plane.
331#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
332pub struct ClusterTopologyControlPlaneHealthCheck {
333    /// checks are the checks that are used to evaluate if a Machine is healthy.
334    ///
335    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
336    /// and as a consequence the checks and remediation fields from Cluster will be used instead of the
337    /// corresponding fields in ClusterClass.
338    ///
339    /// Independent of this configuration the MachineHealthCheck controller will always
340    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
341    /// Machines with deleted Nodes as unhealthy.
342    ///
343    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
344    /// is defaulted to 10 minutes and evaluated accordingly.
345    #[serde(default, skip_serializing_if = "Option::is_none")]
346    pub checks: Option<ClusterTopologyControlPlaneHealthCheckChecks>,
347    /// enabled controls if a MachineHealthCheck should be created for the target machines.
348    ///
349    /// If false: No MachineHealthCheck will be created.
350    ///
351    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
352    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
353    ///
354    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
355    /// block if `enable` is true and no MachineHealthCheck definition is available.
356    #[serde(default, skip_serializing_if = "Option::is_none")]
357    pub enabled: Option<bool>,
358    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
359    ///
360    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
361    /// and as a consequence the checks and remediation fields from cluster will be used instead of the
362    /// corresponding fields in ClusterClass.
363    ///
364    /// If an health check override is defined and remediation or remediation.triggerIf is not set,
365    /// remediation will always be triggered for unhealthy Machines.
366    ///
367    /// If an health check override is defined and remediation or remediation.templateRef is not set,
368    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
369    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
370    #[serde(default, skip_serializing_if = "Option::is_none")]
371    pub remediation: Option<ClusterTopologyControlPlaneHealthCheckRemediation>,
372}
373
374/// checks are the checks that are used to evaluate if a Machine is healthy.
375///
376/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
377/// and as a consequence the checks and remediation fields from Cluster will be used instead of the
378/// corresponding fields in ClusterClass.
379///
380/// Independent of this configuration the MachineHealthCheck controller will always
381/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
382/// Machines with deleted Nodes as unhealthy.
383///
384/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
385/// is defaulted to 10 minutes and evaluated accordingly.
386#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
387pub struct ClusterTopologyControlPlaneHealthCheckChecks {
388    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
389    /// to consider a Machine unhealthy if a corresponding Node isn't associated
390    /// through a `Spec.ProviderID` field.
391    ///
392    /// The duration set in this field is compared to the greatest of:
393    /// - Cluster's infrastructure ready condition timestamp (if and when available)
394    /// - Control Plane's initialized condition timestamp (if and when available)
395    /// - Machine's infrastructure ready condition timestamp (if and when available)
396    /// - Machine's metadata creation timestamp
397    ///
398    /// Defaults to 10 minutes.
399    /// If you wish to disable this feature, set the value explicitly to 0.
400    #[serde(
401        default,
402        skip_serializing_if = "Option::is_none",
403        rename = "nodeStartupTimeoutSeconds"
404    )]
405    pub node_startup_timeout_seconds: Option<i32>,
406    /// unhealthyMachineConditions contains a list of the machine conditions that determine
407    /// whether a machine is considered unhealthy.  The conditions are combined in a
408    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
409    #[serde(
410        default,
411        skip_serializing_if = "Option::is_none",
412        rename = "unhealthyMachineConditions"
413    )]
414    pub unhealthy_machine_conditions:
415        Option<Vec<ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditions>>,
416    /// unhealthyNodeConditions contains a list of conditions that determine
417    /// whether a node is considered unhealthy. The conditions are combined in a
418    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
419    #[serde(
420        default,
421        skip_serializing_if = "Option::is_none",
422        rename = "unhealthyNodeConditions"
423    )]
424    pub unhealthy_node_conditions:
425        Option<Vec<ClusterTopologyControlPlaneHealthCheckChecksUnhealthyNodeConditions>>,
426}
427
428/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
429/// specified as a duration.  When the named condition has been in the given
430/// status for at least the timeout value, a machine is considered unhealthy.
431#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
432pub struct ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditions {
433    /// status of the condition, one of True, False, Unknown.
434    pub status: ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus,
435    /// timeoutSeconds is the duration that a machine must be in a given status for,
436    /// after which the machine is considered unhealthy.
437    /// For example, with a value of "3600", the machine must match the status
438    /// for at least 1 hour before being considered unhealthy.
439    #[serde(rename = "timeoutSeconds")]
440    pub timeout_seconds: i32,
441    /// type of Machine condition
442    #[serde(rename = "type")]
443    pub r#type: String,
444}
445
446/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
447/// specified as a duration.  When the named condition has been in the given
448/// status for at least the timeout value, a machine is considered unhealthy.
449#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
450pub enum ClusterTopologyControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus {
451    True,
452    False,
453    Unknown,
454}
455
456/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
457/// specified as a duration.  When the named condition has been in the given
458/// status for at least the timeout value, a node is considered unhealthy.
459#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
460pub struct ClusterTopologyControlPlaneHealthCheckChecksUnhealthyNodeConditions {
461    /// status of the condition, one of True, False, Unknown.
462    pub status: String,
463    /// timeoutSeconds is the duration that a node must be in a given status for,
464    /// after which the node is considered unhealthy.
465    /// For example, with a value of "3600", the node must match the status
466    /// for at least 1 hour before being considered unhealthy.
467    #[serde(rename = "timeoutSeconds")]
468    pub timeout_seconds: i32,
469    /// type of Node condition
470    #[serde(rename = "type")]
471    pub r#type: String,
472}
473
474/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
475///
476/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
477/// and as a consequence the checks and remediation fields from cluster will be used instead of the
478/// corresponding fields in ClusterClass.
479///
480/// If an health check override is defined and remediation or remediation.triggerIf is not set,
481/// remediation will always be triggered for unhealthy Machines.
482///
483/// If an health check override is defined and remediation or remediation.templateRef is not set,
484/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
485/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
486#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
487pub struct ClusterTopologyControlPlaneHealthCheckRemediation {
488    /// templateRef is a reference to a remediation template
489    /// provided by an infrastructure provider.
490    ///
491    /// This field is completely optional, when filled, the MachineHealthCheck controller
492    /// creates a new object from the template referenced and hands off remediation of the machine to
493    /// a controller that lives outside of Cluster API.
494    #[serde(
495        default,
496        skip_serializing_if = "Option::is_none",
497        rename = "templateRef"
498    )]
499    pub template_ref: Option<ClusterTopologyControlPlaneHealthCheckRemediationTemplateRef>,
500    /// triggerIf configures if remediations are triggered.
501    /// If this field is not set, remediations are always triggered.
502    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
503    pub trigger_if: Option<ClusterTopologyControlPlaneHealthCheckRemediationTriggerIf>,
504}
505
506/// templateRef is a reference to a remediation template
507/// provided by an infrastructure provider.
508///
509/// This field is completely optional, when filled, the MachineHealthCheck controller
510/// creates a new object from the template referenced and hands off remediation of the machine to
511/// a controller that lives outside of Cluster API.
512#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
513pub struct ClusterTopologyControlPlaneHealthCheckRemediationTemplateRef {
514    /// apiVersion of the remediation template.
515    /// apiVersion must be fully qualified domain name followed by / and a version.
516    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
517    #[serde(rename = "apiVersion")]
518    pub api_version: String,
519    /// kind of the remediation template.
520    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
521    pub kind: String,
522    /// name of the remediation template.
523    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
524    pub name: String,
525}
526
527/// triggerIf configures if remediations are triggered.
528/// If this field is not set, remediations are always triggered.
529#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
530pub struct ClusterTopologyControlPlaneHealthCheckRemediationTriggerIf {
531    /// unhealthyInRange specifies that remediations are only triggered if the number of
532    /// unhealthy Machines is in the configured range.
533    /// Takes precedence over unhealthyLessThanOrEqualTo.
534    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
535    /// (a) there are at least 3 unhealthy Machines (and)
536    /// (b) there are at most 5 unhealthy Machines
537    #[serde(
538        default,
539        skip_serializing_if = "Option::is_none",
540        rename = "unhealthyInRange"
541    )]
542    pub unhealthy_in_range: Option<String>,
543    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
544    /// unhealthy Machines is less than or equal to the configured value.
545    /// unhealthyInRange takes precedence if set.
546    #[serde(
547        default,
548        skip_serializing_if = "Option::is_none",
549        rename = "unhealthyLessThanOrEqualTo"
550    )]
551    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
552}
553
554/// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
555/// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
556/// is applied only to the ControlPlane.
557/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
558#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
559pub struct ClusterTopologyControlPlaneMetadata {
560    /// annotations is an unstructured key value map stored with a resource that may be
561    /// set by external tools to store and retrieve arbitrary metadata. They are not
562    /// queryable and should be preserved when modifying objects.
563    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
564    #[serde(default, skip_serializing_if = "Option::is_none")]
565    pub annotations: Option<BTreeMap<String, String>>,
566    /// labels is a map of string keys and values that can be used to organize and categorize
567    /// (scope and select) objects. May match selectors of replication controllers
568    /// and services.
569    /// More info: <http://kubernetes.io/docs/user-guide/labels>
570    #[serde(default, skip_serializing_if = "Option::is_none")]
571    pub labels: Option<BTreeMap<String, String>>,
572}
573
574/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
575#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
576pub struct ClusterTopologyControlPlaneReadinessGates {
577    /// conditionType refers to a condition with matching type in the Machine's condition list.
578    /// If the conditions doesn't exist, it will be treated as unknown.
579    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
580    #[serde(rename = "conditionType")]
581    pub condition_type: String,
582    /// polarity of the conditionType specified in this readinessGate.
583    /// Valid values are Positive, Negative and omitted.
584    /// When omitted, the default behaviour will be Positive.
585    /// A positive polarity means that the condition should report a true status under normal conditions.
586    /// A negative polarity means that the condition should report a false status under normal conditions.
587    #[serde(default, skip_serializing_if = "Option::is_none")]
588    pub polarity: Option<ClusterTopologyControlPlaneReadinessGatesPolarity>,
589}
590
591/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
592#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
593pub enum ClusterTopologyControlPlaneReadinessGatesPolarity {
594    Positive,
595    Negative,
596}
597
598/// rollout allows you to configure the behavior of rolling updates to the control plane.
599#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
600pub struct ClusterTopologyControlPlaneRollout {
601    /// after is a field to indicate a rollout should be performed
602    /// after the specified time even if no changes have been made to the ControlPlane.
603    /// Example: In the YAML the time can be specified in the RFC3339 format.
604    /// To specify the rolloutAfter target as March 9, 2023, at 9 am UTC
605    /// use "2023-03-09T09:00:00Z".
606    #[serde(default, skip_serializing_if = "Option::is_none")]
607    pub after: Option<String>,
608}
609
610/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
611#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
612pub struct ClusterTopologyControlPlaneTaints {
613    /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
614    pub effect: ClusterTopologyControlPlaneTaintsEffect,
615    /// key is the taint key to be applied to a node.
616    /// Must be a valid qualified name of maximum size 63 characters
617    /// with an optional subdomain prefix of maximum size 253 characters,
618    /// separated by a `/`.
619    pub key: String,
620    /// propagation defines how this taint should be propagated to nodes.
621    /// Valid values are 'Always' and 'OnInitialization'.
622    /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
623    /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
624    pub propagation: ClusterTopologyControlPlaneTaintsPropagation,
625    /// value is the taint value corresponding to the taint key.
626    /// It must be a valid label value of maximum size 63 characters.
627    #[serde(default, skip_serializing_if = "Option::is_none")]
628    pub value: Option<String>,
629}
630
631/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
632#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
633pub enum ClusterTopologyControlPlaneTaintsEffect {
634    NoSchedule,
635    PreferNoSchedule,
636    NoExecute,
637}
638
639/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
640#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
641pub enum ClusterTopologyControlPlaneTaintsPropagation {
642    Always,
643    OnInitialization,
644}
645
646/// variables can be used to customize the ControlPlane through patches.
647#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
648pub struct ClusterTopologyControlPlaneVariables {
649    /// overrides can be used to override Cluster level variables.
650    #[serde(default, skip_serializing_if = "Option::is_none")]
651    pub overrides: Option<Vec<ClusterTopologyControlPlaneVariablesOverrides>>,
652}
653
654/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
655/// Variable definition in the ClusterClass `status` variables.
656#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
657pub struct ClusterTopologyControlPlaneVariablesOverrides {
658    /// name of the variable.
659    pub name: String,
660    /// value of the variable.
661    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
662    /// from the ClusterClass.
663    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
664    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
665    /// i.e. it is not possible to have no type field.
666    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
667    pub value: serde_json::Value,
668}
669
670/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
671/// Variable definition in the ClusterClass `status` variables.
672#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
673pub struct ClusterTopologyVariables {
674    /// name of the variable.
675    pub name: String,
676    /// value of the variable.
677    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
678    /// from the ClusterClass.
679    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
680    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
681    /// i.e. it is not possible to have no type field.
682    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
683    pub value: serde_json::Value,
684}
685
686/// workers encapsulates the different constructs that form the worker nodes
687/// for the cluster.
688#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
689pub struct ClusterTopologyWorkers {
690    /// machineDeployments is a list of machine deployments in the cluster.
691    #[serde(
692        default,
693        skip_serializing_if = "Option::is_none",
694        rename = "machineDeployments"
695    )]
696    pub machine_deployments: Option<Vec<ClusterTopologyWorkersMachineDeployments>>,
697    /// machinePools is a list of machine pools in the cluster.
698    #[serde(
699        default,
700        skip_serializing_if = "Option::is_none",
701        rename = "machinePools"
702    )]
703    pub machine_pools: Option<Vec<ClusterTopologyWorkersMachinePools>>,
704}
705
706/// MachineDeploymentTopology specifies the different parameters for a set of worker nodes in the topology.
707/// This set of nodes is managed by a MachineDeployment object whose lifecycle is managed by the Cluster controller.
708#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
709pub struct ClusterTopologyWorkersMachineDeployments {
710    /// class is the name of the MachineDeploymentClass used to create the set of worker nodes.
711    /// This should match one of the deployment classes defined in the ClusterClass object
712    /// mentioned in the `Cluster.Spec.Class` field.
713    pub class: String,
714    /// deletion contains configuration options for Machine deletion.
715    #[serde(default, skip_serializing_if = "Option::is_none")]
716    pub deletion: Option<ClusterTopologyWorkersMachineDeploymentsDeletion>,
717    /// failureDomain is the failure domain the machines will be created in.
718    /// Must match a key in the FailureDomains map stored on the cluster object.
719    #[serde(
720        default,
721        skip_serializing_if = "Option::is_none",
722        rename = "failureDomain"
723    )]
724    pub failure_domain: Option<String>,
725    /// healthCheck allows to enable, disable and override MachineDeployment health check
726    /// configuration from the ClusterClass for this MachineDeployment.
727    #[serde(
728        default,
729        skip_serializing_if = "Option::is_none",
730        rename = "healthCheck"
731    )]
732    pub health_check: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheck>,
733    /// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
734    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
735    #[serde(default, skip_serializing_if = "Option::is_none")]
736    pub metadata: Option<ClusterTopologyWorkersMachineDeploymentsMetadata>,
737    /// minReadySeconds is the minimum number of seconds for which a newly created machine should
738    /// be ready.
739    /// Defaults to 0 (machine will be considered available as soon as it
740    /// is ready)
741    #[serde(
742        default,
743        skip_serializing_if = "Option::is_none",
744        rename = "minReadySeconds"
745    )]
746    pub min_ready_seconds: Option<i32>,
747    /// name is the unique identifier for this MachineDeploymentTopology.
748    /// The value is used with other unique identifiers to create a MachineDeployment's Name
749    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
750    /// the values are hashed together.
751    pub name: String,
752    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
753    ///
754    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
755    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
756    ///
757    /// If this field is not defined, readinessGates from the corresponding MachineDeploymentClass will be used, if any.
758    #[serde(
759        default,
760        skip_serializing_if = "Option::is_none",
761        rename = "readinessGates"
762    )]
763    pub readiness_gates: Option<Vec<ClusterTopologyWorkersMachineDeploymentsReadinessGates>>,
764    /// replicas is the number of worker nodes belonging to this set.
765    /// If the value is nil, the MachineDeployment is created without the number of Replicas (defaulting to 1)
766    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
767    /// of this value.
768    #[serde(default, skip_serializing_if = "Option::is_none")]
769    pub replicas: Option<i32>,
770    /// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
771    /// It allows you to define the strategy used during rolling replacements.
772    #[serde(default, skip_serializing_if = "Option::is_none")]
773    pub rollout: Option<ClusterTopologyWorkersMachineDeploymentsRollout>,
774    /// taints are the node taints that Cluster API will manage.
775    /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
776    /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
777    /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
778    ///
779    /// There can be at most 64 taints.
780    /// A pod would have to tolerate all existing taints to run on the corresponding node.
781    ///
782    /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
783    #[serde(default, skip_serializing_if = "Option::is_none")]
784    pub taints: Option<Vec<ClusterTopologyWorkersMachineDeploymentsTaints>>,
785    /// variables can be used to customize the MachineDeployment through patches.
786    #[serde(default, skip_serializing_if = "Option::is_none")]
787    pub variables: Option<ClusterTopologyWorkersMachineDeploymentsVariables>,
788}
789
790/// deletion contains configuration options for Machine deletion.
791#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
792pub struct ClusterTopologyWorkersMachineDeploymentsDeletion {
793    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
794    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
795    /// Defaults to 10 seconds.
796    #[serde(
797        default,
798        skip_serializing_if = "Option::is_none",
799        rename = "nodeDeletionTimeoutSeconds"
800    )]
801    pub node_deletion_timeout_seconds: Option<i32>,
802    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
803    /// The default value is 0, meaning that the node can be drained without any time limitations.
804    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
805    #[serde(
806        default,
807        skip_serializing_if = "Option::is_none",
808        rename = "nodeDrainTimeoutSeconds"
809    )]
810    pub node_drain_timeout_seconds: Option<i32>,
811    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
812    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
813    #[serde(
814        default,
815        skip_serializing_if = "Option::is_none",
816        rename = "nodeVolumeDetachTimeoutSeconds"
817    )]
818    pub node_volume_detach_timeout_seconds: Option<i32>,
819    /// order defines the order in which Machines are deleted when downscaling.
820    /// Defaults to "Random".  Valid values are "Random, "Newest", "Oldest"
821    #[serde(default, skip_serializing_if = "Option::is_none")]
822    pub order: Option<ClusterTopologyWorkersMachineDeploymentsDeletionOrder>,
823}
824
825/// deletion contains configuration options for Machine deletion.
826#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
827pub enum ClusterTopologyWorkersMachineDeploymentsDeletionOrder {
828    Random,
829    Newest,
830    Oldest,
831}
832
833/// healthCheck allows to enable, disable and override MachineDeployment health check
834/// configuration from the ClusterClass for this MachineDeployment.
835#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
836pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheck {
837    /// checks are the checks that are used to evaluate if a Machine is healthy.
838    ///
839    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
840    /// and as a consequence the checks and remediation fields from Cluster will be used instead of the
841    /// corresponding fields in ClusterClass.
842    ///
843    /// Independent of this configuration the MachineHealthCheck controller will always
844    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
845    /// Machines with deleted Nodes as unhealthy.
846    ///
847    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
848    /// is defaulted to 10 minutes and evaluated accordingly.
849    #[serde(default, skip_serializing_if = "Option::is_none")]
850    pub checks: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecks>,
851    /// enabled controls if a MachineHealthCheck should be created for the target machines.
852    ///
853    /// If false: No MachineHealthCheck will be created.
854    ///
855    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
856    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
857    ///
858    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
859    /// block if `enable` is true and no MachineHealthCheck definition is available.
860    #[serde(default, skip_serializing_if = "Option::is_none")]
861    pub enabled: Option<bool>,
862    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
863    ///
864    /// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
865    /// and as a consequence the checks and remediation fields from cluster will be used instead of the
866    /// corresponding fields in ClusterClass.
867    ///
868    /// If an health check override is defined and remediation or remediation.triggerIf is not set,
869    /// remediation will always be triggered for unhealthy Machines.
870    ///
871    /// If an health check override is defined and remediation or remediation.templateRef is not set,
872    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
873    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
874    #[serde(default, skip_serializing_if = "Option::is_none")]
875    pub remediation: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediation>,
876}
877
878/// checks are the checks that are used to evaluate if a Machine is healthy.
879///
880/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
881/// and as a consequence the checks and remediation fields from Cluster will be used instead of the
882/// corresponding fields in ClusterClass.
883///
884/// Independent of this configuration the MachineHealthCheck controller will always
885/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
886/// Machines with deleted Nodes as unhealthy.
887///
888/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
889/// is defaulted to 10 minutes and evaluated accordingly.
890#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
891pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecks {
892    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
893    /// to consider a Machine unhealthy if a corresponding Node isn't associated
894    /// through a `Spec.ProviderID` field.
895    ///
896    /// The duration set in this field is compared to the greatest of:
897    /// - Cluster's infrastructure ready condition timestamp (if and when available)
898    /// - Control Plane's initialized condition timestamp (if and when available)
899    /// - Machine's infrastructure ready condition timestamp (if and when available)
900    /// - Machine's metadata creation timestamp
901    ///
902    /// Defaults to 10 minutes.
903    /// If you wish to disable this feature, set the value explicitly to 0.
904    #[serde(
905        default,
906        skip_serializing_if = "Option::is_none",
907        rename = "nodeStartupTimeoutSeconds"
908    )]
909    pub node_startup_timeout_seconds: Option<i32>,
910    /// unhealthyMachineConditions contains a list of the machine conditions that determine
911    /// whether a machine is considered unhealthy.  The conditions are combined in a
912    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
913    #[serde(
914        default,
915        skip_serializing_if = "Option::is_none",
916        rename = "unhealthyMachineConditions"
917    )]
918    pub unhealthy_machine_conditions: Option<
919        Vec<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions>,
920    >,
921    /// unhealthyNodeConditions contains a list of conditions that determine
922    /// whether a node is considered unhealthy. The conditions are combined in a
923    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
924    #[serde(
925        default,
926        skip_serializing_if = "Option::is_none",
927        rename = "unhealthyNodeConditions"
928    )]
929    pub unhealthy_node_conditions: Option<
930        Vec<ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions>,
931    >,
932}
933
934/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
935/// specified as a duration.  When the named condition has been in the given
936/// status for at least the timeout value, a machine is considered unhealthy.
937#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
938pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions {
939    /// status of the condition, one of True, False, Unknown.
940    pub status:
941        ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus,
942    /// timeoutSeconds is the duration that a machine must be in a given status for,
943    /// after which the machine is considered unhealthy.
944    /// For example, with a value of "3600", the machine must match the status
945    /// for at least 1 hour before being considered unhealthy.
946    #[serde(rename = "timeoutSeconds")]
947    pub timeout_seconds: i32,
948    /// type of Machine condition
949    #[serde(rename = "type")]
950    pub r#type: String,
951}
952
953/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
954/// specified as a duration.  When the named condition has been in the given
955/// status for at least the timeout value, a machine is considered unhealthy.
956#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
957pub enum ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus {
958    True,
959    False,
960    Unknown,
961}
962
963/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
964/// specified as a duration.  When the named condition has been in the given
965/// status for at least the timeout value, a node is considered unhealthy.
966#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
967pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions {
968    /// status of the condition, one of True, False, Unknown.
969    pub status: String,
970    /// timeoutSeconds is the duration that a node must be in a given status for,
971    /// after which the node is considered unhealthy.
972    /// For example, with a value of "3600", the node must match the status
973    /// for at least 1 hour before being considered unhealthy.
974    #[serde(rename = "timeoutSeconds")]
975    pub timeout_seconds: i32,
976    /// type of Node condition
977    #[serde(rename = "type")]
978    pub r#type: String,
979}
980
981/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
982///
983/// If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined,
984/// and as a consequence the checks and remediation fields from cluster will be used instead of the
985/// corresponding fields in ClusterClass.
986///
987/// If an health check override is defined and remediation or remediation.triggerIf is not set,
988/// remediation will always be triggered for unhealthy Machines.
989///
990/// If an health check override is defined and remediation or remediation.templateRef is not set,
991/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
992/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
993#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
994pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediation {
995    /// maxInFlight determines how many in flight remediations should happen at the same time.
996    ///
997    /// Remediation only happens on the MachineSet with the most current revision, while
998    /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
999    ///
1000    /// Note: In general (independent of remediations), unhealthy machines are always
1001    /// prioritized during scale down operations over healthy ones.
1002    ///
1003    /// MaxInFlight can be set to a fixed number or a percentage.
1004    /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
1005    /// the desired replicas.
1006    ///
1007    /// If not set, remediation is limited to all machines (bounded by replicas)
1008    /// under the active MachineSet's management.
1009    #[serde(
1010        default,
1011        skip_serializing_if = "Option::is_none",
1012        rename = "maxInFlight"
1013    )]
1014    pub max_in_flight: Option<IntOrString>,
1015    /// templateRef is a reference to a remediation template
1016    /// provided by an infrastructure provider.
1017    ///
1018    /// This field is completely optional, when filled, the MachineHealthCheck controller
1019    /// creates a new object from the template referenced and hands off remediation of the machine to
1020    /// a controller that lives outside of Cluster API.
1021    #[serde(
1022        default,
1023        skip_serializing_if = "Option::is_none",
1024        rename = "templateRef"
1025    )]
1026    pub template_ref:
1027        Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTemplateRef>,
1028    /// triggerIf configures if remediations are triggered.
1029    /// If this field is not set, remediations are always triggered.
1030    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
1031    pub trigger_if: Option<ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTriggerIf>,
1032}
1033
1034/// templateRef is a reference to a remediation template
1035/// provided by an infrastructure provider.
1036///
1037/// This field is completely optional, when filled, the MachineHealthCheck controller
1038/// creates a new object from the template referenced and hands off remediation of the machine to
1039/// a controller that lives outside of Cluster API.
1040#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1041pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTemplateRef {
1042    /// apiVersion of the remediation template.
1043    /// apiVersion must be fully qualified domain name followed by / and a version.
1044    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
1045    #[serde(rename = "apiVersion")]
1046    pub api_version: String,
1047    /// kind of the remediation template.
1048    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1049    pub kind: String,
1050    /// name of the remediation template.
1051    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1052    pub name: String,
1053}
1054
1055/// triggerIf configures if remediations are triggered.
1056/// If this field is not set, remediations are always triggered.
1057#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1058pub struct ClusterTopologyWorkersMachineDeploymentsHealthCheckRemediationTriggerIf {
1059    /// unhealthyInRange specifies that remediations are only triggered if the number of
1060    /// unhealthy Machines is in the configured range.
1061    /// Takes precedence over unhealthyLessThanOrEqualTo.
1062    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
1063    /// (a) there are at least 3 unhealthy Machines (and)
1064    /// (b) there are at most 5 unhealthy Machines
1065    #[serde(
1066        default,
1067        skip_serializing_if = "Option::is_none",
1068        rename = "unhealthyInRange"
1069    )]
1070    pub unhealthy_in_range: Option<String>,
1071    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
1072    /// unhealthy Machines is less than or equal to the configured value.
1073    /// unhealthyInRange takes precedence if set.
1074    #[serde(
1075        default,
1076        skip_serializing_if = "Option::is_none",
1077        rename = "unhealthyLessThanOrEqualTo"
1078    )]
1079    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
1080}
1081
1082/// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
1083/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
1084#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1085pub struct ClusterTopologyWorkersMachineDeploymentsMetadata {
1086    /// annotations is an unstructured key value map stored with a resource that may be
1087    /// set by external tools to store and retrieve arbitrary metadata. They are not
1088    /// queryable and should be preserved when modifying objects.
1089    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
1090    #[serde(default, skip_serializing_if = "Option::is_none")]
1091    pub annotations: Option<BTreeMap<String, String>>,
1092    /// labels is a map of string keys and values that can be used to organize and categorize
1093    /// (scope and select) objects. May match selectors of replication controllers
1094    /// and services.
1095    /// More info: <http://kubernetes.io/docs/user-guide/labels>
1096    #[serde(default, skip_serializing_if = "Option::is_none")]
1097    pub labels: Option<BTreeMap<String, String>>,
1098}
1099
1100/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
1101#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1102pub struct ClusterTopologyWorkersMachineDeploymentsReadinessGates {
1103    /// conditionType refers to a condition with matching type in the Machine's condition list.
1104    /// If the conditions doesn't exist, it will be treated as unknown.
1105    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
1106    #[serde(rename = "conditionType")]
1107    pub condition_type: String,
1108    /// polarity of the conditionType specified in this readinessGate.
1109    /// Valid values are Positive, Negative and omitted.
1110    /// When omitted, the default behaviour will be Positive.
1111    /// A positive polarity means that the condition should report a true status under normal conditions.
1112    /// A negative polarity means that the condition should report a false status under normal conditions.
1113    #[serde(default, skip_serializing_if = "Option::is_none")]
1114    pub polarity: Option<ClusterTopologyWorkersMachineDeploymentsReadinessGatesPolarity>,
1115}
1116
1117/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
1118#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1119pub enum ClusterTopologyWorkersMachineDeploymentsReadinessGatesPolarity {
1120    Positive,
1121    Negative,
1122}
1123
1124/// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
1125/// It allows you to define the strategy used during rolling replacements.
1126#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1127pub struct ClusterTopologyWorkersMachineDeploymentsRollout {
1128    /// after is a field to indicate a rollout should be performed
1129    /// after the specified time even if no changes have been made to the
1130    /// MachineDeployment.
1131    /// Example: In the YAML the time can be specified in the RFC3339 format.
1132    /// To specify the rolloutAfter target as March 9, 2023, at 9 am UTC
1133    /// use "2023-03-09T09:00:00Z".
1134    #[serde(default, skip_serializing_if = "Option::is_none")]
1135    pub after: Option<String>,
1136    /// strategy specifies how to roll out control plane Machines.
1137    #[serde(default, skip_serializing_if = "Option::is_none")]
1138    pub strategy: Option<ClusterTopologyWorkersMachineDeploymentsRolloutStrategy>,
1139}
1140
1141/// strategy specifies how to roll out control plane Machines.
1142#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1143pub struct ClusterTopologyWorkersMachineDeploymentsRolloutStrategy {
1144    /// rollingUpdate is the rolling update config params. Present only if
1145    /// type = RollingUpdate.
1146    #[serde(
1147        default,
1148        skip_serializing_if = "Option::is_none",
1149        rename = "rollingUpdate"
1150    )]
1151    pub rolling_update:
1152        Option<ClusterTopologyWorkersMachineDeploymentsRolloutStrategyRollingUpdate>,
1153    /// type of rollout. Allowed values are RollingUpdate and OnDelete.
1154    /// Default is RollingUpdate.
1155    #[serde(rename = "type")]
1156    pub r#type: ClusterTopologyWorkersMachineDeploymentsRolloutStrategyType,
1157}
1158
1159/// rollingUpdate is the rolling update config params. Present only if
1160/// type = RollingUpdate.
1161#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1162pub struct ClusterTopologyWorkersMachineDeploymentsRolloutStrategyRollingUpdate {
1163    /// maxSurge is the maximum number of machines that can be scheduled above the
1164    /// desired number of machines.
1165    /// Value can be an absolute number (ex: 5) or a percentage of
1166    /// desired machines (ex: 10%).
1167    /// This can not be 0 if MaxUnavailable is 0.
1168    /// Absolute number is calculated from percentage by rounding up.
1169    /// Defaults to 1.
1170    /// Example: when this is set to 30%, the new MachineSet can be scaled
1171    /// up immediately when the rolling update starts, such that the total
1172    /// number of old and new machines do not exceed 130% of desired
1173    /// machines. Once old machines have been killed, new MachineSet can
1174    /// be scaled up further, ensuring that total number of machines running
1175    /// at any time during the update is at most 130% of desired machines.
1176    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
1177    pub max_surge: Option<IntOrString>,
1178    /// maxUnavailable is the maximum number of machines that can be unavailable during the update.
1179    /// Value can be an absolute number (ex: 5) or a percentage of desired
1180    /// machines (ex: 10%).
1181    /// Absolute number is calculated from percentage by rounding down.
1182    /// This can not be 0 if MaxSurge is 0.
1183    /// Defaults to 0.
1184    /// Example: when this is set to 30%, the old MachineSet can be scaled
1185    /// down to 70% of desired machines immediately when the rolling update
1186    /// starts. Once new machines are ready, old MachineSet can be scaled
1187    /// down further, followed by scaling up the new MachineSet, ensuring
1188    /// that the total number of machines available at all times
1189    /// during the update is at least 70% of desired machines.
1190    #[serde(
1191        default,
1192        skip_serializing_if = "Option::is_none",
1193        rename = "maxUnavailable"
1194    )]
1195    pub max_unavailable: Option<IntOrString>,
1196}
1197
1198/// strategy specifies how to roll out control plane Machines.
1199#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1200pub enum ClusterTopologyWorkersMachineDeploymentsRolloutStrategyType {
1201    RollingUpdate,
1202    OnDelete,
1203}
1204
1205/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1206#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1207pub struct ClusterTopologyWorkersMachineDeploymentsTaints {
1208    /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
1209    pub effect: ClusterTopologyWorkersMachineDeploymentsTaintsEffect,
1210    /// key is the taint key to be applied to a node.
1211    /// Must be a valid qualified name of maximum size 63 characters
1212    /// with an optional subdomain prefix of maximum size 253 characters,
1213    /// separated by a `/`.
1214    pub key: String,
1215    /// propagation defines how this taint should be propagated to nodes.
1216    /// Valid values are 'Always' and 'OnInitialization'.
1217    /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
1218    /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
1219    pub propagation: ClusterTopologyWorkersMachineDeploymentsTaintsPropagation,
1220    /// value is the taint value corresponding to the taint key.
1221    /// It must be a valid label value of maximum size 63 characters.
1222    #[serde(default, skip_serializing_if = "Option::is_none")]
1223    pub value: Option<String>,
1224}
1225
1226/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1227#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1228pub enum ClusterTopologyWorkersMachineDeploymentsTaintsEffect {
1229    NoSchedule,
1230    PreferNoSchedule,
1231    NoExecute,
1232}
1233
1234/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1235#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1236pub enum ClusterTopologyWorkersMachineDeploymentsTaintsPropagation {
1237    Always,
1238    OnInitialization,
1239}
1240
1241/// variables can be used to customize the MachineDeployment through patches.
1242#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1243pub struct ClusterTopologyWorkersMachineDeploymentsVariables {
1244    /// overrides can be used to override Cluster level variables.
1245    #[serde(default, skip_serializing_if = "Option::is_none")]
1246    pub overrides: Option<Vec<ClusterTopologyWorkersMachineDeploymentsVariablesOverrides>>,
1247}
1248
1249/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
1250/// Variable definition in the ClusterClass `status` variables.
1251#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1252pub struct ClusterTopologyWorkersMachineDeploymentsVariablesOverrides {
1253    /// name of the variable.
1254    pub name: String,
1255    /// value of the variable.
1256    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
1257    /// from the ClusterClass.
1258    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
1259    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
1260    /// i.e. it is not possible to have no type field.
1261    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
1262    pub value: serde_json::Value,
1263}
1264
1265/// MachinePoolTopology specifies the different parameters for a pool of worker nodes in the topology.
1266/// This pool of nodes is managed by a MachinePool object whose lifecycle is managed by the Cluster controller.
1267#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1268pub struct ClusterTopologyWorkersMachinePools {
1269    /// class is the name of the MachinePoolClass used to create the pool of worker nodes.
1270    /// This should match one of the deployment classes defined in the ClusterClass object
1271    /// mentioned in the `Cluster.Spec.Class` field.
1272    pub class: String,
1273    /// deletion contains configuration options for Machine deletion.
1274    #[serde(default, skip_serializing_if = "Option::is_none")]
1275    pub deletion: Option<ClusterTopologyWorkersMachinePoolsDeletion>,
1276    /// failureDomains is the list of failure domains the machine pool will be created in.
1277    /// Must match a key in the FailureDomains map stored on the cluster object.
1278    #[serde(
1279        default,
1280        skip_serializing_if = "Option::is_none",
1281        rename = "failureDomains"
1282    )]
1283    pub failure_domains: Option<Vec<String>>,
1284    /// metadata is the metadata applied to the MachinePool.
1285    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
1286    #[serde(default, skip_serializing_if = "Option::is_none")]
1287    pub metadata: Option<ClusterTopologyWorkersMachinePoolsMetadata>,
1288    /// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
1289    /// be ready.
1290    /// Defaults to 0 (machine will be considered available as soon as it
1291    /// is ready)
1292    #[serde(
1293        default,
1294        skip_serializing_if = "Option::is_none",
1295        rename = "minReadySeconds"
1296    )]
1297    pub min_ready_seconds: Option<i32>,
1298    /// name is the unique identifier for this MachinePoolTopology.
1299    /// The value is used with other unique identifiers to create a MachinePool's Name
1300    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
1301    /// the values are hashed together.
1302    pub name: String,
1303    /// replicas is the number of nodes belonging to this pool.
1304    /// If the value is nil, the MachinePool is created without the number of Replicas (defaulting to 1)
1305    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
1306    /// of this value.
1307    #[serde(default, skip_serializing_if = "Option::is_none")]
1308    pub replicas: Option<i32>,
1309    /// taints are the node taints that Cluster API will manage.
1310    /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
1311    /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
1312    /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
1313    ///
1314    /// There can be at most 64 taints.
1315    /// A pod would have to tolerate all existing taints to run on the corresponding node.
1316    ///
1317    /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
1318    #[serde(default, skip_serializing_if = "Option::is_none")]
1319    pub taints: Option<Vec<ClusterTopologyWorkersMachinePoolsTaints>>,
1320    /// variables can be used to customize the MachinePool through patches.
1321    #[serde(default, skip_serializing_if = "Option::is_none")]
1322    pub variables: Option<ClusterTopologyWorkersMachinePoolsVariables>,
1323}
1324
1325/// deletion contains configuration options for Machine deletion.
1326#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1327pub struct ClusterTopologyWorkersMachinePoolsDeletion {
1328    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the MachinePool
1329    /// hosts after the MachinePool is marked for deletion. A duration of 0 will retry deletion indefinitely.
1330    /// Defaults to 10 seconds.
1331    #[serde(
1332        default,
1333        skip_serializing_if = "Option::is_none",
1334        rename = "nodeDeletionTimeoutSeconds"
1335    )]
1336    pub node_deletion_timeout_seconds: Option<i32>,
1337    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
1338    /// The default value is 0, meaning that the node can be drained without any time limitations.
1339    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
1340    #[serde(
1341        default,
1342        skip_serializing_if = "Option::is_none",
1343        rename = "nodeDrainTimeoutSeconds"
1344    )]
1345    pub node_drain_timeout_seconds: Option<i32>,
1346    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
1347    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
1348    #[serde(
1349        default,
1350        skip_serializing_if = "Option::is_none",
1351        rename = "nodeVolumeDetachTimeoutSeconds"
1352    )]
1353    pub node_volume_detach_timeout_seconds: Option<i32>,
1354}
1355
1356/// metadata is the metadata applied to the MachinePool.
1357/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
1358#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1359pub struct ClusterTopologyWorkersMachinePoolsMetadata {
1360    /// annotations is an unstructured key value map stored with a resource that may be
1361    /// set by external tools to store and retrieve arbitrary metadata. They are not
1362    /// queryable and should be preserved when modifying objects.
1363    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
1364    #[serde(default, skip_serializing_if = "Option::is_none")]
1365    pub annotations: Option<BTreeMap<String, String>>,
1366    /// labels is a map of string keys and values that can be used to organize and categorize
1367    /// (scope and select) objects. May match selectors of replication controllers
1368    /// and services.
1369    /// More info: <http://kubernetes.io/docs/user-guide/labels>
1370    #[serde(default, skip_serializing_if = "Option::is_none")]
1371    pub labels: Option<BTreeMap<String, String>>,
1372}
1373
1374/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1375#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1376pub struct ClusterTopologyWorkersMachinePoolsTaints {
1377    /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
1378    pub effect: ClusterTopologyWorkersMachinePoolsTaintsEffect,
1379    /// key is the taint key to be applied to a node.
1380    /// Must be a valid qualified name of maximum size 63 characters
1381    /// with an optional subdomain prefix of maximum size 253 characters,
1382    /// separated by a `/`.
1383    pub key: String,
1384    /// propagation defines how this taint should be propagated to nodes.
1385    /// Valid values are 'Always' and 'OnInitialization'.
1386    /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
1387    /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
1388    pub propagation: ClusterTopologyWorkersMachinePoolsTaintsPropagation,
1389    /// value is the taint value corresponding to the taint key.
1390    /// It must be a valid label value of maximum size 63 characters.
1391    #[serde(default, skip_serializing_if = "Option::is_none")]
1392    pub value: Option<String>,
1393}
1394
1395/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1396#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1397pub enum ClusterTopologyWorkersMachinePoolsTaintsEffect {
1398    NoSchedule,
1399    PreferNoSchedule,
1400    NoExecute,
1401}
1402
1403/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1404#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1405pub enum ClusterTopologyWorkersMachinePoolsTaintsPropagation {
1406    Always,
1407    OnInitialization,
1408}
1409
1410/// variables can be used to customize the MachinePool through patches.
1411#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1412pub struct ClusterTopologyWorkersMachinePoolsVariables {
1413    /// overrides can be used to override Cluster level variables.
1414    #[serde(default, skip_serializing_if = "Option::is_none")]
1415    pub overrides: Option<Vec<ClusterTopologyWorkersMachinePoolsVariablesOverrides>>,
1416}
1417
1418/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
1419/// Variable definition in the ClusterClass `status` variables.
1420#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1421pub struct ClusterTopologyWorkersMachinePoolsVariablesOverrides {
1422    /// name of the variable.
1423    pub name: String,
1424    /// value of the variable.
1425    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
1426    /// from the ClusterClass.
1427    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
1428    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
1429    /// i.e. it is not possible to have no type field.
1430    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
1431    pub value: serde_json::Value,
1432}
1433
1434/// status is the observed state of Cluster.
1435#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1436pub struct ClusterStatus {
1437    /// conditions represents the observations of a Cluster's current state.
1438    /// Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady
1439    /// MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused.
1440    /// Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology.
1441    #[serde(default, skip_serializing_if = "Option::is_none")]
1442    pub conditions: Option<Vec<Condition>>,
1443    /// controlPlane groups all the observations about Cluster's ControlPlane current state.
1444    #[serde(
1445        default,
1446        skip_serializing_if = "Option::is_none",
1447        rename = "controlPlane"
1448    )]
1449    pub control_plane: Option<ClusterStatusControlPlane>,
1450    /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
1451    #[serde(default, skip_serializing_if = "Option::is_none")]
1452    pub deprecated: Option<ClusterStatusDeprecated>,
1453    /// failureDomains is a slice of failure domain objects synced from the infrastructure provider.
1454    #[serde(
1455        default,
1456        skip_serializing_if = "Option::is_none",
1457        rename = "failureDomains"
1458    )]
1459    pub failure_domains: Option<Vec<ClusterStatusFailureDomains>>,
1460    /// initialization provides observations of the Cluster initialization process.
1461    /// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning.
1462    #[serde(default, skip_serializing_if = "Option::is_none")]
1463    pub initialization: Option<ClusterStatusInitialization>,
1464    /// observedGeneration is the latest generation observed by the controller.
1465    #[serde(
1466        default,
1467        skip_serializing_if = "Option::is_none",
1468        rename = "observedGeneration"
1469    )]
1470    pub observed_generation: Option<i64>,
1471    /// phase represents the current phase of cluster actuation.
1472    #[serde(default, skip_serializing_if = "Option::is_none")]
1473    pub phase: Option<ClusterStatusPhase>,
1474    /// workers groups all the observations about Cluster's Workers current state.
1475    #[serde(default, skip_serializing_if = "Option::is_none")]
1476    pub workers: Option<ClusterStatusWorkers>,
1477}
1478
1479/// controlPlane groups all the observations about Cluster's ControlPlane current state.
1480#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1481pub struct ClusterStatusControlPlane {
1482    /// availableReplicas is the total number of available control plane machines in this cluster. A machine is considered available when Machine's Available condition is true.
1483    #[serde(
1484        default,
1485        skip_serializing_if = "Option::is_none",
1486        rename = "availableReplicas"
1487    )]
1488    pub available_replicas: Option<i32>,
1489    /// desiredReplicas is the total number of desired control plane machines in this cluster.
1490    #[serde(
1491        default,
1492        skip_serializing_if = "Option::is_none",
1493        rename = "desiredReplicas"
1494    )]
1495    pub desired_replicas: Option<i32>,
1496    /// readyReplicas is the total number of ready control plane machines in this cluster. A machine is considered ready when Machine's Ready condition is true.
1497    #[serde(
1498        default,
1499        skip_serializing_if = "Option::is_none",
1500        rename = "readyReplicas"
1501    )]
1502    pub ready_replicas: Option<i32>,
1503    /// replicas is the total number of control plane machines in this cluster.
1504    /// NOTE: replicas also includes machines still being provisioned or being deleted.
1505    #[serde(default, skip_serializing_if = "Option::is_none")]
1506    pub replicas: Option<i32>,
1507    /// upToDateReplicas is the number of up-to-date control plane machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.
1508    #[serde(
1509        default,
1510        skip_serializing_if = "Option::is_none",
1511        rename = "upToDateReplicas"
1512    )]
1513    pub up_to_date_replicas: Option<i32>,
1514}
1515
1516/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
1517#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1518pub struct ClusterStatusDeprecated {
1519    /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
1520    #[serde(default, skip_serializing_if = "Option::is_none")]
1521    pub v1beta1: Option<ClusterStatusDeprecatedV1beta1>,
1522}
1523
1524/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
1525#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1526pub struct ClusterStatusDeprecatedV1beta1 {
1527    /// conditions defines current service state of the cluster.
1528    ///
1529    /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
1530    #[serde(default, skip_serializing_if = "Option::is_none")]
1531    pub conditions: Option<Vec<Condition>>,
1532    /// failureMessage indicates that there is a fatal problem reconciling the
1533    /// state, and will be set to a descriptive error message.
1534    ///
1535    /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
1536    #[serde(
1537        default,
1538        skip_serializing_if = "Option::is_none",
1539        rename = "failureMessage"
1540    )]
1541    pub failure_message: Option<String>,
1542    /// failureReason indicates that there is a fatal problem reconciling the
1543    /// state, and will be set to a token value suitable for
1544    /// programmatic interpretation.
1545    ///
1546    /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
1547    #[serde(
1548        default,
1549        skip_serializing_if = "Option::is_none",
1550        rename = "failureReason"
1551    )]
1552    pub failure_reason: Option<String>,
1553}
1554
1555/// FailureDomain is the Schema for Cluster API failure domains.
1556/// It allows controllers to understand how many failure domains a cluster can optionally span across.
1557#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1558pub struct ClusterStatusFailureDomains {
1559    /// attributes is a free form map of attributes an infrastructure provider might use or require.
1560    #[serde(default, skip_serializing_if = "Option::is_none")]
1561    pub attributes: Option<BTreeMap<String, String>>,
1562    /// controlPlane determines if this failure domain is suitable for use by control plane machines.
1563    #[serde(
1564        default,
1565        skip_serializing_if = "Option::is_none",
1566        rename = "controlPlane"
1567    )]
1568    pub control_plane: Option<bool>,
1569    /// name is the name of the failure domain.
1570    pub name: String,
1571}
1572
1573/// initialization provides observations of the Cluster initialization process.
1574/// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning.
1575#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1576pub struct ClusterStatusInitialization {
1577    /// controlPlaneInitialized denotes when the control plane is functional enough to accept requests.
1578    /// This information is usually used as a signal for starting all the provisioning operations that depends on
1579    /// a functional API server, but do not require a full HA control plane to exists, like e.g. join worker Machines,
1580    /// install core addons like CNI, CPI, CSI etc.
1581    /// NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning.
1582    /// The value of this field is never updated after initialization is completed.
1583    #[serde(
1584        default,
1585        skip_serializing_if = "Option::is_none",
1586        rename = "controlPlaneInitialized"
1587    )]
1588    pub control_plane_initialized: Option<bool>,
1589    /// infrastructureProvisioned is true when the infrastructure provider reports that Cluster's infrastructure is fully provisioned.
1590    /// NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning.
1591    /// The value of this field is never updated after provisioning is completed.
1592    #[serde(
1593        default,
1594        skip_serializing_if = "Option::is_none",
1595        rename = "infrastructureProvisioned"
1596    )]
1597    pub infrastructure_provisioned: Option<bool>,
1598}
1599
1600/// status is the observed state of Cluster.
1601#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1602pub enum ClusterStatusPhase {
1603    Pending,
1604    Provisioning,
1605    Provisioned,
1606    Deleting,
1607    Failed,
1608    Unknown,
1609}
1610
1611/// workers groups all the observations about Cluster's Workers current state.
1612#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1613pub struct ClusterStatusWorkers {
1614    /// availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true.
1615    #[serde(
1616        default,
1617        skip_serializing_if = "Option::is_none",
1618        rename = "availableReplicas"
1619    )]
1620    pub available_replicas: Option<i32>,
1621    /// desiredReplicas is the total number of desired worker machines in this cluster.
1622    #[serde(
1623        default,
1624        skip_serializing_if = "Option::is_none",
1625        rename = "desiredReplicas"
1626    )]
1627    pub desired_replicas: Option<i32>,
1628    /// readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true.
1629    #[serde(
1630        default,
1631        skip_serializing_if = "Option::is_none",
1632        rename = "readyReplicas"
1633    )]
1634    pub ready_replicas: Option<i32>,
1635    /// replicas is the total number of worker machines in this cluster.
1636    /// NOTE: replicas also includes machines still being provisioned or being deleted.
1637    #[serde(default, skip_serializing_if = "Option::is_none")]
1638    pub replicas: Option<i32>,
1639    /// upToDateReplicas is the number of up-to-date worker machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.
1640    #[serde(
1641        default,
1642        skip_serializing_if = "Option::is_none",
1643        rename = "upToDateReplicas"
1644    )]
1645    pub up_to_date_replicas: Option<i32>,
1646}