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