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 /// taints are the node taints that Cluster API will manage.
368 /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
369 /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
370 /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
371 ///
372 /// There can be at most 64 taints.
373 /// A pod would have to tolerate all existing taints to run on the corresponding node.
374 ///
375 /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
376 #[serde(default, skip_serializing_if = "Option::is_none")]
377 pub taints: Option<Vec<MachineDeploymentTemplateSpecTaints>>,
378 /// version defines the desired Kubernetes version.
379 /// This field is meant to be optionally used by bootstrap providers.
380 #[serde(default, skip_serializing_if = "Option::is_none")]
381 pub version: Option<String>,
382}
383
384/// bootstrap is a reference to a local struct which encapsulates
385/// fields to configure the Machine’s bootstrapping mechanism.
386#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
387pub struct MachineDeploymentTemplateSpecBootstrap {
388 /// configRef is a reference to a bootstrap provider-specific resource
389 /// that holds configuration details. The reference is optional to
390 /// allow users/operators to specify Bootstrap.DataSecretName without
391 /// the need of a controller.
392 #[serde(default, skip_serializing_if = "Option::is_none", rename = "configRef")]
393 pub config_ref: Option<MachineDeploymentTemplateSpecBootstrapConfigRef>,
394 /// dataSecretName is the name of the secret that stores the bootstrap data script.
395 /// If nil, the Machine should remain in the Pending state.
396 #[serde(
397 default,
398 skip_serializing_if = "Option::is_none",
399 rename = "dataSecretName"
400 )]
401 pub data_secret_name: Option<String>,
402}
403
404/// configRef is a reference to a bootstrap provider-specific resource
405/// that holds configuration details. The reference is optional to
406/// allow users/operators to specify Bootstrap.DataSecretName without
407/// the need of a controller.
408#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
409pub struct MachineDeploymentTemplateSpecBootstrapConfigRef {
410 /// apiGroup is the group of the resource being referenced.
411 /// apiGroup must be fully qualified domain name.
412 /// The corresponding version for this reference will be looked up from the contract
413 /// labels of the corresponding CRD of the resource being referenced.
414 #[serde(rename = "apiGroup")]
415 pub api_group: String,
416 /// kind of the resource being referenced.
417 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
418 pub kind: String,
419 /// name of the resource being referenced.
420 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
421 pub name: String,
422}
423
424/// deletion contains configuration options for Machine deletion.
425#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
426pub struct MachineDeploymentTemplateSpecDeletion {
427 /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
428 /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
429 /// Defaults to 10 seconds.
430 #[serde(
431 default,
432 skip_serializing_if = "Option::is_none",
433 rename = "nodeDeletionTimeoutSeconds"
434 )]
435 pub node_deletion_timeout_seconds: Option<i32>,
436 /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
437 /// The default value is 0, meaning that the node can be drained without any time limitations.
438 /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
439 #[serde(
440 default,
441 skip_serializing_if = "Option::is_none",
442 rename = "nodeDrainTimeoutSeconds"
443 )]
444 pub node_drain_timeout_seconds: Option<i32>,
445 /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
446 /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
447 #[serde(
448 default,
449 skip_serializing_if = "Option::is_none",
450 rename = "nodeVolumeDetachTimeoutSeconds"
451 )]
452 pub node_volume_detach_timeout_seconds: Option<i32>,
453}
454
455/// infrastructureRef is a required reference to a custom resource
456/// offered by an infrastructure provider.
457#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
458pub struct MachineDeploymentTemplateSpecInfrastructureRef {
459 /// apiGroup is the group of the resource being referenced.
460 /// apiGroup must be fully qualified domain name.
461 /// The corresponding version for this reference will be looked up from the contract
462 /// labels of the corresponding CRD of the resource being referenced.
463 #[serde(rename = "apiGroup")]
464 pub api_group: String,
465 /// kind of the resource being referenced.
466 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
467 pub kind: String,
468 /// name of the resource being referenced.
469 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
470 pub name: String,
471}
472
473/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
474#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
475pub struct MachineDeploymentTemplateSpecReadinessGates {
476 /// conditionType refers to a condition with matching type in the Machine's condition list.
477 /// If the conditions doesn't exist, it will be treated as unknown.
478 /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
479 #[serde(rename = "conditionType")]
480 pub condition_type: String,
481 /// polarity of the conditionType specified in this readinessGate.
482 /// Valid values are Positive, Negative and omitted.
483 /// When omitted, the default behaviour will be Positive.
484 /// A positive polarity means that the condition should report a true status under normal conditions.
485 /// A negative polarity means that the condition should report a false status under normal conditions.
486 #[serde(default, skip_serializing_if = "Option::is_none")]
487 pub polarity: Option<MachineDeploymentTemplateSpecReadinessGatesPolarity>,
488}
489
490/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
491#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
492pub enum MachineDeploymentTemplateSpecReadinessGatesPolarity {
493 Positive,
494 Negative,
495}
496
497/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
498#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
499pub struct MachineDeploymentTemplateSpecTaints {
500 /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
501 pub effect: MachineDeploymentTemplateSpecTaintsEffect,
502 /// key is the taint key to be applied to a node.
503 /// Must be a valid qualified name of maximum size 63 characters
504 /// with an optional subdomain prefix of maximum size 253 characters,
505 /// separated by a `/`.
506 pub key: String,
507 /// propagation defines how this taint should be propagated to nodes.
508 /// Valid values are 'Always' and 'OnInitialization'.
509 /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
510 /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
511 pub propagation: MachineDeploymentTemplateSpecTaintsPropagation,
512 /// value is the taint value corresponding to the taint key.
513 /// It must be a valid label value of maximum size 63 characters.
514 #[serde(default, skip_serializing_if = "Option::is_none")]
515 pub value: Option<String>,
516}
517
518/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
519#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
520pub enum MachineDeploymentTemplateSpecTaintsEffect {
521 NoSchedule,
522 PreferNoSchedule,
523 NoExecute,
524}
525
526/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
527#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
528pub enum MachineDeploymentTemplateSpecTaintsPropagation {
529 Always,
530 OnInitialization,
531}
532
533/// status is the observed state of MachineDeployment.
534#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
535pub struct MachineDeploymentStatus {
536 /// availableReplicas is the number of available replicas for this MachineDeployment. A machine is considered available when Machine's Available condition is true.
537 #[serde(
538 default,
539 skip_serializing_if = "Option::is_none",
540 rename = "availableReplicas"
541 )]
542 pub available_replicas: Option<i32>,
543 /// conditions represents the observations of a MachineDeployment's current state.
544 /// Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused.
545 #[serde(default, skip_serializing_if = "Option::is_none")]
546 pub conditions: Option<Vec<Condition>>,
547 /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
548 #[serde(default, skip_serializing_if = "Option::is_none")]
549 pub deprecated: Option<MachineDeploymentStatusDeprecated>,
550 /// observedGeneration is the generation observed by the deployment controller.
551 #[serde(
552 default,
553 skip_serializing_if = "Option::is_none",
554 rename = "observedGeneration"
555 )]
556 pub observed_generation: Option<i64>,
557 /// phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown).
558 #[serde(default, skip_serializing_if = "Option::is_none")]
559 pub phase: Option<MachineDeploymentStatusPhase>,
560 /// readyReplicas is the number of ready replicas for this MachineDeployment. A machine is considered ready when Machine's Ready condition is true.
561 #[serde(
562 default,
563 skip_serializing_if = "Option::is_none",
564 rename = "readyReplicas"
565 )]
566 pub ready_replicas: Option<i32>,
567 /// replicas is the total number of non-terminated machines targeted by this deployment
568 /// (their labels match the selector).
569 #[serde(default, skip_serializing_if = "Option::is_none")]
570 pub replicas: Option<i32>,
571 /// selector is the same as the label selector but in the string format to avoid introspection
572 /// by clients. The string will be in the same format as the query-param syntax.
573 /// More info about label selectors: <http://kubernetes.io/docs/user-guide/labels#label-selectors>
574 #[serde(default, skip_serializing_if = "Option::is_none")]
575 pub selector: Option<String>,
576 /// 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.
577 #[serde(
578 default,
579 skip_serializing_if = "Option::is_none",
580 rename = "upToDateReplicas"
581 )]
582 pub up_to_date_replicas: Option<i32>,
583}
584
585/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
586#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
587pub struct MachineDeploymentStatusDeprecated {
588 /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
589 #[serde(default, skip_serializing_if = "Option::is_none")]
590 pub v1beta1: Option<MachineDeploymentStatusDeprecatedV1beta1>,
591}
592
593/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
594#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
595pub struct MachineDeploymentStatusDeprecatedV1beta1 {
596 /// availableReplicas is the total number of available machines (ready for at least minReadySeconds)
597 /// targeted by this deployment.
598 ///
599 /// 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.
600 #[serde(
601 default,
602 skip_serializing_if = "Option::is_none",
603 rename = "availableReplicas"
604 )]
605 pub available_replicas: Option<i32>,
606 /// conditions defines current service state of the MachineDeployment.
607 ///
608 /// 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.
609 #[serde(default, skip_serializing_if = "Option::is_none")]
610 pub conditions: Option<Vec<Condition>>,
611 /// readyReplicas is the total number of ready machines targeted by this deployment.
612 ///
613 /// 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.
614 #[serde(
615 default,
616 skip_serializing_if = "Option::is_none",
617 rename = "readyReplicas"
618 )]
619 pub ready_replicas: Option<i32>,
620 /// unavailableReplicas is the total number of unavailable machines targeted by this deployment.
621 /// This is the total number of machines that are still required for
622 /// the deployment to have 100% available capacity. They may either
623 /// be machines that are running but not yet available or machines
624 /// that still have not been created.
625 ///
626 /// 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.
627 #[serde(
628 default,
629 skip_serializing_if = "Option::is_none",
630 rename = "unavailableReplicas"
631 )]
632 pub unavailable_replicas: Option<i32>,
633 /// updatedReplicas is the total number of non-terminated machines targeted by this deployment
634 /// that have the desired template spec.
635 ///
636 /// 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.
637 #[serde(
638 default,
639 skip_serializing_if = "Option::is_none",
640 rename = "updatedReplicas"
641 )]
642 pub updated_replicas: Option<i32>,
643}
644
645/// status is the observed state of MachineDeployment.
646#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
647pub enum MachineDeploymentStatusPhase {
648 ScalingUp,
649 ScalingDown,
650 Running,
651 Failed,
652 Unknown,
653}