cluster_api_rs/api/capi_machine.rs
1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium -D Default -D PartialEq -A -d -f -
3// kopium version: 0.21.2
4
5#[allow(unused_imports)]
6mod prelude {
7 pub use k8s_openapi::api::core::v1::ObjectReference;
8 pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
9 pub use kube::CustomResource;
10 pub use schemars::JsonSchema;
11 pub use serde::{Deserialize, Serialize};
12}
13use self::prelude::*;
14
15/// MachineSpec defines the desired state of Machine.
16#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
17#[kube(
18 group = "cluster.x-k8s.io",
19 version = "v1beta1",
20 kind = "Machine",
21 plural = "machines"
22)]
23#[kube(namespaced)]
24#[kube(status = "MachineStatus")]
25#[kube(derive = "Default")]
26#[kube(derive = "PartialEq")]
27pub struct MachineSpec {
28 /// bootstrap is a reference to a local struct which encapsulates
29 /// fields to configure the Machine’s bootstrapping mechanism.
30 pub bootstrap: MachineBootstrap,
31 /// clusterName is the name of the Cluster this object belongs to.
32 #[serde(rename = "clusterName")]
33 pub cluster_name: String,
34 /// failureDomain is the failure domain the machine will be created in.
35 /// Must match a key in the FailureDomains map stored on the cluster object.
36 #[serde(
37 default,
38 skip_serializing_if = "Option::is_none",
39 rename = "failureDomain"
40 )]
41 pub failure_domain: Option<String>,
42 /// infrastructureRef is a required reference to a custom resource
43 /// offered by an infrastructure provider.
44 #[serde(rename = "infrastructureRef")]
45 pub infrastructure_ref: ObjectReference,
46 /// nodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
47 /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
48 /// Defaults to 10 seconds.
49 #[serde(
50 default,
51 skip_serializing_if = "Option::is_none",
52 rename = "nodeDeletionTimeout"
53 )]
54 pub node_deletion_timeout: Option<String>,
55 /// nodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
56 /// The default value is 0, meaning that the node can be drained without any time limitations.
57 /// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
58 #[serde(
59 default,
60 skip_serializing_if = "Option::is_none",
61 rename = "nodeDrainTimeout"
62 )]
63 pub node_drain_timeout: Option<String>,
64 /// nodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
65 /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
66 #[serde(
67 default,
68 skip_serializing_if = "Option::is_none",
69 rename = "nodeVolumeDetachTimeout"
70 )]
71 pub node_volume_detach_timeout: Option<String>,
72 /// providerID is the identification ID of the machine provided by the provider.
73 /// This field must match the provider ID as seen on the node object corresponding to this machine.
74 /// This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler
75 /// with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out
76 /// machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a
77 /// generic out-of-tree provider for autoscaler, this field is required by autoscaler to be
78 /// able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver
79 /// and then a comparison is done to find out unregistered machines and are marked for delete.
80 /// This field will be set by the actuators and consumed by higher level entities like autoscaler that will
81 /// be interfacing with cluster-api as generic provider.
82 #[serde(
83 default,
84 skip_serializing_if = "Option::is_none",
85 rename = "providerID"
86 )]
87 pub provider_id: Option<String>,
88 /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
89 ///
90 /// This field can be used e.g. by Cluster API control plane providers to extend the semantic of the
91 /// Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates
92 /// for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
93 ///
94 /// Another example are external controllers, e.g. responsible to install special software/hardware on the Machines;
95 /// they can include the status of those components with a new condition and add this condition to ReadinessGates.
96 ///
97 /// NOTE: This field is considered only for computing v1beta2 conditions.
98 /// NOTE: In case readinessGates conditions start with the APIServer, ControllerManager, Scheduler prefix, and all those
99 /// readiness gates condition are reporting the same message, when computing the Machine's Ready condition those
100 /// readinessGates will be replaced by a single entry reporting "Control plane components: " + message.
101 /// This helps to improve readability of conditions bubbling up to the Machine's owner resource / to the Cluster).
102 #[serde(
103 default,
104 skip_serializing_if = "Option::is_none",
105 rename = "readinessGates"
106 )]
107 pub readiness_gates: Option<Vec<MachineReadinessGates>>,
108 /// version defines the desired Kubernetes version.
109 /// This field is meant to be optionally used by bootstrap providers.
110 #[serde(default, skip_serializing_if = "Option::is_none")]
111 pub version: Option<String>,
112}
113
114/// bootstrap is a reference to a local struct which encapsulates
115/// fields to configure the Machine’s bootstrapping mechanism.
116#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
117pub struct MachineBootstrap {
118 /// configRef is a reference to a bootstrap provider-specific resource
119 /// that holds configuration details. The reference is optional to
120 /// allow users/operators to specify Bootstrap.DataSecretName without
121 /// the need of a controller.
122 #[serde(default, skip_serializing_if = "Option::is_none", rename = "configRef")]
123 pub config_ref: Option<ObjectReference>,
124 /// dataSecretName is the name of the secret that stores the bootstrap data script.
125 /// If nil, the Machine should remain in the Pending state.
126 #[serde(
127 default,
128 skip_serializing_if = "Option::is_none",
129 rename = "dataSecretName"
130 )]
131 pub data_secret_name: Option<String>,
132}
133
134/// configRef is a reference to a bootstrap provider-specific resource
135/// that holds configuration details. The reference is optional to
136/// allow users/operators to specify Bootstrap.DataSecretName without
137/// the need of a controller.
138#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
139pub struct MachineBootstrapConfigRef {
140 /// API version of the referent.
141 #[serde(
142 default,
143 skip_serializing_if = "Option::is_none",
144 rename = "apiVersion"
145 )]
146 pub api_version: Option<String>,
147 /// If referring to a piece of an object instead of an entire object, this string
148 /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
149 /// For example, if the object reference is to a container within a pod, this would take on a value like:
150 /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
151 /// the event) or if no container name is specified "spec.containers[2]" (container with
152 /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
153 /// referencing a part of an object.
154 #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
155 pub field_path: Option<String>,
156 /// Kind of the referent.
157 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
158 #[serde(default, skip_serializing_if = "Option::is_none")]
159 pub kind: Option<String>,
160 /// Name of the referent.
161 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
162 #[serde(default, skip_serializing_if = "Option::is_none")]
163 pub name: Option<String>,
164 /// Namespace of the referent.
165 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
166 #[serde(default, skip_serializing_if = "Option::is_none")]
167 pub namespace: Option<String>,
168 /// Specific resourceVersion to which this reference is made, if any.
169 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
170 #[serde(
171 default,
172 skip_serializing_if = "Option::is_none",
173 rename = "resourceVersion"
174 )]
175 pub resource_version: Option<String>,
176 /// UID of the referent.
177 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
178 #[serde(default, skip_serializing_if = "Option::is_none")]
179 pub uid: Option<String>,
180}
181
182/// infrastructureRef is a required reference to a custom resource
183/// offered by an infrastructure provider.
184#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
185pub struct MachineInfrastructureRef {
186 /// API version of the referent.
187 #[serde(
188 default,
189 skip_serializing_if = "Option::is_none",
190 rename = "apiVersion"
191 )]
192 pub api_version: Option<String>,
193 /// If referring to a piece of an object instead of an entire object, this string
194 /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
195 /// For example, if the object reference is to a container within a pod, this would take on a value like:
196 /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
197 /// the event) or if no container name is specified "spec.containers[2]" (container with
198 /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
199 /// referencing a part of an object.
200 #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
201 pub field_path: Option<String>,
202 /// Kind of the referent.
203 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
204 #[serde(default, skip_serializing_if = "Option::is_none")]
205 pub kind: Option<String>,
206 /// Name of the referent.
207 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
208 #[serde(default, skip_serializing_if = "Option::is_none")]
209 pub name: Option<String>,
210 /// Namespace of the referent.
211 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
212 #[serde(default, skip_serializing_if = "Option::is_none")]
213 pub namespace: Option<String>,
214 /// Specific resourceVersion to which this reference is made, if any.
215 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
216 #[serde(
217 default,
218 skip_serializing_if = "Option::is_none",
219 rename = "resourceVersion"
220 )]
221 pub resource_version: Option<String>,
222 /// UID of the referent.
223 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
224 #[serde(default, skip_serializing_if = "Option::is_none")]
225 pub uid: Option<String>,
226}
227
228/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
229#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
230pub struct MachineReadinessGates {
231 /// conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list.
232 /// If the conditions doesn't exist, it will be treated as unknown.
233 /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
234 #[serde(rename = "conditionType")]
235 pub condition_type: String,
236}
237
238/// MachineStatus defines the observed state of Machine.
239#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
240pub struct MachineStatus {
241 /// addresses is a list of addresses assigned to the machine.
242 /// This field is copied from the infrastructure provider reference.
243 #[serde(default, skip_serializing_if = "Option::is_none")]
244 pub addresses: Option<Vec<MachineStatusAddresses>>,
245 /// bootstrapReady is the state of the bootstrap provider.
246 #[serde(
247 default,
248 skip_serializing_if = "Option::is_none",
249 rename = "bootstrapReady"
250 )]
251 pub bootstrap_ready: Option<bool>,
252 /// certificatesExpiryDate is the expiry date of the machine certificates.
253 /// This value is only set for control plane machines.
254 #[serde(
255 default,
256 skip_serializing_if = "Option::is_none",
257 rename = "certificatesExpiryDate"
258 )]
259 pub certificates_expiry_date: Option<String>,
260 /// conditions defines current service state of the Machine.
261 #[serde(default, skip_serializing_if = "Option::is_none")]
262 pub conditions: Option<Vec<Condition>>,
263 /// deletion contains information relating to removal of the Machine.
264 /// Only present when the Machine has a deletionTimestamp and drain or wait for volume detach started.
265 #[serde(default, skip_serializing_if = "Option::is_none")]
266 pub deletion: Option<MachineStatusDeletion>,
267 /// failureMessage will be set in the event that there is a terminal problem
268 /// reconciling the Machine and will contain a more verbose string suitable
269 /// for logging and human consumption.
270 ///
271 /// This field should not be set for transitive errors that a controller
272 /// faces that are expected to be fixed automatically over
273 /// time (like service outages), but instead indicate that something is
274 /// fundamentally wrong with the Machine's spec or the configuration of
275 /// the controller, and that manual intervention is required. Examples
276 /// of terminal errors would be invalid combinations of settings in the
277 /// spec, values that are unsupported by the controller, or the
278 /// responsible controller itself being critically misconfigured.
279 ///
280 /// Any transient errors that occur during the reconciliation of Machines
281 /// can be added as events to the Machine object and/or logged in the
282 /// controller's output.
283 ///
284 /// 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.
285 #[serde(
286 default,
287 skip_serializing_if = "Option::is_none",
288 rename = "failureMessage"
289 )]
290 pub failure_message: Option<String>,
291 /// failureReason will be set in the event that there is a terminal problem
292 /// reconciling the Machine and will contain a succinct value suitable
293 /// for machine interpretation.
294 ///
295 /// This field should not be set for transitive errors that a controller
296 /// faces that are expected to be fixed automatically over
297 /// time (like service outages), but instead indicate that something is
298 /// fundamentally wrong with the Machine's spec or the configuration of
299 /// the controller, and that manual intervention is required. Examples
300 /// of terminal errors would be invalid combinations of settings in the
301 /// spec, values that are unsupported by the controller, or the
302 /// responsible controller itself being critically misconfigured.
303 ///
304 /// Any transient errors that occur during the reconciliation of Machines
305 /// can be added as events to the Machine object and/or logged in the
306 /// controller's output.
307 ///
308 /// 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.
309 #[serde(
310 default,
311 skip_serializing_if = "Option::is_none",
312 rename = "failureReason"
313 )]
314 pub failure_reason: Option<String>,
315 /// infrastructureReady is the state of the infrastructure provider.
316 #[serde(
317 default,
318 skip_serializing_if = "Option::is_none",
319 rename = "infrastructureReady"
320 )]
321 pub infrastructure_ready: Option<bool>,
322 /// lastUpdated identifies when the phase of the Machine last transitioned.
323 #[serde(
324 default,
325 skip_serializing_if = "Option::is_none",
326 rename = "lastUpdated"
327 )]
328 pub last_updated: Option<String>,
329 /// nodeInfo is a set of ids/uuids to uniquely identify the node.
330 /// More info: https://kubernetes.io/docs/concepts/nodes/node/#info
331 #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodeInfo")]
332 pub node_info: Option<MachineStatusNodeInfo>,
333 /// nodeRef will point to the corresponding Node if it exists.
334 #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodeRef")]
335 pub node_ref: Option<ObjectReference>,
336 /// observedGeneration is the latest generation observed by the controller.
337 #[serde(
338 default,
339 skip_serializing_if = "Option::is_none",
340 rename = "observedGeneration"
341 )]
342 pub observed_generation: Option<i64>,
343 /// phase represents the current phase of machine actuation.
344 /// E.g. Pending, Running, Terminating, Failed etc.
345 #[serde(default, skip_serializing_if = "Option::is_none")]
346 pub phase: Option<String>,
347 /// v1beta2 groups all the fields that will be added or modified in Machine's status with the V1Beta2 version.
348 #[serde(default, skip_serializing_if = "Option::is_none")]
349 pub v1beta2: Option<MachineStatusV1beta2>,
350}
351
352/// MachineAddress contains information for the node's address.
353#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
354pub struct MachineStatusAddresses {
355 /// The machine address.
356 pub address: String,
357 /// Machine address type, one of Hostname, ExternalIP, InternalIP, ExternalDNS or InternalDNS.
358 #[serde(rename = "type")]
359 pub r#type: String,
360}
361
362/// deletion contains information relating to removal of the Machine.
363/// Only present when the Machine has a deletionTimestamp and drain or wait for volume detach started.
364#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
365pub struct MachineStatusDeletion {
366 /// nodeDrainStartTime is the time when the drain of the node started and is used to determine
367 /// if the NodeDrainTimeout is exceeded.
368 /// Only present when the Machine has a deletionTimestamp and draining the node had been started.
369 #[serde(
370 default,
371 skip_serializing_if = "Option::is_none",
372 rename = "nodeDrainStartTime"
373 )]
374 pub node_drain_start_time: Option<String>,
375 /// waitForNodeVolumeDetachStartTime is the time when waiting for volume detachment started
376 /// and is used to determine if the NodeVolumeDetachTimeout is exceeded.
377 /// Detaching volumes from nodes is usually done by CSI implementations and the current state
378 /// is observed from the node's `.Status.VolumesAttached` field.
379 /// Only present when the Machine has a deletionTimestamp and waiting for volume detachments had been started.
380 #[serde(
381 default,
382 skip_serializing_if = "Option::is_none",
383 rename = "waitForNodeVolumeDetachStartTime"
384 )]
385 pub wait_for_node_volume_detach_start_time: Option<String>,
386}
387
388/// nodeInfo is a set of ids/uuids to uniquely identify the node.
389/// More info: https://kubernetes.io/docs/concepts/nodes/node/#info
390#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
391pub struct MachineStatusNodeInfo {
392 /// The Architecture reported by the node
393 pub architecture: String,
394 /// Boot ID reported by the node.
395 #[serde(rename = "bootID")]
396 pub boot_id: String,
397 /// ContainerRuntime Version reported by the node through runtime remote API (e.g. containerd://1.4.2).
398 #[serde(rename = "containerRuntimeVersion")]
399 pub container_runtime_version: String,
400 /// Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).
401 #[serde(rename = "kernelVersion")]
402 pub kernel_version: String,
403 /// Deprecated: KubeProxy Version reported by the node.
404 #[serde(rename = "kubeProxyVersion")]
405 pub kube_proxy_version: String,
406 /// Kubelet Version reported by the node.
407 #[serde(rename = "kubeletVersion")]
408 pub kubelet_version: String,
409 /// MachineID reported by the node. For unique machine identification
410 /// in the cluster this field is preferred. Learn more from man(5)
411 /// machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html
412 #[serde(rename = "machineID")]
413 pub machine_id: String,
414 /// The Operating System reported by the node
415 #[serde(rename = "operatingSystem")]
416 pub operating_system: String,
417 /// OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).
418 #[serde(rename = "osImage")]
419 pub os_image: String,
420 /// SystemUUID reported by the node. For unique machine identification
421 /// MachineID is preferred. This field is specific to Red Hat hosts
422 /// https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid
423 #[serde(rename = "systemUUID")]
424 pub system_uuid: String,
425}
426
427/// nodeRef will point to the corresponding Node if it exists.
428#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
429pub struct MachineStatusNodeRef {
430 /// API version of the referent.
431 #[serde(
432 default,
433 skip_serializing_if = "Option::is_none",
434 rename = "apiVersion"
435 )]
436 pub api_version: Option<String>,
437 /// If referring to a piece of an object instead of an entire object, this string
438 /// should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
439 /// For example, if the object reference is to a container within a pod, this would take on a value like:
440 /// "spec.containers{name}" (where "name" refers to the name of the container that triggered
441 /// the event) or if no container name is specified "spec.containers[2]" (container with
442 /// index 2 in this pod). This syntax is chosen only to have some well-defined way of
443 /// referencing a part of an object.
444 #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
445 pub field_path: Option<String>,
446 /// Kind of the referent.
447 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
448 #[serde(default, skip_serializing_if = "Option::is_none")]
449 pub kind: Option<String>,
450 /// Name of the referent.
451 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
452 #[serde(default, skip_serializing_if = "Option::is_none")]
453 pub name: Option<String>,
454 /// Namespace of the referent.
455 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
456 #[serde(default, skip_serializing_if = "Option::is_none")]
457 pub namespace: Option<String>,
458 /// Specific resourceVersion to which this reference is made, if any.
459 /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
460 #[serde(
461 default,
462 skip_serializing_if = "Option::is_none",
463 rename = "resourceVersion"
464 )]
465 pub resource_version: Option<String>,
466 /// UID of the referent.
467 /// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
468 #[serde(default, skip_serializing_if = "Option::is_none")]
469 pub uid: Option<String>,
470}
471
472/// v1beta2 groups all the fields that will be added or modified in Machine's status with the V1Beta2 version.
473#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
474pub struct MachineStatusV1beta2 {
475 /// conditions represents the observations of a Machine's current state.
476 /// Known condition types are Available, Ready, UpToDate, BootstrapConfigReady, InfrastructureReady, NodeReady,
477 /// NodeHealthy, Deleting, Paused.
478 /// If a MachineHealthCheck is targeting this machine, also HealthCheckSucceeded, OwnerRemediated conditions are added.
479 /// Additionally control plane Machines controlled by KubeadmControlPlane will have following additional conditions:
480 /// APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy, EtcdMemberHealthy.
481 #[serde(default, skip_serializing_if = "Option::is_none")]
482 pub conditions: Option<Vec<Condition>>,
483}