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