cluster_api_rs/api/
capi_machinedeployment.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 MachineDeployment.
18#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
19#[kube(
20    group = "cluster.x-k8s.io",
21    version = "v1beta2",
22    kind = "MachineDeployment",
23    plural = "machinedeployments"
24)]
25#[kube(namespaced)]
26#[kube(status = "MachineDeploymentStatus")]
27#[kube(derive = "Default")]
28#[kube(derive = "PartialEq")]
29pub struct MachineDeploymentSpec {
30    /// clusterName is the name of the Cluster this object belongs to.
31    #[serde(rename = "clusterName")]
32    pub cluster_name: String,
33    /// deletion contains configuration options for MachineDeployment deletion.
34    #[serde(default, skip_serializing_if = "Option::is_none")]
35    pub deletion: Option<MachineDeploymentDeletion>,
36    /// machineNaming allows changing the naming pattern used when creating Machines.
37    /// Note: InfraMachines & BootstrapConfigs will use the same name as the corresponding Machines.
38    #[serde(
39        default,
40        skip_serializing_if = "Option::is_none",
41        rename = "machineNaming"
42    )]
43    pub machine_naming: Option<MachineDeploymentMachineNaming>,
44    /// paused indicates that the deployment is paused.
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub paused: Option<bool>,
47    /// remediation controls how unhealthy Machines are remediated.
48    #[serde(default, skip_serializing_if = "Option::is_none")]
49    pub remediation: Option<MachineDeploymentRemediation>,
50    /// replicas is the number of desired machines.
51    /// This is a pointer to distinguish between explicit zero and not specified.
52    ///
53    /// Defaults to:
54    /// * if the Kubernetes autoscaler min size and max size annotations are set:
55    ///   - if it's a new MachineDeployment, use min size
56    ///   - if the replicas field of the old MachineDeployment is < min size, use min size
57    ///   - if the replicas field of the old MachineDeployment is > max size, use max size
58    ///   - if the replicas field of the old MachineDeployment is in the (min size, max size) range, keep the value from the oldMD
59    /// * otherwise use 1
60    /// Note: Defaulting will be run whenever the replicas field is not set:
61    /// * A new MachineDeployment is created with replicas not set.
62    /// * On an existing MachineDeployment the replicas field was first set and is now unset.
63    /// Those cases are especially relevant for the following Kubernetes autoscaler use cases:
64    /// * A new MachineDeployment is created and replicas should be managed by the autoscaler
65    /// * An existing MachineDeployment which initially wasn't controlled by the autoscaler
66    ///   should be later controlled by the autoscaler
67    #[serde(default, skip_serializing_if = "Option::is_none")]
68    pub replicas: Option<i32>,
69    /// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
70    /// It allows you to require that all Machines are replaced after a certain time,
71    /// and allows you to define the strategy used during rolling replacements.
72    #[serde(default, skip_serializing_if = "Option::is_none")]
73    pub rollout: Option<MachineDeploymentRollout>,
74    /// selector is the label selector for machines. Existing MachineSets whose machines are
75    /// selected by this will be the ones affected by this deployment.
76    /// It must match the machine template's labels.
77    pub selector: MachineDeploymentSelector,
78    /// template describes the machines that will be created.
79    pub template: MachineDeploymentTemplate,
80}
81
82/// deletion contains configuration options for MachineDeployment deletion.
83#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
84pub struct MachineDeploymentDeletion {
85    /// order defines the order in which Machines are deleted when downscaling.
86    /// Defaults to "Random".  Valid values are "Random, "Newest", "Oldest"
87    #[serde(default, skip_serializing_if = "Option::is_none")]
88    pub order: Option<MachineDeploymentDeletionOrder>,
89}
90
91/// deletion contains configuration options for MachineDeployment deletion.
92#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
93pub enum MachineDeploymentDeletionOrder {
94    Random,
95    Newest,
96    Oldest,
97}
98
99/// machineNaming allows changing the naming pattern used when creating Machines.
100/// Note: InfraMachines & BootstrapConfigs will use the same name as the corresponding Machines.
101#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
102pub struct MachineDeploymentMachineNaming {
103    /// template defines the template to use for generating the names of the
104    /// Machine objects.
105    /// If not defined, it will fallback to `{{ .machineSet.name }}-{{ .random }}`.
106    /// If the generated name string exceeds 63 characters, it will be trimmed to
107    /// 58 characters and will
108    /// get concatenated with a random suffix of length 5.
109    /// Length of the template string must not exceed 256 characters.
110    /// The template allows the following variables `.cluster.name`,
111    /// `.machineSet.name` and `.random`.
112    /// The variable `.cluster.name` retrieves the name of the cluster object
113    /// that owns the Machines being created.
114    /// The variable `.machineSet.name` retrieves the name of the MachineSet
115    /// object that owns the Machines being created.
116    /// The variable `.random` is substituted with random alphanumeric string,
117    /// without vowels, of length 5. This variable is required part of the
118    /// template. If not provided, validation will fail.
119    #[serde(default, skip_serializing_if = "Option::is_none")]
120    pub template: Option<String>,
121}
122
123/// remediation controls how unhealthy Machines are remediated.
124#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
125pub struct MachineDeploymentRemediation {
126    /// maxInFlight determines how many in flight remediations should happen at the same time.
127    ///
128    /// Remediation only happens on the MachineSet with the most current revision, while
129    /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
130    ///
131    /// Note: In general (independent of remediations), unhealthy machines are always
132    /// prioritized during scale down operations over healthy ones.
133    ///
134    /// MaxInFlight can be set to a fixed number or a percentage.
135    /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
136    /// the desired replicas.
137    ///
138    /// If not set, remediation is limited to all machines (bounded by replicas)
139    /// under the active MachineSet's management.
140    #[serde(
141        default,
142        skip_serializing_if = "Option::is_none",
143        rename = "maxInFlight"
144    )]
145    pub max_in_flight: Option<IntOrString>,
146}
147
148/// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
149/// It allows you to require that all Machines are replaced after a certain time,
150/// and allows you to define the strategy used during rolling replacements.
151#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
152pub struct MachineDeploymentRollout {
153    /// after is a field to indicate a rollout should be performed
154    /// after the specified time even if no changes have been made to the
155    /// MachineDeployment.
156    /// Example: In the YAML the time can be specified in the RFC3339 format.
157    /// To specify the rolloutAfter target as March 9, 2023, at 9 am UTC
158    /// use "2023-03-09T09:00:00Z".
159    #[serde(default, skip_serializing_if = "Option::is_none")]
160    pub after: Option<String>,
161    /// strategy specifies how to roll out control plane Machines.
162    #[serde(default, skip_serializing_if = "Option::is_none")]
163    pub strategy: Option<MachineDeploymentRolloutStrategy>,
164}
165
166/// strategy specifies how to roll out control plane Machines.
167#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
168pub struct MachineDeploymentRolloutStrategy {
169    /// rollingUpdate is the rolling update config params. Present only if
170    /// type = RollingUpdate.
171    #[serde(
172        default,
173        skip_serializing_if = "Option::is_none",
174        rename = "rollingUpdate"
175    )]
176    pub rolling_update: Option<MachineDeploymentRolloutStrategyRollingUpdate>,
177    /// type of rollout. Allowed values are RollingUpdate and OnDelete.
178    /// Default is RollingUpdate.
179    #[serde(rename = "type")]
180    pub r#type: MachineDeploymentRolloutStrategyType,
181}
182
183/// rollingUpdate is the rolling update config params. Present only if
184/// type = RollingUpdate.
185#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
186pub struct MachineDeploymentRolloutStrategyRollingUpdate {
187    /// maxSurge is the maximum number of machines that can be scheduled above the
188    /// desired number of machines.
189    /// Value can be an absolute number (ex: 5) or a percentage of
190    /// desired machines (ex: 10%).
191    /// This can not be 0 if MaxUnavailable is 0.
192    /// Absolute number is calculated from percentage by rounding up.
193    /// Defaults to 1.
194    /// Example: when this is set to 30%, the new MachineSet can be scaled
195    /// up immediately when the rolling update starts, such that the total
196    /// number of old and new machines do not exceed 130% of desired
197    /// machines. Once old machines have been killed, new MachineSet can
198    /// be scaled up further, ensuring that total number of machines running
199    /// at any time during the update is at most 130% of desired machines.
200    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
201    pub max_surge: Option<IntOrString>,
202    /// maxUnavailable is the maximum number of machines that can be unavailable during the update.
203    /// Value can be an absolute number (ex: 5) or a percentage of desired
204    /// machines (ex: 10%).
205    /// Absolute number is calculated from percentage by rounding down.
206    /// This can not be 0 if MaxSurge is 0.
207    /// Defaults to 0.
208    /// Example: when this is set to 30%, the old MachineSet can be scaled
209    /// down to 70% of desired machines immediately when the rolling update
210    /// starts. Once new machines are ready, old MachineSet can be scaled
211    /// down further, followed by scaling up the new MachineSet, ensuring
212    /// that the total number of machines available at all times
213    /// during the update is at least 70% of desired machines.
214    #[serde(
215        default,
216        skip_serializing_if = "Option::is_none",
217        rename = "maxUnavailable"
218    )]
219    pub max_unavailable: Option<IntOrString>,
220}
221
222/// strategy specifies how to roll out control plane Machines.
223#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
224pub enum MachineDeploymentRolloutStrategyType {
225    RollingUpdate,
226    OnDelete,
227}
228
229/// selector is the label selector for machines. Existing MachineSets whose machines are
230/// selected by this will be the ones affected by this deployment.
231/// It must match the machine template's labels.
232#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
233pub struct MachineDeploymentSelector {
234    /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
235    #[serde(
236        default,
237        skip_serializing_if = "Option::is_none",
238        rename = "matchExpressions"
239    )]
240    pub match_expressions: Option<Vec<MachineDeploymentSelectorMatchExpressions>>,
241    /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
242    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
243    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
244    #[serde(
245        default,
246        skip_serializing_if = "Option::is_none",
247        rename = "matchLabels"
248    )]
249    pub match_labels: Option<BTreeMap<String, String>>,
250}
251
252/// A label selector requirement is a selector that contains values, a key, and an operator that
253/// relates the key and values.
254#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
255pub struct MachineDeploymentSelectorMatchExpressions {
256    /// key is the label key that the selector applies to.
257    pub key: String,
258    /// operator represents a key's relationship to a set of values.
259    /// Valid operators are In, NotIn, Exists and DoesNotExist.
260    pub operator: String,
261    /// values is an array of string values. If the operator is In or NotIn,
262    /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
263    /// the values array must be empty. This array is replaced during a strategic
264    /// merge patch.
265    #[serde(default, skip_serializing_if = "Option::is_none")]
266    pub values: Option<Vec<String>>,
267}
268
269/// template describes the machines that will be created.
270#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
271pub struct MachineDeploymentTemplate {
272    /// metadata is the standard object's metadata.
273    /// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata>
274    #[serde(default, skip_serializing_if = "Option::is_none")]
275    pub metadata: Option<MachineDeploymentTemplateMetadata>,
276    /// spec is the specification of the desired behavior of the machine.
277    /// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
278    pub spec: MachineDeploymentTemplateSpec,
279}
280
281/// metadata is the standard object's metadata.
282/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata>
283#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
284pub struct MachineDeploymentTemplateMetadata {
285    /// annotations is an unstructured key value map stored with a resource that may be
286    /// set by external tools to store and retrieve arbitrary metadata. They are not
287    /// queryable and should be preserved when modifying objects.
288    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
289    #[serde(default, skip_serializing_if = "Option::is_none")]
290    pub annotations: Option<BTreeMap<String, String>>,
291    /// labels is a map of string keys and values that can be used to organize and categorize
292    /// (scope and select) objects. May match selectors of replication controllers
293    /// and services.
294    /// More info: <http://kubernetes.io/docs/user-guide/labels>
295    #[serde(default, skip_serializing_if = "Option::is_none")]
296    pub labels: Option<BTreeMap<String, String>>,
297}
298
299/// spec is the specification of the desired behavior of the machine.
300/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
301#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
302pub struct MachineDeploymentTemplateSpec {
303    /// bootstrap is a reference to a local struct which encapsulates
304    /// fields to configure the Machine’s bootstrapping mechanism.
305    pub bootstrap: MachineDeploymentTemplateSpecBootstrap,
306    /// clusterName is the name of the Cluster this object belongs to.
307    #[serde(rename = "clusterName")]
308    pub cluster_name: String,
309    /// deletion contains configuration options for Machine deletion.
310    #[serde(default, skip_serializing_if = "Option::is_none")]
311    pub deletion: Option<MachineDeploymentTemplateSpecDeletion>,
312    /// failureDomain is the failure domain the machine will be created in.
313    /// Must match the name of a FailureDomain from the Cluster status.
314    #[serde(
315        default,
316        skip_serializing_if = "Option::is_none",
317        rename = "failureDomain"
318    )]
319    pub failure_domain: Option<String>,
320    /// infrastructureRef is a required reference to a custom resource
321    /// offered by an infrastructure provider.
322    #[serde(rename = "infrastructureRef")]
323    pub infrastructure_ref: MachineDeploymentTemplateSpecInfrastructureRef,
324    /// minReadySeconds is the minimum number of seconds for which a Machine should be ready before considering it available.
325    /// Defaults to 0 (Machine will be considered available as soon as the Machine is ready)
326    #[serde(
327        default,
328        skip_serializing_if = "Option::is_none",
329        rename = "minReadySeconds"
330    )]
331    pub min_ready_seconds: Option<i32>,
332    /// providerID is the identification ID of the machine provided by the provider.
333    /// This field must match the provider ID as seen on the node object corresponding to this machine.
334    /// This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler
335    /// with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out
336    /// machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a
337    /// generic out-of-tree provider for autoscaler, this field is required by autoscaler to be
338    /// able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver
339    /// and then a comparison is done to find out unregistered machines and are marked for delete.
340    /// This field will be set by the actuators and consumed by higher level entities like autoscaler that will
341    /// be interfacing with cluster-api as generic provider.
342    #[serde(
343        default,
344        skip_serializing_if = "Option::is_none",
345        rename = "providerID"
346    )]
347    pub provider_id: Option<String>,
348    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
349    ///
350    /// This field can be used e.g. by Cluster API control plane providers to extend the semantic of the
351    /// Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates
352    /// for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
353    ///
354    /// Another example are external controllers, e.g. responsible to install special software/hardware on the Machines;
355    /// they can include the status of those components with a new condition and add this condition to ReadinessGates.
356    ///
357    /// NOTE: In case readinessGates conditions start with the APIServer, ControllerManager, Scheduler prefix, and all those
358    /// readiness gates condition are reporting the same message, when computing the Machine's Ready condition those
359    /// readinessGates will be replaced by a single entry reporting "Control plane components: " + message.
360    /// This helps to improve readability of conditions bubbling up to the Machine's owner resource / to the Cluster).
361    #[serde(
362        default,
363        skip_serializing_if = "Option::is_none",
364        rename = "readinessGates"
365    )]
366    pub readiness_gates: Option<Vec<MachineDeploymentTemplateSpecReadinessGates>>,
367    /// version defines the desired Kubernetes version.
368    /// This field is meant to be optionally used by bootstrap providers.
369    #[serde(default, skip_serializing_if = "Option::is_none")]
370    pub version: Option<String>,
371}
372
373/// bootstrap is a reference to a local struct which encapsulates
374/// fields to configure the Machine’s bootstrapping mechanism.
375#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
376pub struct MachineDeploymentTemplateSpecBootstrap {
377    /// configRef is a reference to a bootstrap provider-specific resource
378    /// that holds configuration details. The reference is optional to
379    /// allow users/operators to specify Bootstrap.DataSecretName without
380    /// the need of a controller.
381    #[serde(default, skip_serializing_if = "Option::is_none", rename = "configRef")]
382    pub config_ref: Option<MachineDeploymentTemplateSpecBootstrapConfigRef>,
383    /// dataSecretName is the name of the secret that stores the bootstrap data script.
384    /// If nil, the Machine should remain in the Pending state.
385    #[serde(
386        default,
387        skip_serializing_if = "Option::is_none",
388        rename = "dataSecretName"
389    )]
390    pub data_secret_name: Option<String>,
391}
392
393/// configRef is a reference to a bootstrap provider-specific resource
394/// that holds configuration details. The reference is optional to
395/// allow users/operators to specify Bootstrap.DataSecretName without
396/// the need of a controller.
397#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
398pub struct MachineDeploymentTemplateSpecBootstrapConfigRef {
399    /// apiGroup is the group of the resource being referenced.
400    /// apiGroup must be fully qualified domain name.
401    /// The corresponding version for this reference will be looked up from the contract
402    /// labels of the corresponding CRD of the resource being referenced.
403    #[serde(rename = "apiGroup")]
404    pub api_group: String,
405    /// kind of the resource being referenced.
406    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
407    pub kind: String,
408    /// name of the resource being referenced.
409    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
410    pub name: String,
411}
412
413/// deletion contains configuration options for Machine deletion.
414#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
415pub struct MachineDeploymentTemplateSpecDeletion {
416    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
417    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
418    /// Defaults to 10 seconds.
419    #[serde(
420        default,
421        skip_serializing_if = "Option::is_none",
422        rename = "nodeDeletionTimeoutSeconds"
423    )]
424    pub node_deletion_timeout_seconds: Option<i32>,
425    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
426    /// The default value is 0, meaning that the node can be drained without any time limitations.
427    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
428    #[serde(
429        default,
430        skip_serializing_if = "Option::is_none",
431        rename = "nodeDrainTimeoutSeconds"
432    )]
433    pub node_drain_timeout_seconds: Option<i32>,
434    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
435    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
436    #[serde(
437        default,
438        skip_serializing_if = "Option::is_none",
439        rename = "nodeVolumeDetachTimeoutSeconds"
440    )]
441    pub node_volume_detach_timeout_seconds: Option<i32>,
442}
443
444/// infrastructureRef is a required reference to a custom resource
445/// offered by an infrastructure provider.
446#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
447pub struct MachineDeploymentTemplateSpecInfrastructureRef {
448    /// apiGroup is the group of the resource being referenced.
449    /// apiGroup must be fully qualified domain name.
450    /// The corresponding version for this reference will be looked up from the contract
451    /// labels of the corresponding CRD of the resource being referenced.
452    #[serde(rename = "apiGroup")]
453    pub api_group: String,
454    /// kind of the resource being referenced.
455    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
456    pub kind: String,
457    /// name of the resource being referenced.
458    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
459    pub name: String,
460}
461
462/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
463#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
464pub struct MachineDeploymentTemplateSpecReadinessGates {
465    /// conditionType refers to a condition with matching type in the Machine's condition list.
466    /// If the conditions doesn't exist, it will be treated as unknown.
467    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
468    #[serde(rename = "conditionType")]
469    pub condition_type: String,
470    /// polarity of the conditionType specified in this readinessGate.
471    /// Valid values are Positive, Negative and omitted.
472    /// When omitted, the default behaviour will be Positive.
473    /// A positive polarity means that the condition should report a true status under normal conditions.
474    /// A negative polarity means that the condition should report a false status under normal conditions.
475    #[serde(default, skip_serializing_if = "Option::is_none")]
476    pub polarity: Option<MachineDeploymentTemplateSpecReadinessGatesPolarity>,
477}
478
479/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
480#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
481pub enum MachineDeploymentTemplateSpecReadinessGatesPolarity {
482    Positive,
483    Negative,
484}
485
486/// status is the observed state of MachineDeployment.
487#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
488pub struct MachineDeploymentStatus {
489    /// availableReplicas is the number of available replicas for this MachineDeployment. A machine is considered available when Machine's Available condition is true.
490    #[serde(
491        default,
492        skip_serializing_if = "Option::is_none",
493        rename = "availableReplicas"
494    )]
495    pub available_replicas: Option<i32>,
496    /// conditions represents the observations of a MachineDeployment's current state.
497    /// Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused.
498    #[serde(default, skip_serializing_if = "Option::is_none")]
499    pub conditions: Option<Vec<Condition>>,
500    /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
501    #[serde(default, skip_serializing_if = "Option::is_none")]
502    pub deprecated: Option<MachineDeploymentStatusDeprecated>,
503    /// observedGeneration is the generation observed by the deployment controller.
504    #[serde(
505        default,
506        skip_serializing_if = "Option::is_none",
507        rename = "observedGeneration"
508    )]
509    pub observed_generation: Option<i64>,
510    /// phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown).
511    #[serde(default, skip_serializing_if = "Option::is_none")]
512    pub phase: Option<MachineDeploymentStatusPhase>,
513    /// readyReplicas is the number of ready replicas for this MachineDeployment. A machine is considered ready when Machine's Ready condition is true.
514    #[serde(
515        default,
516        skip_serializing_if = "Option::is_none",
517        rename = "readyReplicas"
518    )]
519    pub ready_replicas: Option<i32>,
520    /// replicas is the total number of non-terminated machines targeted by this deployment
521    /// (their labels match the selector).
522    #[serde(default, skip_serializing_if = "Option::is_none")]
523    pub replicas: Option<i32>,
524    /// selector is the same as the label selector but in the string format to avoid introspection
525    /// by clients. The string will be in the same format as the query-param syntax.
526    /// More info about label selectors: <http://kubernetes.io/docs/user-guide/labels#label-selectors>
527    #[serde(default, skip_serializing_if = "Option::is_none")]
528    pub selector: Option<String>,
529    /// upToDateReplicas is the number of up-to-date replicas targeted by this deployment. A machine is considered up-to-date when Machine's UpToDate condition is true.
530    #[serde(
531        default,
532        skip_serializing_if = "Option::is_none",
533        rename = "upToDateReplicas"
534    )]
535    pub up_to_date_replicas: Option<i32>,
536}
537
538/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
539#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
540pub struct MachineDeploymentStatusDeprecated {
541    /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
542    #[serde(default, skip_serializing_if = "Option::is_none")]
543    pub v1beta1: Option<MachineDeploymentStatusDeprecatedV1beta1>,
544}
545
546/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
547#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
548pub struct MachineDeploymentStatusDeprecatedV1beta1 {
549    /// availableReplicas is the total number of available machines (ready for at least minReadySeconds)
550    /// targeted by this deployment.
551    ///
552    /// 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.
553    #[serde(
554        default,
555        skip_serializing_if = "Option::is_none",
556        rename = "availableReplicas"
557    )]
558    pub available_replicas: Option<i32>,
559    /// conditions defines current service state of the MachineDeployment.
560    ///
561    /// 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.
562    #[serde(default, skip_serializing_if = "Option::is_none")]
563    pub conditions: Option<Vec<Condition>>,
564    /// readyReplicas is the total number of ready machines targeted by this deployment.
565    ///
566    /// 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.
567    #[serde(
568        default,
569        skip_serializing_if = "Option::is_none",
570        rename = "readyReplicas"
571    )]
572    pub ready_replicas: Option<i32>,
573    /// unavailableReplicas is the total number of unavailable machines targeted by this deployment.
574    /// This is the total number of machines that are still required for
575    /// the deployment to have 100% available capacity. They may either
576    /// be machines that are running but not yet available or machines
577    /// that still have not been created.
578    ///
579    /// 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.
580    #[serde(
581        default,
582        skip_serializing_if = "Option::is_none",
583        rename = "unavailableReplicas"
584    )]
585    pub unavailable_replicas: Option<i32>,
586    /// updatedReplicas is the total number of non-terminated machines targeted by this deployment
587    /// that have the desired template spec.
588    ///
589    /// 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.
590    #[serde(
591        default,
592        skip_serializing_if = "Option::is_none",
593        rename = "updatedReplicas"
594    )]
595    pub updated_replicas: Option<i32>,
596}
597
598/// status is the observed state of MachineDeployment.
599#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
600pub enum MachineDeploymentStatusPhase {
601    ScalingUp,
602    ScalingDown,
603    Running,
604    Failed,
605    Unknown,
606}