cluster_api_rs/api/
capi_cluster.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium -D Default -D PartialEq -A -d -f -
3// kopium version: 0.21.2
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use k8s_openapi::api::core::v1::ObjectReference;
8    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
9    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
10    pub use kube::CustomResource;
11    pub use schemars::JsonSchema;
12    pub use serde::{Deserialize, Serialize};
13    pub use std::collections::BTreeMap;
14}
15use self::prelude::*;
16
17/// ClusterSpec defines 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 = "v1beta1",
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    /// NOTE: this field is considered only for computing v1beta2 conditions.
33    #[serde(
34        default,
35        skip_serializing_if = "Option::is_none",
36        rename = "availabilityGates"
37    )]
38    pub availability_gates: Option<Vec<ClusterAvailabilityGates>>,
39    /// Cluster network configuration.
40    #[serde(
41        default,
42        skip_serializing_if = "Option::is_none",
43        rename = "clusterNetwork"
44    )]
45    pub cluster_network: Option<ClusterClusterNetwork>,
46    /// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
47    #[serde(
48        default,
49        skip_serializing_if = "Option::is_none",
50        rename = "controlPlaneEndpoint"
51    )]
52    pub control_plane_endpoint: Option<ClusterControlPlaneEndpoint>,
53    /// controlPlaneRef is an optional reference to a provider-specific resource that holds
54    /// the details for provisioning the Control Plane for a Cluster.
55    #[serde(
56        default,
57        skip_serializing_if = "Option::is_none",
58        rename = "controlPlaneRef"
59    )]
60    pub control_plane_ref: Option<ObjectReference>,
61    /// infrastructureRef is a reference to a provider-specific resource that holds the details
62    /// for provisioning infrastructure for a cluster in said provider.
63    #[serde(
64        default,
65        skip_serializing_if = "Option::is_none",
66        rename = "infrastructureRef"
67    )]
68    pub infrastructure_ref: Option<ObjectReference>,
69    /// paused can be used to prevent controllers from processing the Cluster and all its associated objects.
70    #[serde(default, skip_serializing_if = "Option::is_none")]
71    pub paused: Option<bool>,
72    /// This encapsulates the topology for the cluster.
73    /// NOTE: It is required to enable the ClusterTopology
74    /// feature gate flag to activate managed topologies support;
75    /// this feature is highly experimental, and parts of it might still be not implemented.
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 positive polarity condition (status true means good) 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}
89
90/// Cluster network configuration.
91#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
92pub struct ClusterClusterNetwork {
93    /// apiServerPort specifies the port the API Server should bind to.
94    /// Defaults to 6443.
95    #[serde(
96        default,
97        skip_serializing_if = "Option::is_none",
98        rename = "apiServerPort"
99    )]
100    pub api_server_port: Option<i32>,
101    /// The network ranges from which Pod networks are allocated.
102    #[serde(default, skip_serializing_if = "Option::is_none")]
103    pub pods: Option<ClusterClusterNetworkPods>,
104    /// Domain name for services.
105    #[serde(
106        default,
107        skip_serializing_if = "Option::is_none",
108        rename = "serviceDomain"
109    )]
110    pub service_domain: Option<String>,
111    /// The network ranges from which service VIPs are allocated.
112    #[serde(default, skip_serializing_if = "Option::is_none")]
113    pub services: Option<ClusterClusterNetworkServices>,
114}
115
116/// The network ranges from which Pod networks are allocated.
117#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
118pub struct ClusterClusterNetworkPods {
119    #[serde(rename = "cidrBlocks")]
120    pub cidr_blocks: Vec<String>,
121}
122
123/// The network ranges from which service VIPs are allocated.
124#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
125pub struct ClusterClusterNetworkServices {
126    #[serde(rename = "cidrBlocks")]
127    pub cidr_blocks: Vec<String>,
128}
129
130/// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
131#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
132pub struct ClusterControlPlaneEndpoint {
133    /// The hostname on which the API server is serving.
134    pub host: String,
135    /// The port on which the API server is serving.
136    pub port: i32,
137}
138
139/// controlPlaneRef is an optional reference to a provider-specific resource that holds
140/// the details for provisioning the Control Plane for a Cluster.
141#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
142pub struct ClusterControlPlaneRef {
143    /// API version of the referent.
144    #[serde(
145        default,
146        skip_serializing_if = "Option::is_none",
147        rename = "apiVersion"
148    )]
149    pub api_version: Option<String>,
150    /// If referring to a piece of an object instead of an entire object, this string
151    /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
152    /// For example, if the object reference is to a container within a pod, this would take on a value like:
153    /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
154    /// the event) or if no container name is specified "spec.containers[2]" (container with
155    /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
156    /// referencing a part of an object.
157    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
158    pub field_path: Option<String>,
159    /// Kind of the referent.
160    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
161    #[serde(default, skip_serializing_if = "Option::is_none")]
162    pub kind: Option<String>,
163    /// Name of the referent.
164    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
165    #[serde(default, skip_serializing_if = "Option::is_none")]
166    pub name: Option<String>,
167    /// Namespace of the referent.
168    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
169    #[serde(default, skip_serializing_if = "Option::is_none")]
170    pub namespace: Option<String>,
171    /// Specific resourceVersion to which this reference is made, if any.
172    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
173    #[serde(
174        default,
175        skip_serializing_if = "Option::is_none",
176        rename = "resourceVersion"
177    )]
178    pub resource_version: Option<String>,
179    /// UID of the referent.
180    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
181    #[serde(default, skip_serializing_if = "Option::is_none")]
182    pub uid: Option<String>,
183}
184
185/// infrastructureRef is a reference to a provider-specific resource that holds the details
186/// for provisioning infrastructure for a cluster in said provider.
187#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
188pub struct ClusterInfrastructureRef {
189    /// API version of the referent.
190    #[serde(
191        default,
192        skip_serializing_if = "Option::is_none",
193        rename = "apiVersion"
194    )]
195    pub api_version: Option<String>,
196    /// If referring to a piece of an object instead of an entire object, this string
197    /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
198    /// For example, if the object reference is to a container within a pod, this would take on a value like:
199    /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
200    /// the event) or if no container name is specified "spec.containers[2]" (container with
201    /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
202    /// referencing a part of an object.
203    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
204    pub field_path: Option<String>,
205    /// Kind of the referent.
206    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
207    #[serde(default, skip_serializing_if = "Option::is_none")]
208    pub kind: Option<String>,
209    /// Name of the referent.
210    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
211    #[serde(default, skip_serializing_if = "Option::is_none")]
212    pub name: Option<String>,
213    /// Namespace of the referent.
214    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
215    #[serde(default, skip_serializing_if = "Option::is_none")]
216    pub namespace: Option<String>,
217    /// Specific resourceVersion to which this reference is made, if any.
218    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
219    #[serde(
220        default,
221        skip_serializing_if = "Option::is_none",
222        rename = "resourceVersion"
223    )]
224    pub resource_version: Option<String>,
225    /// UID of the referent.
226    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
227    #[serde(default, skip_serializing_if = "Option::is_none")]
228    pub uid: Option<String>,
229}
230
231/// This encapsulates the topology for the cluster.
232/// NOTE: It is required to enable the ClusterTopology
233/// feature gate flag to activate managed topologies support;
234/// this feature is highly experimental, and parts of it might still be not implemented.
235#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
236pub struct ClusterTopology {
237    /// The name of the ClusterClass object to create the topology.
238    pub class: String,
239    /// classNamespace is the namespace of the ClusterClass object to create the topology.
240    /// If the namespace is empty or not set, it is defaulted to the namespace of the cluster object.
241    /// Value must follow the DNS1123Subdomain syntax.
242    #[serde(
243        default,
244        skip_serializing_if = "Option::is_none",
245        rename = "classNamespace"
246    )]
247    pub class_namespace: Option<String>,
248    /// controlPlane describes the cluster control plane.
249    #[serde(
250        default,
251        skip_serializing_if = "Option::is_none",
252        rename = "controlPlane"
253    )]
254    pub control_plane: Option<ClusterTopologyControlPlane>,
255    /// rolloutAfter performs a rollout of the entire cluster one component at a time,
256    /// control plane first and then machine deployments.
257    ///
258    /// Deprecated: This field has no function and is going to be removed in the next apiVersion.
259    #[serde(
260        default,
261        skip_serializing_if = "Option::is_none",
262        rename = "rolloutAfter"
263    )]
264    pub rollout_after: Option<String>,
265    /// variables can be used to customize the Cluster through
266    /// patches. They must comply to the corresponding
267    /// VariableClasses defined in the ClusterClass.
268    #[serde(default, skip_serializing_if = "Option::is_none")]
269    pub variables: Option<Vec<ClusterTopologyVariables>>,
270    /// The Kubernetes version of the cluster.
271    pub version: String,
272    /// workers encapsulates the different constructs that form the worker nodes
273    /// for the cluster.
274    #[serde(default, skip_serializing_if = "Option::is_none")]
275    pub workers: Option<ClusterTopologyWorkers>,
276}
277
278/// controlPlane describes the cluster control plane.
279#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
280pub struct ClusterTopologyControlPlane {
281    /// machineHealthCheck allows to enable, disable and override
282    /// the MachineHealthCheck configuration in the ClusterClass for this control plane.
283    #[serde(
284        default,
285        skip_serializing_if = "Option::is_none",
286        rename = "machineHealthCheck"
287    )]
288    pub machine_health_check: Option<ClusterTopologyControlPlaneMachineHealthCheck>,
289    /// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
290    /// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
291    /// is applied only to the ControlPlane.
292    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
293    #[serde(default, skip_serializing_if = "Option::is_none")]
294    pub metadata: Option<ClusterTopologyControlPlaneMetadata>,
295    /// nodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
296    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
297    /// Defaults to 10 seconds.
298    #[serde(
299        default,
300        skip_serializing_if = "Option::is_none",
301        rename = "nodeDeletionTimeout"
302    )]
303    pub node_deletion_timeout: Option<String>,
304    /// nodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
305    /// The default value is 0, meaning that the node can be drained without any time limitations.
306    /// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
307    #[serde(
308        default,
309        skip_serializing_if = "Option::is_none",
310        rename = "nodeDrainTimeout"
311    )]
312    pub node_drain_timeout: Option<String>,
313    /// nodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
314    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
315    #[serde(
316        default,
317        skip_serializing_if = "Option::is_none",
318        rename = "nodeVolumeDetachTimeout"
319    )]
320    pub node_volume_detach_timeout: Option<String>,
321    /// replicas is the number of control plane nodes.
322    /// If the value is nil, the ControlPlane object is created without the number of Replicas
323    /// and it's assumed that the control plane controller does not implement support for this field.
324    /// When specified against a control plane provider that lacks support for this field, this value will be ignored.
325    #[serde(default, skip_serializing_if = "Option::is_none")]
326    pub replicas: Option<i32>,
327    /// variables can be used to customize the ControlPlane through patches.
328    #[serde(default, skip_serializing_if = "Option::is_none")]
329    pub variables: Option<ClusterTopologyControlPlaneVariables>,
330}
331
332/// machineHealthCheck allows to enable, disable and override
333/// the MachineHealthCheck configuration in the ClusterClass for this control plane.
334#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
335pub struct ClusterTopologyControlPlaneMachineHealthCheck {
336    /// enable controls if a MachineHealthCheck should be created for the target machines.
337    ///
338    /// If false: No MachineHealthCheck will be created.
339    ///
340    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
341    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
342    ///
343    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
344    /// block if `enable` is true and no MachineHealthCheck definition is available.
345    #[serde(default, skip_serializing_if = "Option::is_none")]
346    pub enable: Option<bool>,
347    /// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
348    /// "selector" are not healthy.
349    #[serde(
350        default,
351        skip_serializing_if = "Option::is_none",
352        rename = "maxUnhealthy"
353    )]
354    pub max_unhealthy: Option<IntOrString>,
355    /// nodeStartupTimeout allows to set the maximum time for MachineHealthCheck
356    /// to consider a Machine unhealthy if a corresponding Node isn't associated
357    /// through a `Spec.ProviderID` field.
358    ///
359    /// The duration set in this field is compared to the greatest of:
360    /// - Cluster's infrastructure ready condition timestamp (if and when available)
361    /// - Control Plane's initialized condition timestamp (if and when available)
362    /// - Machine's infrastructure ready condition timestamp (if and when available)
363    /// - Machine's metadata creation timestamp
364    ///
365    /// Defaults to 10 minutes.
366    /// If you wish to disable this feature, set the value explicitly to 0.
367    #[serde(
368        default,
369        skip_serializing_if = "Option::is_none",
370        rename = "nodeStartupTimeout"
371    )]
372    pub node_startup_timeout: Option<String>,
373    /// remediationTemplate is a reference to a remediation template
374    /// provided by an infrastructure provider.
375    ///
376    /// This field is completely optional, when filled, the MachineHealthCheck controller
377    /// creates a new object from the template referenced and hands off remediation of the machine to
378    /// a controller that lives outside of Cluster API.
379    #[serde(
380        default,
381        skip_serializing_if = "Option::is_none",
382        rename = "remediationTemplate"
383    )]
384    pub remediation_template: Option<ObjectReference>,
385    /// unhealthyConditions contains a list of the conditions that determine
386    /// whether a node is considered unhealthy. The conditions are combined in a
387    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
388    #[serde(
389        default,
390        skip_serializing_if = "Option::is_none",
391        rename = "unhealthyConditions"
392    )]
393    pub unhealthy_conditions:
394        Option<Vec<ClusterTopologyControlPlaneMachineHealthCheckUnhealthyConditions>>,
395    /// Any further remediation is only allowed if the number of machines selected by "selector" as not healthy
396    /// is within the range of "UnhealthyRange". Takes precedence over MaxUnhealthy.
397    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
398    /// (a) there are at least 3 unhealthy machines (and)
399    /// (b) there are at most 5 unhealthy machines
400    #[serde(
401        default,
402        skip_serializing_if = "Option::is_none",
403        rename = "unhealthyRange"
404    )]
405    pub unhealthy_range: Option<String>,
406}
407
408/// remediationTemplate is a reference to a remediation template
409/// provided by an infrastructure provider.
410///
411/// This field is completely optional, when filled, the MachineHealthCheck controller
412/// creates a new object from the template referenced and hands off remediation of the machine to
413/// a controller that lives outside of Cluster API.
414#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
415pub struct ClusterTopologyControlPlaneMachineHealthCheckRemediationTemplate {
416    /// API version of the referent.
417    #[serde(
418        default,
419        skip_serializing_if = "Option::is_none",
420        rename = "apiVersion"
421    )]
422    pub api_version: Option<String>,
423    /// If referring to a piece of an object instead of an entire object, this string
424    /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
425    /// For example, if the object reference is to a container within a pod, this would take on a value like:
426    /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
427    /// the event) or if no container name is specified "spec.containers[2]" (container with
428    /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
429    /// referencing a part of an object.
430    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
431    pub field_path: Option<String>,
432    /// Kind of the referent.
433    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
434    #[serde(default, skip_serializing_if = "Option::is_none")]
435    pub kind: Option<String>,
436    /// Name of the referent.
437    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
438    #[serde(default, skip_serializing_if = "Option::is_none")]
439    pub name: Option<String>,
440    /// Namespace of the referent.
441    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
442    #[serde(default, skip_serializing_if = "Option::is_none")]
443    pub namespace: Option<String>,
444    /// Specific resourceVersion to which this reference is made, if any.
445    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
446    #[serde(
447        default,
448        skip_serializing_if = "Option::is_none",
449        rename = "resourceVersion"
450    )]
451    pub resource_version: Option<String>,
452    /// UID of the referent.
453    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
454    #[serde(default, skip_serializing_if = "Option::is_none")]
455    pub uid: Option<String>,
456}
457
458/// UnhealthyCondition represents a Node condition type and value with a timeout
459/// specified as a duration.  When the named condition has been in the given
460/// status for at least the timeout value, a node is considered unhealthy.
461#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
462pub struct ClusterTopologyControlPlaneMachineHealthCheckUnhealthyConditions {
463    pub status: String,
464    pub timeout: String,
465    #[serde(rename = "type")]
466    pub r#type: String,
467}
468
469/// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
470/// if the ControlPlaneTemplate referenced by the ClusterClass is machine based. If not, it
471/// is applied only to the ControlPlane.
472/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
473#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
474pub struct ClusterTopologyControlPlaneMetadata {
475    /// annotations is an unstructured key value map stored with a resource that may be
476    /// set by external tools to store and retrieve arbitrary metadata. They are not
477    /// queryable and should be preserved when modifying objects.
478    /// More info: http://kubernetes.io/docs/user-guide/annotations
479    #[serde(default, skip_serializing_if = "Option::is_none")]
480    pub annotations: Option<BTreeMap<String, String>>,
481    /// Map of string keys and values that can be used to organize and categorize
482    /// (scope and select) objects. May match selectors of replication controllers
483    /// and services.
484    /// More info: http://kubernetes.io/docs/user-guide/labels
485    #[serde(default, skip_serializing_if = "Option::is_none")]
486    pub labels: Option<BTreeMap<String, String>>,
487}
488
489/// variables can be used to customize the ControlPlane through patches.
490#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
491pub struct ClusterTopologyControlPlaneVariables {
492    /// overrides can be used to override Cluster level variables.
493    #[serde(default, skip_serializing_if = "Option::is_none")]
494    pub overrides: Option<Vec<ClusterTopologyControlPlaneVariablesOverrides>>,
495}
496
497/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
498/// Variable definition in the ClusterClass `status` variables.
499#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
500pub struct ClusterTopologyControlPlaneVariablesOverrides {
501    /// definitionFrom specifies where the definition of this Variable is from.
502    ///
503    /// Deprecated: This field is deprecated, must not be set anymore and is going to be removed in the next apiVersion.
504    #[serde(
505        default,
506        skip_serializing_if = "Option::is_none",
507        rename = "definitionFrom"
508    )]
509    pub definition_from: Option<String>,
510    /// name of the variable.
511    pub name: String,
512    /// value of the variable.
513    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
514    /// from the ClusterClass.
515    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
516    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
517    /// i.e. it is not possible to have no type field.
518    /// Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111
519    pub value: serde_json::Value,
520}
521
522/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
523/// Variable definition in the ClusterClass `status` variables.
524#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
525pub struct ClusterTopologyVariables {
526    /// definitionFrom specifies where the definition of this Variable is from.
527    ///
528    /// Deprecated: This field is deprecated, must not be set anymore and is going to be removed in the next apiVersion.
529    #[serde(
530        default,
531        skip_serializing_if = "Option::is_none",
532        rename = "definitionFrom"
533    )]
534    pub definition_from: Option<String>,
535    /// name of the variable.
536    pub name: String,
537    /// value of the variable.
538    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
539    /// from the ClusterClass.
540    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
541    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
542    /// i.e. it is not possible to have no type field.
543    /// Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111
544    pub value: serde_json::Value,
545}
546
547/// workers encapsulates the different constructs that form the worker nodes
548/// for the cluster.
549#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
550pub struct ClusterTopologyWorkers {
551    /// machineDeployments is a list of machine deployments in the cluster.
552    #[serde(
553        default,
554        skip_serializing_if = "Option::is_none",
555        rename = "machineDeployments"
556    )]
557    pub machine_deployments: Option<Vec<ClusterTopologyWorkersMachineDeployments>>,
558    /// machinePools is a list of machine pools in the cluster.
559    #[serde(
560        default,
561        skip_serializing_if = "Option::is_none",
562        rename = "machinePools"
563    )]
564    pub machine_pools: Option<Vec<ClusterTopologyWorkersMachinePools>>,
565}
566
567/// MachineDeploymentTopology specifies the different parameters for a set of worker nodes in the topology.
568/// This set of nodes is managed by a MachineDeployment object whose lifecycle is managed by the Cluster controller.
569#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
570pub struct ClusterTopologyWorkersMachineDeployments {
571    /// class is the name of the MachineDeploymentClass used to create the set of worker nodes.
572    /// This should match one of the deployment classes defined in the ClusterClass object
573    /// mentioned in the `Cluster.Spec.Class` field.
574    pub class: String,
575    /// failureDomain is the failure domain the machines will be created in.
576    /// Must match a key in the FailureDomains map stored on the cluster object.
577    #[serde(
578        default,
579        skip_serializing_if = "Option::is_none",
580        rename = "failureDomain"
581    )]
582    pub failure_domain: Option<String>,
583    /// machineHealthCheck allows to enable, disable and override
584    /// the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment.
585    #[serde(
586        default,
587        skip_serializing_if = "Option::is_none",
588        rename = "machineHealthCheck"
589    )]
590    pub machine_health_check: Option<ClusterTopologyWorkersMachineDeploymentsMachineHealthCheck>,
591    /// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
592    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
593    #[serde(default, skip_serializing_if = "Option::is_none")]
594    pub metadata: Option<ClusterTopologyWorkersMachineDeploymentsMetadata>,
595    /// Minimum number of seconds for which a newly created machine should
596    /// be ready.
597    /// Defaults to 0 (machine will be considered available as soon as it
598    /// is ready)
599    #[serde(
600        default,
601        skip_serializing_if = "Option::is_none",
602        rename = "minReadySeconds"
603    )]
604    pub min_ready_seconds: Option<i32>,
605    /// name is the unique identifier for this MachineDeploymentTopology.
606    /// The value is used with other unique identifiers to create a MachineDeployment's Name
607    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
608    /// the values are hashed together.
609    pub name: String,
610    /// nodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
611    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
612    /// Defaults to 10 seconds.
613    #[serde(
614        default,
615        skip_serializing_if = "Option::is_none",
616        rename = "nodeDeletionTimeout"
617    )]
618    pub node_deletion_timeout: Option<String>,
619    /// nodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
620    /// The default value is 0, meaning that the node can be drained without any time limitations.
621    /// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
622    #[serde(
623        default,
624        skip_serializing_if = "Option::is_none",
625        rename = "nodeDrainTimeout"
626    )]
627    pub node_drain_timeout: Option<String>,
628    /// nodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
629    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
630    #[serde(
631        default,
632        skip_serializing_if = "Option::is_none",
633        rename = "nodeVolumeDetachTimeout"
634    )]
635    pub node_volume_detach_timeout: Option<String>,
636    /// replicas is the number of worker nodes belonging to this set.
637    /// If the value is nil, the MachineDeployment is created without the number of Replicas (defaulting to 1)
638    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
639    /// of this value.
640    #[serde(default, skip_serializing_if = "Option::is_none")]
641    pub replicas: Option<i32>,
642    /// The deployment strategy to use to replace existing machines with
643    /// new ones.
644    #[serde(default, skip_serializing_if = "Option::is_none")]
645    pub strategy: Option<ClusterTopologyWorkersMachineDeploymentsStrategy>,
646    /// variables can be used to customize the MachineDeployment through patches.
647    #[serde(default, skip_serializing_if = "Option::is_none")]
648    pub variables: Option<ClusterTopologyWorkersMachineDeploymentsVariables>,
649}
650
651/// machineHealthCheck allows to enable, disable and override
652/// the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment.
653#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
654pub struct ClusterTopologyWorkersMachineDeploymentsMachineHealthCheck {
655    /// enable controls if a MachineHealthCheck should be created for the target machines.
656    ///
657    /// If false: No MachineHealthCheck will be created.
658    ///
659    /// If not set(default): A MachineHealthCheck will be created if it is defined here or
660    ///  in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.
661    ///
662    /// If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will
663    /// block if `enable` is true and no MachineHealthCheck definition is available.
664    #[serde(default, skip_serializing_if = "Option::is_none")]
665    pub enable: Option<bool>,
666    /// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
667    /// "selector" are not healthy.
668    #[serde(
669        default,
670        skip_serializing_if = "Option::is_none",
671        rename = "maxUnhealthy"
672    )]
673    pub max_unhealthy: Option<IntOrString>,
674    /// nodeStartupTimeout allows to set the maximum time for MachineHealthCheck
675    /// to consider a Machine unhealthy if a corresponding Node isn't associated
676    /// through a `Spec.ProviderID` field.
677    ///
678    /// The duration set in this field is compared to the greatest of:
679    /// - Cluster's infrastructure ready condition timestamp (if and when available)
680    /// - Control Plane's initialized condition timestamp (if and when available)
681    /// - Machine's infrastructure ready condition timestamp (if and when available)
682    /// - Machine's metadata creation timestamp
683    ///
684    /// Defaults to 10 minutes.
685    /// If you wish to disable this feature, set the value explicitly to 0.
686    #[serde(
687        default,
688        skip_serializing_if = "Option::is_none",
689        rename = "nodeStartupTimeout"
690    )]
691    pub node_startup_timeout: Option<String>,
692    /// remediationTemplate is a reference to a remediation template
693    /// provided by an infrastructure provider.
694    ///
695    /// This field is completely optional, when filled, the MachineHealthCheck controller
696    /// creates a new object from the template referenced and hands off remediation of the machine to
697    /// a controller that lives outside of Cluster API.
698    #[serde(
699        default,
700        skip_serializing_if = "Option::is_none",
701        rename = "remediationTemplate"
702    )]
703    pub remediation_template: Option<ObjectReference>,
704    /// unhealthyConditions contains a list of the conditions that determine
705    /// whether a node is considered unhealthy. The conditions are combined in a
706    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
707    #[serde(
708        default,
709        skip_serializing_if = "Option::is_none",
710        rename = "unhealthyConditions"
711    )]
712    pub unhealthy_conditions:
713        Option<Vec<ClusterTopologyWorkersMachineDeploymentsMachineHealthCheckUnhealthyConditions>>,
714    /// Any further remediation is only allowed if the number of machines selected by "selector" as not healthy
715    /// is within the range of "UnhealthyRange". Takes precedence over MaxUnhealthy.
716    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
717    /// (a) there are at least 3 unhealthy machines (and)
718    /// (b) there are at most 5 unhealthy machines
719    #[serde(
720        default,
721        skip_serializing_if = "Option::is_none",
722        rename = "unhealthyRange"
723    )]
724    pub unhealthy_range: Option<String>,
725}
726
727/// remediationTemplate is a reference to a remediation template
728/// provided by an infrastructure provider.
729///
730/// This field is completely optional, when filled, the MachineHealthCheck controller
731/// creates a new object from the template referenced and hands off remediation of the machine to
732/// a controller that lives outside of Cluster API.
733#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
734pub struct ClusterTopologyWorkersMachineDeploymentsMachineHealthCheckRemediationTemplate {
735    /// API version of the referent.
736    #[serde(
737        default,
738        skip_serializing_if = "Option::is_none",
739        rename = "apiVersion"
740    )]
741    pub api_version: Option<String>,
742    /// If referring to a piece of an object instead of an entire object, this string
743    /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
744    /// For example, if the object reference is to a container within a pod, this would take on a value like:
745    /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
746    /// the event) or if no container name is specified "spec.containers[2]" (container with
747    /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
748    /// referencing a part of an object.
749    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
750    pub field_path: Option<String>,
751    /// Kind of the referent.
752    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
753    #[serde(default, skip_serializing_if = "Option::is_none")]
754    pub kind: Option<String>,
755    /// Name of the referent.
756    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
757    #[serde(default, skip_serializing_if = "Option::is_none")]
758    pub name: Option<String>,
759    /// Namespace of the referent.
760    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
761    #[serde(default, skip_serializing_if = "Option::is_none")]
762    pub namespace: Option<String>,
763    /// Specific resourceVersion to which this reference is made, if any.
764    /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
765    #[serde(
766        default,
767        skip_serializing_if = "Option::is_none",
768        rename = "resourceVersion"
769    )]
770    pub resource_version: Option<String>,
771    /// UID of the referent.
772    /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
773    #[serde(default, skip_serializing_if = "Option::is_none")]
774    pub uid: Option<String>,
775}
776
777/// UnhealthyCondition represents a Node condition type and value with a timeout
778/// specified as a duration.  When the named condition has been in the given
779/// status for at least the timeout value, a node is considered unhealthy.
780#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
781pub struct ClusterTopologyWorkersMachineDeploymentsMachineHealthCheckUnhealthyConditions {
782    pub status: String,
783    pub timeout: String,
784    #[serde(rename = "type")]
785    pub r#type: String,
786}
787
788/// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
789/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
790#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
791pub struct ClusterTopologyWorkersMachineDeploymentsMetadata {
792    /// annotations is an unstructured key value map stored with a resource that may be
793    /// set by external tools to store and retrieve arbitrary metadata. They are not
794    /// queryable and should be preserved when modifying objects.
795    /// More info: http://kubernetes.io/docs/user-guide/annotations
796    #[serde(default, skip_serializing_if = "Option::is_none")]
797    pub annotations: Option<BTreeMap<String, String>>,
798    /// Map of string keys and values that can be used to organize and categorize
799    /// (scope and select) objects. May match selectors of replication controllers
800    /// and services.
801    /// More info: http://kubernetes.io/docs/user-guide/labels
802    #[serde(default, skip_serializing_if = "Option::is_none")]
803    pub labels: Option<BTreeMap<String, String>>,
804}
805
806/// The deployment strategy to use to replace existing machines with
807/// new ones.
808#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
809pub struct ClusterTopologyWorkersMachineDeploymentsStrategy {
810    /// remediation controls the strategy of remediating unhealthy machines
811    /// and how remediating operations should occur during the lifecycle of the dependant MachineSets.
812    #[serde(default, skip_serializing_if = "Option::is_none")]
813    pub remediation: Option<ClusterTopologyWorkersMachineDeploymentsStrategyRemediation>,
814    /// Rolling update config params. Present only if
815    /// MachineDeploymentStrategyType = RollingUpdate.
816    #[serde(
817        default,
818        skip_serializing_if = "Option::is_none",
819        rename = "rollingUpdate"
820    )]
821    pub rolling_update: Option<ClusterTopologyWorkersMachineDeploymentsStrategyRollingUpdate>,
822    /// type of deployment. Allowed values are RollingUpdate and OnDelete.
823    /// The default is RollingUpdate.
824    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
825    pub r#type: Option<ClusterTopologyWorkersMachineDeploymentsStrategyType>,
826}
827
828/// remediation controls the strategy of remediating unhealthy machines
829/// and how remediating operations should occur during the lifecycle of the dependant MachineSets.
830#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
831pub struct ClusterTopologyWorkersMachineDeploymentsStrategyRemediation {
832    /// maxInFlight determines how many in flight remediations should happen at the same time.
833    ///
834    /// Remediation only happens on the MachineSet with the most current revision, while
835    /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
836    ///
837    /// Note: In general (independent of remediations), unhealthy machines are always
838    /// prioritized during scale down operations over healthy ones.
839    ///
840    /// MaxInFlight can be set to a fixed number or a percentage.
841    /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
842    /// the desired replicas.
843    ///
844    /// If not set, remediation is limited to all machines (bounded by replicas)
845    /// under the active MachineSet's management.
846    #[serde(
847        default,
848        skip_serializing_if = "Option::is_none",
849        rename = "maxInFlight"
850    )]
851    pub max_in_flight: Option<IntOrString>,
852}
853
854/// Rolling update config params. Present only if
855/// MachineDeploymentStrategyType = RollingUpdate.
856#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
857pub struct ClusterTopologyWorkersMachineDeploymentsStrategyRollingUpdate {
858    /// deletePolicy defines the policy used by the MachineDeployment to identify nodes to delete when downscaling.
859    /// Valid values are "Random, "Newest", "Oldest"
860    /// When no value is supplied, the default DeletePolicy of MachineSet is used
861    #[serde(
862        default,
863        skip_serializing_if = "Option::is_none",
864        rename = "deletePolicy"
865    )]
866    pub delete_policy:
867        Option<ClusterTopologyWorkersMachineDeploymentsStrategyRollingUpdateDeletePolicy>,
868    /// The maximum number of machines that can be scheduled above the
869    /// desired number of machines.
870    /// Value can be an absolute number (ex: 5) or a percentage of
871    /// desired machines (ex: 10%).
872    /// This can not be 0 if MaxUnavailable is 0.
873    /// Absolute number is calculated from percentage by rounding up.
874    /// Defaults to 1.
875    /// Example: when this is set to 30%, the new MachineSet can be scaled
876    /// up immediately when the rolling update starts, such that the total
877    /// number of old and new machines do not exceed 130% of desired
878    /// machines. Once old machines have been killed, new MachineSet can
879    /// be scaled up further, ensuring that total number of machines running
880    /// at any time during the update is at most 130% of desired machines.
881    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
882    pub max_surge: Option<IntOrString>,
883    /// The maximum number of machines that can be unavailable during the update.
884    /// Value can be an absolute number (ex: 5) or a percentage of desired
885    /// machines (ex: 10%).
886    /// Absolute number is calculated from percentage by rounding down.
887    /// This can not be 0 if MaxSurge is 0.
888    /// Defaults to 0.
889    /// Example: when this is set to 30%, the old MachineSet can be scaled
890    /// down to 70% of desired machines immediately when the rolling update
891    /// starts. Once new machines are ready, old MachineSet can be scaled
892    /// down further, followed by scaling up the new MachineSet, ensuring
893    /// that the total number of machines available at all times
894    /// during the update is at least 70% of desired machines.
895    #[serde(
896        default,
897        skip_serializing_if = "Option::is_none",
898        rename = "maxUnavailable"
899    )]
900    pub max_unavailable: Option<IntOrString>,
901}
902
903/// Rolling update config params. Present only if
904/// MachineDeploymentStrategyType = RollingUpdate.
905#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
906pub enum ClusterTopologyWorkersMachineDeploymentsStrategyRollingUpdateDeletePolicy {
907    Random,
908    Newest,
909    Oldest,
910}
911
912/// The deployment strategy to use to replace existing machines with
913/// new ones.
914#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
915pub enum ClusterTopologyWorkersMachineDeploymentsStrategyType {
916    RollingUpdate,
917    OnDelete,
918}
919
920/// variables can be used to customize the MachineDeployment through patches.
921#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
922pub struct ClusterTopologyWorkersMachineDeploymentsVariables {
923    /// overrides can be used to override Cluster level variables.
924    #[serde(default, skip_serializing_if = "Option::is_none")]
925    pub overrides: Option<Vec<ClusterTopologyWorkersMachineDeploymentsVariablesOverrides>>,
926}
927
928/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
929/// Variable definition in the ClusterClass `status` variables.
930#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
931pub struct ClusterTopologyWorkersMachineDeploymentsVariablesOverrides {
932    /// definitionFrom specifies where the definition of this Variable is from.
933    ///
934    /// Deprecated: This field is deprecated, must not be set anymore and is going to be removed in the next apiVersion.
935    #[serde(
936        default,
937        skip_serializing_if = "Option::is_none",
938        rename = "definitionFrom"
939    )]
940    pub definition_from: Option<String>,
941    /// name of the variable.
942    pub name: String,
943    /// value of the variable.
944    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
945    /// from the ClusterClass.
946    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
947    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
948    /// i.e. it is not possible to have no type field.
949    /// Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111
950    pub value: serde_json::Value,
951}
952
953/// MachinePoolTopology specifies the different parameters for a pool of worker nodes in the topology.
954/// This pool of nodes is managed by a MachinePool object whose lifecycle is managed by the Cluster controller.
955#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
956pub struct ClusterTopologyWorkersMachinePools {
957    /// class is the name of the MachinePoolClass used to create the pool of worker nodes.
958    /// This should match one of the deployment classes defined in the ClusterClass object
959    /// mentioned in the `Cluster.Spec.Class` field.
960    pub class: String,
961    /// failureDomains is the list of failure domains the machine pool will be created in.
962    /// Must match a key in the FailureDomains map stored on the cluster object.
963    #[serde(
964        default,
965        skip_serializing_if = "Option::is_none",
966        rename = "failureDomains"
967    )]
968    pub failure_domains: Option<Vec<String>>,
969    /// metadata is the metadata applied to the MachinePool.
970    /// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
971    #[serde(default, skip_serializing_if = "Option::is_none")]
972    pub metadata: Option<ClusterTopologyWorkersMachinePoolsMetadata>,
973    /// Minimum number of seconds for which a newly created machine pool should
974    /// be ready.
975    /// Defaults to 0 (machine will be considered available as soon as it
976    /// is ready)
977    #[serde(
978        default,
979        skip_serializing_if = "Option::is_none",
980        rename = "minReadySeconds"
981    )]
982    pub min_ready_seconds: Option<i32>,
983    /// name is the unique identifier for this MachinePoolTopology.
984    /// The value is used with other unique identifiers to create a MachinePool's Name
985    /// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
986    /// the values are hashed together.
987    pub name: String,
988    /// nodeDeletionTimeout defines how long the controller will attempt to delete the Node that the MachinePool
989    /// hosts after the MachinePool is marked for deletion. A duration of 0 will retry deletion indefinitely.
990    /// Defaults to 10 seconds.
991    #[serde(
992        default,
993        skip_serializing_if = "Option::is_none",
994        rename = "nodeDeletionTimeout"
995    )]
996    pub node_deletion_timeout: Option<String>,
997    /// nodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
998    /// The default value is 0, meaning that the node can be drained without any time limitations.
999    /// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
1000    #[serde(
1001        default,
1002        skip_serializing_if = "Option::is_none",
1003        rename = "nodeDrainTimeout"
1004    )]
1005    pub node_drain_timeout: Option<String>,
1006    /// nodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
1007    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
1008    #[serde(
1009        default,
1010        skip_serializing_if = "Option::is_none",
1011        rename = "nodeVolumeDetachTimeout"
1012    )]
1013    pub node_volume_detach_timeout: Option<String>,
1014    /// replicas is the number of nodes belonging to this pool.
1015    /// If the value is nil, the MachinePool is created without the number of Replicas (defaulting to 1)
1016    /// and it's assumed that an external entity (like cluster autoscaler) is responsible for the management
1017    /// of this value.
1018    #[serde(default, skip_serializing_if = "Option::is_none")]
1019    pub replicas: Option<i32>,
1020    /// variables can be used to customize the MachinePool through patches.
1021    #[serde(default, skip_serializing_if = "Option::is_none")]
1022    pub variables: Option<ClusterTopologyWorkersMachinePoolsVariables>,
1023}
1024
1025/// metadata is the metadata applied to the MachinePool.
1026/// At runtime this metadata is merged with the corresponding metadata from the ClusterClass.
1027#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1028pub struct ClusterTopologyWorkersMachinePoolsMetadata {
1029    /// annotations is an unstructured key value map stored with a resource that may be
1030    /// set by external tools to store and retrieve arbitrary metadata. They are not
1031    /// queryable and should be preserved when modifying objects.
1032    /// More info: http://kubernetes.io/docs/user-guide/annotations
1033    #[serde(default, skip_serializing_if = "Option::is_none")]
1034    pub annotations: Option<BTreeMap<String, String>>,
1035    /// Map of string keys and values that can be used to organize and categorize
1036    /// (scope and select) objects. May match selectors of replication controllers
1037    /// and services.
1038    /// More info: http://kubernetes.io/docs/user-guide/labels
1039    #[serde(default, skip_serializing_if = "Option::is_none")]
1040    pub labels: Option<BTreeMap<String, String>>,
1041}
1042
1043/// variables can be used to customize the MachinePool through patches.
1044#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1045pub struct ClusterTopologyWorkersMachinePoolsVariables {
1046    /// overrides can be used to override Cluster level variables.
1047    #[serde(default, skip_serializing_if = "Option::is_none")]
1048    pub overrides: Option<Vec<ClusterTopologyWorkersMachinePoolsVariablesOverrides>>,
1049}
1050
1051/// ClusterVariable can be used to customize the Cluster through patches. Each ClusterVariable is associated with a
1052/// Variable definition in the ClusterClass `status` variables.
1053#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1054pub struct ClusterTopologyWorkersMachinePoolsVariablesOverrides {
1055    /// definitionFrom specifies where the definition of this Variable is from.
1056    ///
1057    /// Deprecated: This field is deprecated, must not be set anymore and is going to be removed in the next apiVersion.
1058    #[serde(
1059        default,
1060        skip_serializing_if = "Option::is_none",
1061        rename = "definitionFrom"
1062    )]
1063    pub definition_from: Option<String>,
1064    /// name of the variable.
1065    pub name: String,
1066    /// value of the variable.
1067    /// Note: the value will be validated against the schema of the corresponding ClusterClassVariable
1068    /// from the ClusterClass.
1069    /// Note: We have to use apiextensionsv1.JSON instead of a custom JSON type, because controller-tools has a
1070    /// hard-coded schema for apiextensionsv1.JSON which cannot be produced by another type via controller-tools,
1071    /// i.e. it is not possible to have no type field.
1072    /// Ref: https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111
1073    pub value: serde_json::Value,
1074}
1075
1076/// ClusterStatus defines the observed state of Cluster.
1077#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1078pub struct ClusterStatus {
1079    /// conditions defines current service state of the cluster.
1080    #[serde(default, skip_serializing_if = "Option::is_none")]
1081    pub conditions: Option<Vec<Condition>>,
1082    /// controlPlaneReady denotes if the control plane became ready during initial provisioning
1083    /// to receive requests.
1084    /// NOTE: this field is part of the Cluster API contract and it is used to orchestrate provisioning.
1085    /// The value of this field is never updated after provisioning is completed. Please use conditions
1086    /// to check the operational state of the control plane.
1087    #[serde(
1088        default,
1089        skip_serializing_if = "Option::is_none",
1090        rename = "controlPlaneReady"
1091    )]
1092    pub control_plane_ready: Option<bool>,
1093    /// failureDomains is a slice of failure domain objects synced from the infrastructure provider.
1094    #[serde(
1095        default,
1096        skip_serializing_if = "Option::is_none",
1097        rename = "failureDomains"
1098    )]
1099    pub failure_domains: Option<BTreeMap<String, ClusterStatusFailureDomains>>,
1100    /// failureMessage indicates that there is a fatal problem reconciling the
1101    /// state, and will be set to a descriptive error message.
1102    ///
1103    /// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
1104    #[serde(
1105        default,
1106        skip_serializing_if = "Option::is_none",
1107        rename = "failureMessage"
1108    )]
1109    pub failure_message: Option<String>,
1110    /// failureReason indicates that there is a fatal problem reconciling the
1111    /// state, and will be set to a token value suitable for
1112    /// programmatic interpretation.
1113    ///
1114    /// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
1115    #[serde(
1116        default,
1117        skip_serializing_if = "Option::is_none",
1118        rename = "failureReason"
1119    )]
1120    pub failure_reason: Option<String>,
1121    /// infrastructureReady is the state of the infrastructure provider.
1122    #[serde(
1123        default,
1124        skip_serializing_if = "Option::is_none",
1125        rename = "infrastructureReady"
1126    )]
1127    pub infrastructure_ready: Option<bool>,
1128    /// observedGeneration is the latest generation observed by the controller.
1129    #[serde(
1130        default,
1131        skip_serializing_if = "Option::is_none",
1132        rename = "observedGeneration"
1133    )]
1134    pub observed_generation: Option<i64>,
1135    /// phase represents the current phase of cluster actuation.
1136    /// E.g. Pending, Running, Terminating, Failed etc.
1137    #[serde(default, skip_serializing_if = "Option::is_none")]
1138    pub phase: Option<String>,
1139    /// v1beta2 groups all the fields that will be added or modified in Cluster's status with the V1Beta2 version.
1140    #[serde(default, skip_serializing_if = "Option::is_none")]
1141    pub v1beta2: Option<ClusterStatusV1beta2>,
1142}
1143
1144/// failureDomains is a slice of failure domain objects synced from the infrastructure provider.
1145#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1146pub struct ClusterStatusFailureDomains {
1147    /// attributes is a free form map of attributes an infrastructure provider might use or require.
1148    #[serde(default, skip_serializing_if = "Option::is_none")]
1149    pub attributes: Option<BTreeMap<String, String>>,
1150    /// controlPlane determines if this failure domain is suitable for use by control plane machines.
1151    #[serde(
1152        default,
1153        skip_serializing_if = "Option::is_none",
1154        rename = "controlPlane"
1155    )]
1156    pub control_plane: Option<bool>,
1157}
1158
1159/// v1beta2 groups all the fields that will be added or modified in Cluster's status with the V1Beta2 version.
1160#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1161pub struct ClusterStatusV1beta2 {
1162    /// conditions represents the observations of a Cluster's current state.
1163    /// Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady
1164    /// MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused.
1165    /// Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology.
1166    #[serde(default, skip_serializing_if = "Option::is_none")]
1167    pub conditions: Option<Vec<Condition>>,
1168    /// controlPlane groups all the observations about Cluster's ControlPlane current state.
1169    #[serde(
1170        default,
1171        skip_serializing_if = "Option::is_none",
1172        rename = "controlPlane"
1173    )]
1174    pub control_plane: Option<ClusterStatusV1beta2ControlPlane>,
1175    /// workers groups all the observations about Cluster's Workers current state.
1176    #[serde(default, skip_serializing_if = "Option::is_none")]
1177    pub workers: Option<ClusterStatusV1beta2Workers>,
1178}
1179
1180/// controlPlane groups all the observations about Cluster's ControlPlane current state.
1181#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1182pub struct ClusterStatusV1beta2ControlPlane {
1183    /// 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.
1184    #[serde(
1185        default,
1186        skip_serializing_if = "Option::is_none",
1187        rename = "availableReplicas"
1188    )]
1189    pub available_replicas: Option<i32>,
1190    /// desiredReplicas is the total number of desired control plane machines in this cluster.
1191    #[serde(
1192        default,
1193        skip_serializing_if = "Option::is_none",
1194        rename = "desiredReplicas"
1195    )]
1196    pub desired_replicas: Option<i32>,
1197    /// 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.
1198    #[serde(
1199        default,
1200        skip_serializing_if = "Option::is_none",
1201        rename = "readyReplicas"
1202    )]
1203    pub ready_replicas: Option<i32>,
1204    /// replicas is the total number of control plane machines in this cluster.
1205    /// NOTE: replicas also includes machines still being provisioned or being deleted.
1206    #[serde(default, skip_serializing_if = "Option::is_none")]
1207    pub replicas: Option<i32>,
1208    /// 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.
1209    #[serde(
1210        default,
1211        skip_serializing_if = "Option::is_none",
1212        rename = "upToDateReplicas"
1213    )]
1214    pub up_to_date_replicas: Option<i32>,
1215}
1216
1217/// workers groups all the observations about Cluster's Workers current state.
1218#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1219pub struct ClusterStatusV1beta2Workers {
1220    /// availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true.
1221    #[serde(
1222        default,
1223        skip_serializing_if = "Option::is_none",
1224        rename = "availableReplicas"
1225    )]
1226    pub available_replicas: Option<i32>,
1227    /// desiredReplicas is the total number of desired worker machines in this cluster.
1228    #[serde(
1229        default,
1230        skip_serializing_if = "Option::is_none",
1231        rename = "desiredReplicas"
1232    )]
1233    pub desired_replicas: Option<i32>,
1234    /// readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true.
1235    #[serde(
1236        default,
1237        skip_serializing_if = "Option::is_none",
1238        rename = "readyReplicas"
1239    )]
1240    pub ready_replicas: Option<i32>,
1241    /// replicas is the total number of worker machines in this cluster.
1242    /// NOTE: replicas also includes machines still being provisioned or being deleted.
1243    #[serde(default, skip_serializing_if = "Option::is_none")]
1244    pub replicas: Option<i32>,
1245    /// 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.
1246    #[serde(
1247        default,
1248        skip_serializing_if = "Option::is_none",
1249        rename = "upToDateReplicas"
1250    )]
1251    pub up_to_date_replicas: Option<i32>,
1252}