cluster_api_rs/api/capi_clusterclass.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.23.0
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 ClusterClass.
18#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
19#[kube(
20 group = "cluster.x-k8s.io",
21 version = "v1beta2",
22 kind = "ClusterClass",
23 plural = "clusterclasses"
24)]
25#[kube(namespaced)]
26#[kube(status = "ClusterClassStatus")]
27#[kube(derive = "Default")]
28#[kube(derive = "PartialEq")]
29pub struct ClusterClassSpec {
30 /// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
31 ///
32 /// NOTE: If a Cluster is using this ClusterClass, and this Cluster defines a custom list of availabilityGates,
33 /// such list overrides availabilityGates defined in this field.
34 #[serde(
35 default,
36 skip_serializing_if = "Option::is_none",
37 rename = "availabilityGates"
38 )]
39 pub availability_gates: Option<Vec<ClusterClassAvailabilityGates>>,
40 /// controlPlane is a reference to a local struct that holds the details
41 /// for provisioning the Control Plane for the Cluster.
42 #[serde(rename = "controlPlane")]
43 pub control_plane: ClusterClassControlPlane,
44 /// infrastructure is a reference to a local struct that holds the details
45 /// for provisioning the infrastructure cluster for the Cluster.
46 pub infrastructure: ClusterClassInfrastructure,
47 /// kubernetesVersions is the list of Kubernetes versions that can be
48 /// used for clusters using this ClusterClass.
49 /// The list of version must be ordered from the older to the newer version, and there should be
50 /// at least one version for every minor in between the first and the last version.
51 #[serde(
52 default,
53 skip_serializing_if = "Option::is_none",
54 rename = "kubernetesVersions"
55 )]
56 pub kubernetes_versions: Option<Vec<String>>,
57 /// patches defines the patches which are applied to customize
58 /// referenced templates of a ClusterClass.
59 /// Note: Patches will be applied in the order of the array.
60 #[serde(default, skip_serializing_if = "Option::is_none")]
61 pub patches: Option<Vec<ClusterClassPatches>>,
62 /// upgrade defines the upgrade configuration for clusters using this ClusterClass.
63 #[serde(default, skip_serializing_if = "Option::is_none")]
64 pub upgrade: Option<ClusterClassUpgrade>,
65 /// variables defines the variables which can be configured
66 /// in the Cluster topology and are then used in patches.
67 #[serde(default, skip_serializing_if = "Option::is_none")]
68 pub variables: Option<Vec<ClusterClassVariables>>,
69 /// workers describes the worker nodes for the cluster.
70 /// It is a collection of node types which can be used to create
71 /// the worker nodes of the cluster.
72 #[serde(default, skip_serializing_if = "Option::is_none")]
73 pub workers: Option<ClusterClassWorkers>,
74}
75
76/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
77#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
78pub struct ClusterClassAvailabilityGates {
79 /// conditionType refers to a condition with matching type in the Cluster's condition list.
80 /// If the conditions doesn't exist, it will be treated as unknown.
81 /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates.
82 #[serde(rename = "conditionType")]
83 pub condition_type: String,
84 /// polarity of the conditionType specified in this availabilityGate.
85 /// Valid values are Positive, Negative and omitted.
86 /// When omitted, the default behaviour will be Positive.
87 /// A positive polarity means that the condition should report a true status under normal conditions.
88 /// A negative polarity means that the condition should report a false status under normal conditions.
89 #[serde(default, skip_serializing_if = "Option::is_none")]
90 pub polarity: Option<ClusterClassAvailabilityGatesPolarity>,
91}
92
93/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
94#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
95pub enum ClusterClassAvailabilityGatesPolarity {
96 Positive,
97 Negative,
98}
99
100/// controlPlane is a reference to a local struct that holds the details
101/// for provisioning the Control Plane for the Cluster.
102#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
103pub struct ClusterClassControlPlane {
104 /// deletion contains configuration options for Machine deletion.
105 #[serde(default, skip_serializing_if = "Option::is_none")]
106 pub deletion: Option<ClusterClassControlPlaneDeletion>,
107 /// healthCheck defines a MachineHealthCheck for this ControlPlaneClass.
108 /// This field is supported if and only if the ControlPlane provider template
109 /// referenced above is Machine based and supports setting replicas.
110 #[serde(
111 default,
112 skip_serializing_if = "Option::is_none",
113 rename = "healthCheck"
114 )]
115 pub health_check: Option<ClusterClassControlPlaneHealthCheck>,
116 /// machineInfrastructure defines the metadata and infrastructure information
117 /// for control plane machines.
118 ///
119 /// This field is supported if and only if the control plane provider template
120 /// referenced above is Machine based and supports setting replicas.
121 #[serde(
122 default,
123 skip_serializing_if = "Option::is_none",
124 rename = "machineInfrastructure"
125 )]
126 pub machine_infrastructure: Option<ClusterClassControlPlaneMachineInfrastructure>,
127 /// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
128 /// if the ControlPlaneTemplate referenced is machine based. If not, it is applied only to the
129 /// ControlPlane.
130 /// At runtime this metadata is merged with the corresponding metadata from the topology.
131 ///
132 /// This field is supported if and only if the control plane provider template
133 /// referenced is Machine based.
134 #[serde(default, skip_serializing_if = "Option::is_none")]
135 pub metadata: Option<ClusterClassControlPlaneMetadata>,
136 /// naming allows changing the naming pattern used when creating the control plane provider object.
137 #[serde(default, skip_serializing_if = "Option::is_none")]
138 pub naming: Option<ClusterClassControlPlaneNaming>,
139 /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
140 ///
141 /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
142 /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
143 ///
144 /// NOTE: If a Cluster defines a custom list of readinessGates for the control plane,
145 /// such list overrides readinessGates defined in this field.
146 /// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
147 /// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
148 #[serde(
149 default,
150 skip_serializing_if = "Option::is_none",
151 rename = "readinessGates"
152 )]
153 pub readiness_gates: Option<Vec<ClusterClassControlPlaneReadinessGates>>,
154 /// taints are the node taints that Cluster API will manage.
155 /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
156 /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
157 /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
158 ///
159 /// There can be at most 64 taints.
160 /// A pod would have to tolerate all existing taints to run on the corresponding node.
161 ///
162 /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
163 #[serde(default, skip_serializing_if = "Option::is_none")]
164 pub taints: Option<Vec<ClusterClassControlPlaneTaints>>,
165 /// templateRef contains the reference to a provider-specific control plane template.
166 #[serde(rename = "templateRef")]
167 pub template_ref: ClusterClassControlPlaneTemplateRef,
168}
169
170/// deletion contains configuration options for Machine deletion.
171#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
172pub struct ClusterClassControlPlaneDeletion {
173 /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
174 /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
175 /// Defaults to 10 seconds.
176 /// NOTE: This value can be overridden while defining a Cluster.Topology.
177 #[serde(
178 default,
179 skip_serializing_if = "Option::is_none",
180 rename = "nodeDeletionTimeoutSeconds"
181 )]
182 pub node_deletion_timeout_seconds: Option<i32>,
183 /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
184 /// The default value is 0, meaning that the node can be drained without any time limitations.
185 /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
186 /// NOTE: This value can be overridden while defining a Cluster.Topology.
187 #[serde(
188 default,
189 skip_serializing_if = "Option::is_none",
190 rename = "nodeDrainTimeoutSeconds"
191 )]
192 pub node_drain_timeout_seconds: Option<i32>,
193 /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
194 /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
195 /// NOTE: This value can be overridden while defining a Cluster.Topology.
196 #[serde(
197 default,
198 skip_serializing_if = "Option::is_none",
199 rename = "nodeVolumeDetachTimeoutSeconds"
200 )]
201 pub node_volume_detach_timeout_seconds: Option<i32>,
202}
203
204/// healthCheck defines a MachineHealthCheck for this ControlPlaneClass.
205/// This field is supported if and only if the ControlPlane provider template
206/// referenced above is Machine based and supports setting replicas.
207#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
208pub struct ClusterClassControlPlaneHealthCheck {
209 /// checks are the checks that are used to evaluate if a Machine is healthy.
210 ///
211 /// Independent of this configuration the MachineHealthCheck controller will always
212 /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
213 /// Machines with deleted Nodes as unhealthy.
214 ///
215 /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
216 /// is defaulted to 10 minutes and evaluated accordingly.
217 #[serde(default, skip_serializing_if = "Option::is_none")]
218 pub checks: Option<ClusterClassControlPlaneHealthCheckChecks>,
219 /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
220 ///
221 /// If remediation or remediation.triggerIf is not set,
222 /// remediation will always be triggered for unhealthy Machines.
223 ///
224 /// If remediation or remediation.templateRef is not set,
225 /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
226 /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
227 #[serde(default, skip_serializing_if = "Option::is_none")]
228 pub remediation: Option<ClusterClassControlPlaneHealthCheckRemediation>,
229}
230
231/// checks are the checks that are used to evaluate if a Machine is healthy.
232///
233/// Independent of this configuration the MachineHealthCheck controller will always
234/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
235/// Machines with deleted Nodes as unhealthy.
236///
237/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
238/// is defaulted to 10 minutes and evaluated accordingly.
239#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
240pub struct ClusterClassControlPlaneHealthCheckChecks {
241 /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
242 /// to consider a Machine unhealthy if a corresponding Node isn't associated
243 /// through a `Spec.ProviderID` field.
244 ///
245 /// The duration set in this field is compared to the greatest of:
246 /// - Cluster's infrastructure ready condition timestamp (if and when available)
247 /// - Control Plane's initialized condition timestamp (if and when available)
248 /// - Machine's infrastructure ready condition timestamp (if and when available)
249 /// - Machine's metadata creation timestamp
250 ///
251 /// Defaults to 10 minutes.
252 /// If you wish to disable this feature, set the value explicitly to 0.
253 #[serde(
254 default,
255 skip_serializing_if = "Option::is_none",
256 rename = "nodeStartupTimeoutSeconds"
257 )]
258 pub node_startup_timeout_seconds: Option<i32>,
259 /// unhealthyMachineConditions contains a list of the machine conditions that determine
260 /// whether a machine is considered unhealthy. The conditions are combined in a
261 /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
262 #[serde(
263 default,
264 skip_serializing_if = "Option::is_none",
265 rename = "unhealthyMachineConditions"
266 )]
267 pub unhealthy_machine_conditions:
268 Option<Vec<ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditions>>,
269 /// unhealthyNodeConditions contains a list of conditions that determine
270 /// whether a node is considered unhealthy. The conditions are combined in a
271 /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
272 #[serde(
273 default,
274 skip_serializing_if = "Option::is_none",
275 rename = "unhealthyNodeConditions"
276 )]
277 pub unhealthy_node_conditions:
278 Option<Vec<ClusterClassControlPlaneHealthCheckChecksUnhealthyNodeConditions>>,
279}
280
281/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
282/// specified as a duration. When the named condition has been in the given
283/// status for at least the timeout value, a machine is considered unhealthy.
284#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
285pub struct ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditions {
286 /// status of the condition, one of True, False, Unknown.
287 pub status: ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus,
288 /// timeoutSeconds is the duration that a machine must be in a given status for,
289 /// after which the machine is considered unhealthy.
290 /// For example, with a value of "3600", the machine must match the status
291 /// for at least 1 hour before being considered unhealthy.
292 #[serde(rename = "timeoutSeconds")]
293 pub timeout_seconds: i32,
294 /// type of Machine condition
295 #[serde(rename = "type")]
296 pub r#type: String,
297}
298
299/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
300/// specified as a duration. When the named condition has been in the given
301/// status for at least the timeout value, a machine is considered unhealthy.
302#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
303pub enum ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus {
304 True,
305 False,
306 Unknown,
307}
308
309/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
310/// specified as a duration. When the named condition has been in the given
311/// status for at least the timeout value, a node is considered unhealthy.
312#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
313pub struct ClusterClassControlPlaneHealthCheckChecksUnhealthyNodeConditions {
314 /// status of the condition, one of True, False, Unknown.
315 pub status: String,
316 /// timeoutSeconds is the duration that a node must be in a given status for,
317 /// after which the node is considered unhealthy.
318 /// For example, with a value of "3600", the node must match the status
319 /// for at least 1 hour before being considered unhealthy.
320 #[serde(rename = "timeoutSeconds")]
321 pub timeout_seconds: i32,
322 /// type of Node condition
323 #[serde(rename = "type")]
324 pub r#type: String,
325}
326
327/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
328///
329/// If remediation or remediation.triggerIf is not set,
330/// remediation will always be triggered for unhealthy Machines.
331///
332/// If remediation or remediation.templateRef is not set,
333/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
334/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
335#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
336pub struct ClusterClassControlPlaneHealthCheckRemediation {
337 /// templateRef is a reference to a remediation template
338 /// provided by an infrastructure provider.
339 ///
340 /// This field is completely optional, when filled, the MachineHealthCheck controller
341 /// creates a new object from the template referenced and hands off remediation of the machine to
342 /// a controller that lives outside of Cluster API.
343 #[serde(
344 default,
345 skip_serializing_if = "Option::is_none",
346 rename = "templateRef"
347 )]
348 pub template_ref: Option<ClusterClassControlPlaneHealthCheckRemediationTemplateRef>,
349 /// triggerIf configures if remediations are triggered.
350 /// If this field is not set, remediations are always triggered.
351 #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
352 pub trigger_if: Option<ClusterClassControlPlaneHealthCheckRemediationTriggerIf>,
353}
354
355/// templateRef is a reference to a remediation template
356/// provided by an infrastructure provider.
357///
358/// This field is completely optional, when filled, the MachineHealthCheck controller
359/// creates a new object from the template referenced and hands off remediation of the machine to
360/// a controller that lives outside of Cluster API.
361#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
362pub struct ClusterClassControlPlaneHealthCheckRemediationTemplateRef {
363 /// apiVersion of the remediation template.
364 /// apiVersion must be fully qualified domain name followed by / and a version.
365 /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
366 #[serde(rename = "apiVersion")]
367 pub api_version: String,
368 /// kind of the remediation template.
369 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
370 pub kind: String,
371 /// name of the remediation template.
372 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
373 pub name: String,
374}
375
376/// triggerIf configures if remediations are triggered.
377/// If this field is not set, remediations are always triggered.
378#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
379pub struct ClusterClassControlPlaneHealthCheckRemediationTriggerIf {
380 /// unhealthyInRange specifies that remediations are only triggered if the number of
381 /// unhealthy Machines is in the configured range.
382 /// Takes precedence over unhealthyLessThanOrEqualTo.
383 /// Eg. "[3-5]" - This means that remediation will be allowed only when:
384 /// (a) there are at least 3 unhealthy Machines (and)
385 /// (b) there are at most 5 unhealthy Machines
386 #[serde(
387 default,
388 skip_serializing_if = "Option::is_none",
389 rename = "unhealthyInRange"
390 )]
391 pub unhealthy_in_range: Option<String>,
392 /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
393 /// unhealthy Machines is less than or equal to the configured value.
394 /// unhealthyInRange takes precedence if set.
395 #[serde(
396 default,
397 skip_serializing_if = "Option::is_none",
398 rename = "unhealthyLessThanOrEqualTo"
399 )]
400 pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
401}
402
403/// machineInfrastructure defines the metadata and infrastructure information
404/// for control plane machines.
405///
406/// This field is supported if and only if the control plane provider template
407/// referenced above is Machine based and supports setting replicas.
408#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
409pub struct ClusterClassControlPlaneMachineInfrastructure {
410 /// templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane.
411 #[serde(rename = "templateRef")]
412 pub template_ref: ClusterClassControlPlaneMachineInfrastructureTemplateRef,
413}
414
415/// templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane.
416#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
417pub struct ClusterClassControlPlaneMachineInfrastructureTemplateRef {
418 /// apiVersion of the template.
419 /// apiVersion must be fully qualified domain name followed by / and a version.
420 #[serde(rename = "apiVersion")]
421 pub api_version: String,
422 /// kind of the template.
423 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
424 pub kind: String,
425 /// name of the template.
426 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
427 pub name: String,
428}
429
430/// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
431/// if the ControlPlaneTemplate referenced is machine based. If not, it is applied only to the
432/// ControlPlane.
433/// At runtime this metadata is merged with the corresponding metadata from the topology.
434///
435/// This field is supported if and only if the control plane provider template
436/// referenced is Machine based.
437#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
438pub struct ClusterClassControlPlaneMetadata {
439 /// annotations is an unstructured key value map stored with a resource that may be
440 /// set by external tools to store and retrieve arbitrary metadata. They are not
441 /// queryable and should be preserved when modifying objects.
442 /// More info: <http://kubernetes.io/docs/user-guide/annotations>
443 #[serde(default, skip_serializing_if = "Option::is_none")]
444 pub annotations: Option<BTreeMap<String, String>>,
445 /// labels is a map of string keys and values that can be used to organize and categorize
446 /// (scope and select) objects. May match selectors of replication controllers
447 /// and services.
448 /// More info: <http://kubernetes.io/docs/user-guide/labels>
449 #[serde(default, skip_serializing_if = "Option::is_none")]
450 pub labels: Option<BTreeMap<String, String>>,
451}
452
453/// naming allows changing the naming pattern used when creating the control plane provider object.
454#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
455pub struct ClusterClassControlPlaneNaming {
456 /// template defines the template to use for generating the name of the ControlPlane object.
457 /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`.
458 /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
459 /// get concatenated with a random suffix of length 5.
460 /// The templating mechanism provides the following arguments:
461 /// * `.cluster.name`: The name of the cluster object.
462 /// * `.random`: A random alphanumeric string, without vowels, of length 5.
463 #[serde(default, skip_serializing_if = "Option::is_none")]
464 pub template: Option<String>,
465}
466
467/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
468#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
469pub struct ClusterClassControlPlaneReadinessGates {
470 /// conditionType refers to a condition with matching type in the Machine's condition list.
471 /// If the conditions doesn't exist, it will be treated as unknown.
472 /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
473 #[serde(rename = "conditionType")]
474 pub condition_type: String,
475 /// polarity of the conditionType specified in this readinessGate.
476 /// Valid values are Positive, Negative and omitted.
477 /// When omitted, the default behaviour will be Positive.
478 /// A positive polarity means that the condition should report a true status under normal conditions.
479 /// A negative polarity means that the condition should report a false status under normal conditions.
480 #[serde(default, skip_serializing_if = "Option::is_none")]
481 pub polarity: Option<ClusterClassControlPlaneReadinessGatesPolarity>,
482}
483
484/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
485#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
486pub enum ClusterClassControlPlaneReadinessGatesPolarity {
487 Positive,
488 Negative,
489}
490
491/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
492#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
493pub struct ClusterClassControlPlaneTaints {
494 /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
495 pub effect: ClusterClassControlPlaneTaintsEffect,
496 /// key is the taint key to be applied to a node.
497 /// Must be a valid qualified name of maximum size 63 characters
498 /// with an optional subdomain prefix of maximum size 253 characters,
499 /// separated by a `/`.
500 pub key: String,
501 /// propagation defines how this taint should be propagated to nodes.
502 /// Valid values are 'Always' and 'OnInitialization'.
503 /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
504 /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
505 pub propagation: ClusterClassControlPlaneTaintsPropagation,
506 /// value is the taint value corresponding to the taint key.
507 /// It must be a valid label value of maximum size 63 characters.
508 #[serde(default, skip_serializing_if = "Option::is_none")]
509 pub value: Option<String>,
510}
511
512/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
513#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
514pub enum ClusterClassControlPlaneTaintsEffect {
515 NoSchedule,
516 PreferNoSchedule,
517 NoExecute,
518}
519
520/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
521#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
522pub enum ClusterClassControlPlaneTaintsPropagation {
523 Always,
524 OnInitialization,
525}
526
527/// templateRef contains the reference to a provider-specific control plane template.
528#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
529pub struct ClusterClassControlPlaneTemplateRef {
530 /// apiVersion of the template.
531 /// apiVersion must be fully qualified domain name followed by / and a version.
532 #[serde(rename = "apiVersion")]
533 pub api_version: String,
534 /// kind of the template.
535 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
536 pub kind: String,
537 /// name of the template.
538 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
539 pub name: String,
540}
541
542/// infrastructure is a reference to a local struct that holds the details
543/// for provisioning the infrastructure cluster for the Cluster.
544#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
545pub struct ClusterClassInfrastructure {
546 /// naming allows changing the naming pattern used when creating the infrastructure cluster object.
547 #[serde(default, skip_serializing_if = "Option::is_none")]
548 pub naming: Option<ClusterClassInfrastructureNaming>,
549 /// templateRef contains the reference to a provider-specific infrastructure cluster template.
550 #[serde(rename = "templateRef")]
551 pub template_ref: ClusterClassInfrastructureTemplateRef,
552}
553
554/// naming allows changing the naming pattern used when creating the infrastructure cluster object.
555#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
556pub struct ClusterClassInfrastructureNaming {
557 /// template defines the template to use for generating the name of the Infrastructure object.
558 /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`.
559 /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
560 /// get concatenated with a random suffix of length 5.
561 /// The templating mechanism provides the following arguments:
562 /// * `.cluster.name`: The name of the cluster object.
563 /// * `.random`: A random alphanumeric string, without vowels, of length 5.
564 #[serde(default, skip_serializing_if = "Option::is_none")]
565 pub template: Option<String>,
566}
567
568/// templateRef contains the reference to a provider-specific infrastructure cluster template.
569#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
570pub struct ClusterClassInfrastructureTemplateRef {
571 /// apiVersion of the template.
572 /// apiVersion must be fully qualified domain name followed by / and a version.
573 #[serde(rename = "apiVersion")]
574 pub api_version: String,
575 /// kind of the template.
576 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
577 pub kind: String,
578 /// name of the template.
579 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
580 pub name: String,
581}
582
583/// ClusterClassPatch defines a patch which is applied to customize the referenced templates.
584#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
585pub struct ClusterClassPatches {
586 /// definitions define inline patches.
587 /// Note: Patches will be applied in the order of the array.
588 /// Note: Exactly one of Definitions or External must be set.
589 #[serde(default, skip_serializing_if = "Option::is_none")]
590 pub definitions: Option<Vec<ClusterClassPatchesDefinitions>>,
591 /// description is a human-readable description of this patch.
592 #[serde(default, skip_serializing_if = "Option::is_none")]
593 pub description: Option<String>,
594 /// enabledIf is a Go template to be used to calculate if a patch should be enabled.
595 /// It can reference variables defined in .spec.variables and builtin variables.
596 /// The patch will be enabled if the template evaluates to `true`, otherwise it will
597 /// be disabled.
598 /// If EnabledIf is not set, the patch will be enabled per default.
599 #[serde(default, skip_serializing_if = "Option::is_none", rename = "enabledIf")]
600 pub enabled_if: Option<String>,
601 /// external defines an external patch.
602 /// Note: Exactly one of Definitions or External must be set.
603 #[serde(default, skip_serializing_if = "Option::is_none")]
604 pub external: Option<ClusterClassPatchesExternal>,
605 /// name of the patch.
606 pub name: String,
607}
608
609/// PatchDefinition defines a patch which is applied to customize the referenced templates.
610#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
611pub struct ClusterClassPatchesDefinitions {
612 /// jsonPatches defines the patches which should be applied on the templates
613 /// matching the selector.
614 /// Note: Patches will be applied in the order of the array.
615 #[serde(rename = "jsonPatches")]
616 pub json_patches: Vec<ClusterClassPatchesDefinitionsJsonPatches>,
617 /// selector defines on which templates the patch should be applied.
618 pub selector: ClusterClassPatchesDefinitionsSelector,
619}
620
621/// JSONPatch defines a JSON patch.
622#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
623pub struct ClusterClassPatchesDefinitionsJsonPatches {
624 /// op defines the operation of the patch.
625 /// Note: Only `add`, `replace` and `remove` are supported.
626 pub op: ClusterClassPatchesDefinitionsJsonPatchesOp,
627 /// path defines the path of the patch.
628 /// Note: Only the spec of a template can be patched, thus the path has to start with /spec/.
629 /// Note: For now the only allowed array modifications are `append` and `prepend`, i.e.:
630 /// * for op: `add`: only index 0 (prepend) and - (append) are allowed
631 /// * for op: `replace` or `remove`: no indexes are allowed
632 pub path: String,
633 /// value defines the value of the patch.
634 /// Note: Either Value or ValueFrom is required for add and replace
635 /// operations. Only one of them is allowed to be set at the same time.
636 /// Note: We have to use apiextensionsv1.JSON instead of our JSON type,
637 /// because controller-tools has a hard-coded schema for apiextensionsv1.JSON
638 /// which cannot be produced by another type (unset type field).
639 /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
640 #[serde(default, skip_serializing_if = "Option::is_none")]
641 pub value: Option<serde_json::Value>,
642 /// valueFrom defines the value of the patch.
643 /// Note: Either Value or ValueFrom is required for add and replace
644 /// operations. Only one of them is allowed to be set at the same time.
645 #[serde(default, skip_serializing_if = "Option::is_none", rename = "valueFrom")]
646 pub value_from: Option<ClusterClassPatchesDefinitionsJsonPatchesValueFrom>,
647}
648
649/// JSONPatch defines a JSON patch.
650#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
651pub enum ClusterClassPatchesDefinitionsJsonPatchesOp {
652 #[serde(rename = "add")]
653 Add,
654 #[serde(rename = "replace")]
655 Replace,
656 #[serde(rename = "remove")]
657 Remove,
658}
659
660/// valueFrom defines the value of the patch.
661/// Note: Either Value or ValueFrom is required for add and replace
662/// operations. Only one of them is allowed to be set at the same time.
663#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
664pub struct ClusterClassPatchesDefinitionsJsonPatchesValueFrom {
665 /// template is the Go template to be used to calculate the value.
666 /// A template can reference variables defined in .spec.variables and builtin variables.
667 /// Note: The template must evaluate to a valid YAML or JSON value.
668 #[serde(default, skip_serializing_if = "Option::is_none")]
669 pub template: Option<String>,
670 /// variable is the variable to be used as value.
671 /// Variable can be one of the variables defined in .spec.variables or a builtin variable.
672 #[serde(default, skip_serializing_if = "Option::is_none")]
673 pub variable: Option<String>,
674}
675
676/// selector defines on which templates the patch should be applied.
677#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
678pub struct ClusterClassPatchesDefinitionsSelector {
679 /// apiVersion filters templates by apiVersion.
680 /// apiVersion must be fully qualified domain name followed by / and a version.
681 #[serde(rename = "apiVersion")]
682 pub api_version: String,
683 /// kind filters templates by kind.
684 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
685 pub kind: String,
686 /// matchResources selects templates based on where they are referenced.
687 #[serde(rename = "matchResources")]
688 pub match_resources: ClusterClassPatchesDefinitionsSelectorMatchResources,
689}
690
691/// matchResources selects templates based on where they are referenced.
692#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
693pub struct ClusterClassPatchesDefinitionsSelectorMatchResources {
694 /// controlPlane selects templates referenced in .spec.ControlPlane.
695 /// Note: this will match the controlPlane and also the controlPlane
696 /// machineInfrastructure (depending on the kind and apiVersion).
697 #[serde(
698 default,
699 skip_serializing_if = "Option::is_none",
700 rename = "controlPlane"
701 )]
702 pub control_plane: Option<bool>,
703 /// infrastructureCluster selects templates referenced in .spec.infrastructure.
704 #[serde(
705 default,
706 skip_serializing_if = "Option::is_none",
707 rename = "infrastructureCluster"
708 )]
709 pub infrastructure_cluster: Option<bool>,
710 /// machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in
711 /// .spec.workers.machineDeployments.
712 #[serde(
713 default,
714 skip_serializing_if = "Option::is_none",
715 rename = "machineDeploymentClass"
716 )]
717 pub machine_deployment_class:
718 Option<ClusterClassPatchesDefinitionsSelectorMatchResourcesMachineDeploymentClass>,
719 /// machinePoolClass selects templates referenced in specific MachinePoolClasses in
720 /// .spec.workers.machinePools.
721 #[serde(
722 default,
723 skip_serializing_if = "Option::is_none",
724 rename = "machinePoolClass"
725 )]
726 pub machine_pool_class:
727 Option<ClusterClassPatchesDefinitionsSelectorMatchResourcesMachinePoolClass>,
728}
729
730/// machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in
731/// .spec.workers.machineDeployments.
732#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
733pub struct ClusterClassPatchesDefinitionsSelectorMatchResourcesMachineDeploymentClass {
734 /// names selects templates by class names.
735 #[serde(default, skip_serializing_if = "Option::is_none")]
736 pub names: Option<Vec<String>>,
737}
738
739/// machinePoolClass selects templates referenced in specific MachinePoolClasses in
740/// .spec.workers.machinePools.
741#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
742pub struct ClusterClassPatchesDefinitionsSelectorMatchResourcesMachinePoolClass {
743 /// names selects templates by class names.
744 #[serde(default, skip_serializing_if = "Option::is_none")]
745 pub names: Option<Vec<String>>,
746}
747
748/// external defines an external patch.
749/// Note: Exactly one of Definitions or External must be set.
750#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
751pub struct ClusterClassPatchesExternal {
752 /// discoverVariablesExtension references an extension which is called to discover variables.
753 #[serde(
754 default,
755 skip_serializing_if = "Option::is_none",
756 rename = "discoverVariablesExtension"
757 )]
758 pub discover_variables_extension: Option<String>,
759 /// generatePatchesExtension references an extension which is called to generate patches.
760 #[serde(
761 default,
762 skip_serializing_if = "Option::is_none",
763 rename = "generatePatchesExtension"
764 )]
765 pub generate_patches_extension: Option<String>,
766 /// settings defines key value pairs to be passed to the extensions.
767 /// Values defined here take precedence over the values defined in the
768 /// corresponding ExtensionConfig.
769 #[serde(default, skip_serializing_if = "Option::is_none")]
770 pub settings: Option<BTreeMap<String, String>>,
771 /// validateTopologyExtension references an extension which is called to validate the topology.
772 #[serde(
773 default,
774 skip_serializing_if = "Option::is_none",
775 rename = "validateTopologyExtension"
776 )]
777 pub validate_topology_extension: Option<String>,
778}
779
780/// upgrade defines the upgrade configuration for clusters using this ClusterClass.
781#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
782pub struct ClusterClassUpgrade {
783 /// external defines external runtime extensions for upgrade operations.
784 #[serde(default, skip_serializing_if = "Option::is_none")]
785 pub external: Option<ClusterClassUpgradeExternal>,
786}
787
788/// external defines external runtime extensions for upgrade operations.
789#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
790pub struct ClusterClassUpgradeExternal {
791 /// generateUpgradePlanExtension references an extension which is called to generate upgrade plan.
792 #[serde(
793 default,
794 skip_serializing_if = "Option::is_none",
795 rename = "generateUpgradePlanExtension"
796 )]
797 pub generate_upgrade_plan_extension: Option<String>,
798}
799
800/// ClusterClassVariable defines a variable which can
801/// be configured in the Cluster topology and used in patches.
802#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
803pub struct ClusterClassVariables {
804 /// deprecatedV1Beta1Metadata is the metadata of a variable.
805 /// It can be used to add additional data for higher level tools to
806 /// a ClusterClassVariable.
807 ///
808 /// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
809 #[serde(
810 default,
811 skip_serializing_if = "Option::is_none",
812 rename = "deprecatedV1Beta1Metadata"
813 )]
814 pub deprecated_v1_beta1_metadata: Option<ClusterClassVariablesDeprecatedV1Beta1Metadata>,
815 /// name of the variable.
816 pub name: String,
817 /// required specifies if the variable is required.
818 /// Note: this applies to the variable as a whole and thus the
819 /// top-level object defined in the schema. If nested fields are
820 /// required, this will be specified inside the schema.
821 pub required: bool,
822 /// schema defines the schema of the variable.
823 pub schema: ClusterClassVariablesSchema,
824}
825
826/// deprecatedV1Beta1Metadata is the metadata of a variable.
827/// It can be used to add additional data for higher level tools to
828/// a ClusterClassVariable.
829///
830/// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
831#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
832pub struct ClusterClassVariablesDeprecatedV1Beta1Metadata {
833 /// annotations is an unstructured key value map that can be used to store and
834 /// retrieve arbitrary metadata.
835 /// They are not queryable.
836 #[serde(default, skip_serializing_if = "Option::is_none")]
837 pub annotations: Option<BTreeMap<String, String>>,
838 /// labels is a map of string keys and values that can be used to organize and categorize
839 /// (scope and select) variables.
840 #[serde(default, skip_serializing_if = "Option::is_none")]
841 pub labels: Option<BTreeMap<String, String>>,
842}
843
844/// schema defines the schema of the variable.
845#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
846pub struct ClusterClassVariablesSchema {
847 /// openAPIV3Schema defines the schema of a variable via OpenAPI v3
848 /// schema. The schema is a subset of the schema used in
849 /// Kubernetes CRDs.
850 #[serde(rename = "openAPIV3Schema")]
851 pub open_apiv3_schema: ClusterClassVariablesSchemaOpenApiv3Schema,
852}
853
854/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
855/// schema. The schema is a subset of the schema used in
856/// Kubernetes CRDs.
857#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
858pub struct ClusterClassVariablesSchemaOpenApiv3Schema {
859 /// additionalProperties specifies the schema of values in a map (keys are always strings).
860 /// NOTE: Can only be set if type is object.
861 /// NOTE: AdditionalProperties is mutually exclusive with Properties.
862 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
863 /// because recursive validation is not possible.
864 #[serde(
865 default,
866 skip_serializing_if = "Option::is_none",
867 rename = "additionalProperties"
868 )]
869 pub additional_properties: Option<serde_json::Value>,
870 /// allOf specifies that the variable must validate against all of the subschemas in the array.
871 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
872 /// because recursive validation is not possible.
873 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allOf")]
874 pub all_of: Option<serde_json::Value>,
875 /// anyOf specifies that the variable must validate against one or more of the subschemas in the array.
876 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
877 /// because recursive validation is not possible.
878 #[serde(default, skip_serializing_if = "Option::is_none", rename = "anyOf")]
879 pub any_of: Option<serde_json::Value>,
880 /// default is the default value of the variable.
881 /// NOTE: Can be set for all types.
882 #[serde(default, skip_serializing_if = "Option::is_none")]
883 pub default: Option<serde_json::Value>,
884 /// description is a human-readable description of this variable.
885 #[serde(default, skip_serializing_if = "Option::is_none")]
886 pub description: Option<String>,
887 /// enum is the list of valid values of the variable.
888 /// NOTE: Can be set for all types.
889 #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")]
890 pub r#enum: Option<Vec<serde_json::Value>>,
891 /// example is an example for this variable.
892 #[serde(default, skip_serializing_if = "Option::is_none")]
893 pub example: Option<serde_json::Value>,
894 /// exclusiveMaximum specifies if the Maximum is exclusive.
895 /// NOTE: Can only be set if type is integer or number.
896 #[serde(
897 default,
898 skip_serializing_if = "Option::is_none",
899 rename = "exclusiveMaximum"
900 )]
901 pub exclusive_maximum: Option<bool>,
902 /// exclusiveMinimum specifies if the Minimum is exclusive.
903 /// NOTE: Can only be set if type is integer or number.
904 #[serde(
905 default,
906 skip_serializing_if = "Option::is_none",
907 rename = "exclusiveMinimum"
908 )]
909 pub exclusive_minimum: Option<bool>,
910 /// format is an OpenAPI v3 format string. Unknown formats are ignored.
911 /// For a list of supported formats please see: (of the k8s.io/apiextensions-apiserver version we're currently using)
912 /// <https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go>
913 /// NOTE: Can only be set if type is string.
914 #[serde(default, skip_serializing_if = "Option::is_none")]
915 pub format: Option<String>,
916 /// items specifies fields of an array.
917 /// NOTE: Can only be set if type is array.
918 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
919 /// because recursive validation is not possible.
920 #[serde(default, skip_serializing_if = "Option::is_none")]
921 pub items: Option<serde_json::Value>,
922 /// maxItems is the max length of an array variable.
923 /// NOTE: Can only be set if type is array.
924 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")]
925 pub max_items: Option<i64>,
926 /// maxLength is the max length of a string variable.
927 /// NOTE: Can only be set if type is string.
928 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")]
929 pub max_length: Option<i64>,
930 /// maxProperties is the maximum amount of entries in a map or properties in an object.
931 /// NOTE: Can only be set if type is object.
932 #[serde(
933 default,
934 skip_serializing_if = "Option::is_none",
935 rename = "maxProperties"
936 )]
937 pub max_properties: Option<i64>,
938 /// maximum is the maximum of an integer or number variable.
939 /// If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum.
940 /// If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum.
941 /// NOTE: Can only be set if type is integer or number.
942 #[serde(default, skip_serializing_if = "Option::is_none")]
943 pub maximum: Option<i64>,
944 /// minItems is the min length of an array variable.
945 /// NOTE: Can only be set if type is array.
946 #[serde(default, skip_serializing_if = "Option::is_none", rename = "minItems")]
947 pub min_items: Option<i64>,
948 /// minLength is the min length of a string variable.
949 /// NOTE: Can only be set if type is string.
950 #[serde(default, skip_serializing_if = "Option::is_none", rename = "minLength")]
951 pub min_length: Option<i64>,
952 /// minProperties is the minimum amount of entries in a map or properties in an object.
953 /// NOTE: Can only be set if type is object.
954 #[serde(
955 default,
956 skip_serializing_if = "Option::is_none",
957 rename = "minProperties"
958 )]
959 pub min_properties: Option<i64>,
960 /// minimum is the minimum of an integer or number variable.
961 /// If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum.
962 /// If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum.
963 /// NOTE: Can only be set if type is integer or number.
964 #[serde(default, skip_serializing_if = "Option::is_none")]
965 pub minimum: Option<i64>,
966 /// not specifies that the variable must not validate against the subschema.
967 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
968 /// because recursive validation is not possible.
969 #[serde(default, skip_serializing_if = "Option::is_none")]
970 pub not: Option<serde_json::Value>,
971 /// oneOf specifies that the variable must validate against exactly one of the subschemas in the array.
972 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
973 /// because recursive validation is not possible.
974 #[serde(default, skip_serializing_if = "Option::is_none", rename = "oneOf")]
975 pub one_of: Option<serde_json::Value>,
976 /// pattern is the regex which a string variable must match.
977 /// NOTE: Can only be set if type is string.
978 #[serde(default, skip_serializing_if = "Option::is_none")]
979 pub pattern: Option<String>,
980 /// properties specifies fields of an object.
981 /// NOTE: Can only be set if type is object.
982 /// NOTE: Properties is mutually exclusive with AdditionalProperties.
983 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
984 /// because recursive validation is not possible.
985 #[serde(default, skip_serializing_if = "Option::is_none")]
986 pub properties: Option<serde_json::Value>,
987 /// required specifies which fields of an object are required.
988 /// NOTE: Can only be set if type is object.
989 #[serde(default, skip_serializing_if = "Option::is_none")]
990 pub required: Option<Vec<String>>,
991 /// type is the type of the variable.
992 /// Valid values are: object, array, string, integer, number or boolean.
993 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
994 pub r#type: Option<ClusterClassVariablesSchemaOpenApiv3SchemaType>,
995 /// uniqueItems specifies if items in an array must be unique.
996 /// NOTE: Can only be set if type is array.
997 #[serde(
998 default,
999 skip_serializing_if = "Option::is_none",
1000 rename = "uniqueItems"
1001 )]
1002 pub unique_items: Option<bool>,
1003 /// x-kubernetes-int-or-string specifies that this value is
1004 /// either an integer or a string. If this is true, an empty
1005 /// type is allowed and type as child of anyOf is permitted
1006 /// if following one of the following patterns:
1007 ///
1008 /// 1) anyOf:
1009 /// - type: integer
1010 /// - type: string
1011 /// 2) allOf:
1012 /// - anyOf:
1013 /// - type: integer
1014 /// - type: string
1015 /// - ... zero or more
1016 #[serde(
1017 default,
1018 skip_serializing_if = "Option::is_none",
1019 rename = "x-kubernetes-int-or-string"
1020 )]
1021 pub x_kubernetes_int_or_string: Option<bool>,
1022 /// x-kubernetes-preserve-unknown-fields allows setting fields in a variable object
1023 /// which are not defined in the variable schema. This affects fields recursively,
1024 /// except if nested properties or additionalProperties are specified in the schema.
1025 #[serde(
1026 default,
1027 skip_serializing_if = "Option::is_none",
1028 rename = "x-kubernetes-preserve-unknown-fields"
1029 )]
1030 pub x_kubernetes_preserve_unknown_fields: Option<bool>,
1031 /// x-kubernetes-validations describes a list of validation rules written in the CEL expression language.
1032 #[serde(
1033 default,
1034 skip_serializing_if = "Option::is_none",
1035 rename = "x-kubernetes-validations"
1036 )]
1037 pub x_kubernetes_validations:
1038 Option<Vec<ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidations>>,
1039 /// x-metadata is the metadata of a variable or a nested field within a variable.
1040 /// It can be used to add additional data for higher level tools.
1041 #[serde(
1042 default,
1043 skip_serializing_if = "Option::is_none",
1044 rename = "x-metadata"
1045 )]
1046 pub x_metadata: Option<ClusterClassVariablesSchemaOpenApiv3SchemaXMetadata>,
1047}
1048
1049/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
1050/// schema. The schema is a subset of the schema used in
1051/// Kubernetes CRDs.
1052#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1053pub enum ClusterClassVariablesSchemaOpenApiv3SchemaType {
1054 #[serde(rename = "object")]
1055 Object,
1056 #[serde(rename = "array")]
1057 Array,
1058 #[serde(rename = "string")]
1059 String,
1060 #[serde(rename = "integer")]
1061 Integer,
1062 #[serde(rename = "number")]
1063 Number,
1064 #[serde(rename = "boolean")]
1065 Boolean,
1066}
1067
1068/// ValidationRule describes a validation rule written in the CEL expression language.
1069#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1070pub struct ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidations {
1071 /// fieldPath represents the field path returned when the validation fails.
1072 /// It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field.
1073 /// e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo`
1074 /// If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList`
1075 /// It does not support list numeric index.
1076 /// It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](<https://kubernetes.io/docs/reference/kubectl/jsonpath/)> for more info.
1077 /// Numeric index of array is not supported.
1078 /// For field name which contains special characters, use `['specialName']` to refer the field name.
1079 /// e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`
1080 #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
1081 pub field_path: Option<String>,
1082 /// message represents the message displayed when validation fails. The message is required if the Rule contains
1083 /// line breaks. The message must not contain line breaks.
1084 /// If unset, the message is "failed rule: {Rule}".
1085 /// e.g. "must be a URL with the host matching spec.host"
1086 #[serde(default, skip_serializing_if = "Option::is_none")]
1087 pub message: Option<String>,
1088 /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
1089 /// Since messageExpression is used as a failure message, it must evaluate to a string.
1090 /// If both message and messageExpression are present on a rule, then messageExpression will be used if validation
1091 /// fails. If messageExpression results in a runtime error, the validation failure message is produced
1092 /// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
1093 /// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset.
1094 /// messageExpression has access to all the same variables as the rule; the only difference is the return type.
1095 /// Example:
1096 /// "x must be less than max ("+string(self.max)+")"
1097 #[serde(
1098 default,
1099 skip_serializing_if = "Option::is_none",
1100 rename = "messageExpression"
1101 )]
1102 pub message_expression: Option<String>,
1103 /// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
1104 /// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
1105 /// If not set, default to use "FieldValueInvalid".
1106 /// All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid.
1107 #[serde(default, skip_serializing_if = "Option::is_none")]
1108 pub reason: Option<ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidationsReason>,
1109 /// rule represents the expression which will be evaluated by CEL.
1110 /// ref: <https://github.com/google/cel-spec>
1111 /// The Rule is scoped to the location of the x-kubernetes-validations extension in the schema.
1112 /// The `self` variable in the CEL expression is bound to the scoped value.
1113 /// If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable
1114 /// via `self.field` and field presence can be checked via `has(self.field)`.
1115 /// If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map
1116 /// are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map
1117 /// are accessible via CEL macros and functions such as `self.all(...)`.
1118 /// If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and
1119 /// functions.
1120 /// If the Rule is scoped to a scalar, `self` is bound to the scalar value.
1121 /// Examples:
1122 /// - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"}
1123 /// - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"}
1124 /// - Rule scoped to a string value: {"rule": "self.startsWith('kube')"}
1125 ///
1126 /// Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL
1127 /// expressions. This includes:
1128 /// - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields.
1129 /// - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as:
1130 /// - A schema with no type and x-kubernetes-preserve-unknown-fields set to true
1131 /// - An array where the items schema is of an "unknown type"
1132 /// - An object where the additionalProperties schema is of an "unknown type"
1133 ///
1134 /// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
1135 /// Accessible property names are escaped according to the following rules when accessed in the expression:
1136 /// - '__' escapes to '__underscores__'
1137 /// - '.' escapes to '__dot__'
1138 /// - '-' escapes to '__dash__'
1139 /// - '/' escapes to '__slash__'
1140 /// - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
1141 /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
1142 /// "import", "let", "loop", "package", "namespace", "return".
1143 /// Examples:
1144 /// - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"}
1145 /// - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"}
1146 /// - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"}
1147 ///
1148 /// If `rule` makes use of the `oldSelf` variable it is implicitly a
1149 /// `transition rule`.
1150 ///
1151 /// By default, the `oldSelf` variable is the same type as `self`.
1152 ///
1153 /// Transition rules by default are applied only on UPDATE requests and are
1154 /// skipped if an old value could not be found.
1155 pub rule: String,
1156}
1157
1158/// ValidationRule describes a validation rule written in the CEL expression language.
1159#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1160pub enum ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidationsReason {
1161 FieldValueInvalid,
1162 FieldValueForbidden,
1163 FieldValueRequired,
1164 FieldValueDuplicate,
1165}
1166
1167/// x-metadata is the metadata of a variable or a nested field within a variable.
1168/// It can be used to add additional data for higher level tools.
1169#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1170pub struct ClusterClassVariablesSchemaOpenApiv3SchemaXMetadata {
1171 /// annotations is an unstructured key value map that can be used to store and
1172 /// retrieve arbitrary metadata.
1173 /// They are not queryable.
1174 #[serde(default, skip_serializing_if = "Option::is_none")]
1175 pub annotations: Option<BTreeMap<String, String>>,
1176 /// labels is a map of string keys and values that can be used to organize and categorize
1177 /// (scope and select) variables.
1178 #[serde(default, skip_serializing_if = "Option::is_none")]
1179 pub labels: Option<BTreeMap<String, String>>,
1180}
1181
1182/// workers describes the worker nodes for the cluster.
1183/// It is a collection of node types which can be used to create
1184/// the worker nodes of the cluster.
1185#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1186pub struct ClusterClassWorkers {
1187 /// machineDeployments is a list of machine deployment classes that can be used to create
1188 /// a set of worker nodes.
1189 #[serde(
1190 default,
1191 skip_serializing_if = "Option::is_none",
1192 rename = "machineDeployments"
1193 )]
1194 pub machine_deployments: Option<Vec<ClusterClassWorkersMachineDeployments>>,
1195 /// machinePools is a list of machine pool classes that can be used to create
1196 /// a set of worker nodes.
1197 #[serde(
1198 default,
1199 skip_serializing_if = "Option::is_none",
1200 rename = "machinePools"
1201 )]
1202 pub machine_pools: Option<Vec<ClusterClassWorkersMachinePools>>,
1203}
1204
1205/// MachineDeploymentClass serves as a template to define a set of worker nodes of the cluster
1206/// provisioned using the `ClusterClass`.
1207#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1208pub struct ClusterClassWorkersMachineDeployments {
1209 /// bootstrap contains the bootstrap template reference to be used
1210 /// for the creation of worker Machines.
1211 pub bootstrap: ClusterClassWorkersMachineDeploymentsBootstrap,
1212 /// class denotes a type of worker node present in the cluster,
1213 /// this name MUST be unique within a ClusterClass and can be referenced
1214 /// in the Cluster to create a managed MachineDeployment.
1215 pub class: String,
1216 /// deletion contains configuration options for Machine deletion.
1217 #[serde(default, skip_serializing_if = "Option::is_none")]
1218 pub deletion: Option<ClusterClassWorkersMachineDeploymentsDeletion>,
1219 /// failureDomain is the failure domain the machines will be created in.
1220 /// Must match the name of a FailureDomain from the Cluster status.
1221 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
1222 #[serde(
1223 default,
1224 skip_serializing_if = "Option::is_none",
1225 rename = "failureDomain"
1226 )]
1227 pub failure_domain: Option<String>,
1228 /// healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
1229 #[serde(
1230 default,
1231 skip_serializing_if = "Option::is_none",
1232 rename = "healthCheck"
1233 )]
1234 pub health_check: Option<ClusterClassWorkersMachineDeploymentsHealthCheck>,
1235 /// infrastructure contains the infrastructure template reference to be used
1236 /// for the creation of worker Machines.
1237 pub infrastructure: ClusterClassWorkersMachineDeploymentsInfrastructure,
1238 /// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
1239 /// At runtime this metadata is merged with the corresponding metadata from the topology.
1240 #[serde(default, skip_serializing_if = "Option::is_none")]
1241 pub metadata: Option<ClusterClassWorkersMachineDeploymentsMetadata>,
1242 /// minReadySeconds is the minimum number of seconds for which a newly created machine should
1243 /// be ready.
1244 /// Defaults to 0 (machine will be considered available as soon as it
1245 /// is ready)
1246 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
1247 #[serde(
1248 default,
1249 skip_serializing_if = "Option::is_none",
1250 rename = "minReadySeconds"
1251 )]
1252 pub min_ready_seconds: Option<i32>,
1253 /// naming allows changing the naming pattern used when creating the MachineDeployment.
1254 #[serde(default, skip_serializing_if = "Option::is_none")]
1255 pub naming: Option<ClusterClassWorkersMachineDeploymentsNaming>,
1256 /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
1257 ///
1258 /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
1259 /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
1260 ///
1261 /// NOTE: If a Cluster defines a custom list of readinessGates for a MachineDeployment using this MachineDeploymentClass,
1262 /// such list overrides readinessGates defined in this field.
1263 #[serde(
1264 default,
1265 skip_serializing_if = "Option::is_none",
1266 rename = "readinessGates"
1267 )]
1268 pub readiness_gates: Option<Vec<ClusterClassWorkersMachineDeploymentsReadinessGates>>,
1269 /// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
1270 /// It allows you to define the strategy used during rolling replacements.
1271 #[serde(default, skip_serializing_if = "Option::is_none")]
1272 pub rollout: Option<ClusterClassWorkersMachineDeploymentsRollout>,
1273 /// taints are the node taints that Cluster API will manage.
1274 /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
1275 /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
1276 /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
1277 ///
1278 /// There can be at most 64 taints.
1279 /// A pod would have to tolerate all existing taints to run on the corresponding node.
1280 ///
1281 /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
1282 #[serde(default, skip_serializing_if = "Option::is_none")]
1283 pub taints: Option<Vec<ClusterClassWorkersMachineDeploymentsTaints>>,
1284}
1285
1286/// bootstrap contains the bootstrap template reference to be used
1287/// for the creation of worker Machines.
1288#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1289pub struct ClusterClassWorkersMachineDeploymentsBootstrap {
1290 /// templateRef is a required reference to the BootstrapTemplate for a MachineDeployment.
1291 #[serde(rename = "templateRef")]
1292 pub template_ref: ClusterClassWorkersMachineDeploymentsBootstrapTemplateRef,
1293}
1294
1295/// templateRef is a required reference to the BootstrapTemplate for a MachineDeployment.
1296#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1297pub struct ClusterClassWorkersMachineDeploymentsBootstrapTemplateRef {
1298 /// apiVersion of the template.
1299 /// apiVersion must be fully qualified domain name followed by / and a version.
1300 #[serde(rename = "apiVersion")]
1301 pub api_version: String,
1302 /// kind of the template.
1303 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1304 pub kind: String,
1305 /// name of the template.
1306 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1307 pub name: String,
1308}
1309
1310/// deletion contains configuration options for Machine deletion.
1311#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1312pub struct ClusterClassWorkersMachineDeploymentsDeletion {
1313 /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
1314 /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
1315 /// Defaults to 10 seconds.
1316 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
1317 #[serde(
1318 default,
1319 skip_serializing_if = "Option::is_none",
1320 rename = "nodeDeletionTimeoutSeconds"
1321 )]
1322 pub node_deletion_timeout_seconds: Option<i32>,
1323 /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
1324 /// The default value is 0, meaning that the node can be drained without any time limitations.
1325 /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
1326 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
1327 #[serde(
1328 default,
1329 skip_serializing_if = "Option::is_none",
1330 rename = "nodeDrainTimeoutSeconds"
1331 )]
1332 pub node_drain_timeout_seconds: Option<i32>,
1333 /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
1334 /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
1335 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
1336 #[serde(
1337 default,
1338 skip_serializing_if = "Option::is_none",
1339 rename = "nodeVolumeDetachTimeoutSeconds"
1340 )]
1341 pub node_volume_detach_timeout_seconds: Option<i32>,
1342 /// order defines the order in which Machines are deleted when downscaling.
1343 /// Defaults to "Random". Valid values are "Random, "Newest", "Oldest"
1344 #[serde(default, skip_serializing_if = "Option::is_none")]
1345 pub order: Option<ClusterClassWorkersMachineDeploymentsDeletionOrder>,
1346}
1347
1348/// deletion contains configuration options for Machine deletion.
1349#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1350pub enum ClusterClassWorkersMachineDeploymentsDeletionOrder {
1351 Random,
1352 Newest,
1353 Oldest,
1354}
1355
1356/// healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
1357#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1358pub struct ClusterClassWorkersMachineDeploymentsHealthCheck {
1359 /// checks are the checks that are used to evaluate if a Machine is healthy.
1360 ///
1361 /// Independent of this configuration the MachineHealthCheck controller will always
1362 /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
1363 /// Machines with deleted Nodes as unhealthy.
1364 ///
1365 /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
1366 /// is defaulted to 10 minutes and evaluated accordingly.
1367 #[serde(default, skip_serializing_if = "Option::is_none")]
1368 pub checks: Option<ClusterClassWorkersMachineDeploymentsHealthCheckChecks>,
1369 /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
1370 ///
1371 /// If remediation or remediation.triggerIf is not set,
1372 /// remediation will always be triggered for unhealthy Machines.
1373 ///
1374 /// If remediation or remediation.templateRef is not set,
1375 /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
1376 /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
1377 #[serde(default, skip_serializing_if = "Option::is_none")]
1378 pub remediation: Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediation>,
1379}
1380
1381/// checks are the checks that are used to evaluate if a Machine is healthy.
1382///
1383/// Independent of this configuration the MachineHealthCheck controller will always
1384/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
1385/// Machines with deleted Nodes as unhealthy.
1386///
1387/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
1388/// is defaulted to 10 minutes and evaluated accordingly.
1389#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1390pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecks {
1391 /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
1392 /// to consider a Machine unhealthy if a corresponding Node isn't associated
1393 /// through a `Spec.ProviderID` field.
1394 ///
1395 /// The duration set in this field is compared to the greatest of:
1396 /// - Cluster's infrastructure ready condition timestamp (if and when available)
1397 /// - Control Plane's initialized condition timestamp (if and when available)
1398 /// - Machine's infrastructure ready condition timestamp (if and when available)
1399 /// - Machine's metadata creation timestamp
1400 ///
1401 /// Defaults to 10 minutes.
1402 /// If you wish to disable this feature, set the value explicitly to 0.
1403 #[serde(
1404 default,
1405 skip_serializing_if = "Option::is_none",
1406 rename = "nodeStartupTimeoutSeconds"
1407 )]
1408 pub node_startup_timeout_seconds: Option<i32>,
1409 /// unhealthyMachineConditions contains a list of the machine conditions that determine
1410 /// whether a machine is considered unhealthy. The conditions are combined in a
1411 /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
1412 #[serde(
1413 default,
1414 skip_serializing_if = "Option::is_none",
1415 rename = "unhealthyMachineConditions"
1416 )]
1417 pub unhealthy_machine_conditions: Option<
1418 Vec<ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions>,
1419 >,
1420 /// unhealthyNodeConditions contains a list of conditions that determine
1421 /// whether a node is considered unhealthy. The conditions are combined in a
1422 /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
1423 #[serde(
1424 default,
1425 skip_serializing_if = "Option::is_none",
1426 rename = "unhealthyNodeConditions"
1427 )]
1428 pub unhealthy_node_conditions:
1429 Option<Vec<ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions>>,
1430}
1431
1432/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
1433/// specified as a duration. When the named condition has been in the given
1434/// status for at least the timeout value, a machine is considered unhealthy.
1435#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1436pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions {
1437 /// status of the condition, one of True, False, Unknown.
1438 pub status:
1439 ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus,
1440 /// timeoutSeconds is the duration that a machine must be in a given status for,
1441 /// after which the machine is considered unhealthy.
1442 /// For example, with a value of "3600", the machine must match the status
1443 /// for at least 1 hour before being considered unhealthy.
1444 #[serde(rename = "timeoutSeconds")]
1445 pub timeout_seconds: i32,
1446 /// type of Machine condition
1447 #[serde(rename = "type")]
1448 pub r#type: String,
1449}
1450
1451/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
1452/// specified as a duration. When the named condition has been in the given
1453/// status for at least the timeout value, a machine is considered unhealthy.
1454#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1455pub enum ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus {
1456 True,
1457 False,
1458 Unknown,
1459}
1460
1461/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
1462/// specified as a duration. When the named condition has been in the given
1463/// status for at least the timeout value, a node is considered unhealthy.
1464#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1465pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions {
1466 /// status of the condition, one of True, False, Unknown.
1467 pub status: String,
1468 /// timeoutSeconds is the duration that a node must be in a given status for,
1469 /// after which the node is considered unhealthy.
1470 /// For example, with a value of "3600", the node must match the status
1471 /// for at least 1 hour before being considered unhealthy.
1472 #[serde(rename = "timeoutSeconds")]
1473 pub timeout_seconds: i32,
1474 /// type of Node condition
1475 #[serde(rename = "type")]
1476 pub r#type: String,
1477}
1478
1479/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
1480///
1481/// If remediation or remediation.triggerIf is not set,
1482/// remediation will always be triggered for unhealthy Machines.
1483///
1484/// If remediation or remediation.templateRef is not set,
1485/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
1486/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
1487#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1488pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediation {
1489 /// maxInFlight determines how many in flight remediations should happen at the same time.
1490 ///
1491 /// Remediation only happens on the MachineSet with the most current revision, while
1492 /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
1493 ///
1494 /// Note: In general (independent of remediations), unhealthy machines are always
1495 /// prioritized during scale down operations over healthy ones.
1496 ///
1497 /// MaxInFlight can be set to a fixed number or a percentage.
1498 /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
1499 /// the desired replicas.
1500 ///
1501 /// If not set, remediation is limited to all machines (bounded by replicas)
1502 /// under the active MachineSet's management.
1503 #[serde(
1504 default,
1505 skip_serializing_if = "Option::is_none",
1506 rename = "maxInFlight"
1507 )]
1508 pub max_in_flight: Option<IntOrString>,
1509 /// templateRef is a reference to a remediation template
1510 /// provided by an infrastructure provider.
1511 ///
1512 /// This field is completely optional, when filled, the MachineHealthCheck controller
1513 /// creates a new object from the template referenced and hands off remediation of the machine to
1514 /// a controller that lives outside of Cluster API.
1515 #[serde(
1516 default,
1517 skip_serializing_if = "Option::is_none",
1518 rename = "templateRef"
1519 )]
1520 pub template_ref:
1521 Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTemplateRef>,
1522 /// triggerIf configures if remediations are triggered.
1523 /// If this field is not set, remediations are always triggered.
1524 #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
1525 pub trigger_if: Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTriggerIf>,
1526}
1527
1528/// templateRef is a reference to a remediation template
1529/// provided by an infrastructure provider.
1530///
1531/// This field is completely optional, when filled, the MachineHealthCheck controller
1532/// creates a new object from the template referenced and hands off remediation of the machine to
1533/// a controller that lives outside of Cluster API.
1534#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1535pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTemplateRef {
1536 /// apiVersion of the remediation template.
1537 /// apiVersion must be fully qualified domain name followed by / and a version.
1538 /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
1539 #[serde(rename = "apiVersion")]
1540 pub api_version: String,
1541 /// kind of the remediation template.
1542 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1543 pub kind: String,
1544 /// name of the remediation template.
1545 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1546 pub name: String,
1547}
1548
1549/// triggerIf configures if remediations are triggered.
1550/// If this field is not set, remediations are always triggered.
1551#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1552pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTriggerIf {
1553 /// unhealthyInRange specifies that remediations are only triggered if the number of
1554 /// unhealthy Machines is in the configured range.
1555 /// Takes precedence over unhealthyLessThanOrEqualTo.
1556 /// Eg. "[3-5]" - This means that remediation will be allowed only when:
1557 /// (a) there are at least 3 unhealthy Machines (and)
1558 /// (b) there are at most 5 unhealthy Machines
1559 #[serde(
1560 default,
1561 skip_serializing_if = "Option::is_none",
1562 rename = "unhealthyInRange"
1563 )]
1564 pub unhealthy_in_range: Option<String>,
1565 /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
1566 /// unhealthy Machines is less than or equal to the configured value.
1567 /// unhealthyInRange takes precedence if set.
1568 #[serde(
1569 default,
1570 skip_serializing_if = "Option::is_none",
1571 rename = "unhealthyLessThanOrEqualTo"
1572 )]
1573 pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
1574}
1575
1576/// infrastructure contains the infrastructure template reference to be used
1577/// for the creation of worker Machines.
1578#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1579pub struct ClusterClassWorkersMachineDeploymentsInfrastructure {
1580 /// templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.
1581 #[serde(rename = "templateRef")]
1582 pub template_ref: ClusterClassWorkersMachineDeploymentsInfrastructureTemplateRef,
1583}
1584
1585/// templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.
1586#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1587pub struct ClusterClassWorkersMachineDeploymentsInfrastructureTemplateRef {
1588 /// apiVersion of the template.
1589 /// apiVersion must be fully qualified domain name followed by / and a version.
1590 #[serde(rename = "apiVersion")]
1591 pub api_version: String,
1592 /// kind of the template.
1593 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1594 pub kind: String,
1595 /// name of the template.
1596 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1597 pub name: String,
1598}
1599
1600/// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
1601/// At runtime this metadata is merged with the corresponding metadata from the topology.
1602#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1603pub struct ClusterClassWorkersMachineDeploymentsMetadata {
1604 /// annotations is an unstructured key value map stored with a resource that may be
1605 /// set by external tools to store and retrieve arbitrary metadata. They are not
1606 /// queryable and should be preserved when modifying objects.
1607 /// More info: <http://kubernetes.io/docs/user-guide/annotations>
1608 #[serde(default, skip_serializing_if = "Option::is_none")]
1609 pub annotations: Option<BTreeMap<String, String>>,
1610 /// labels is a map of string keys and values that can be used to organize and categorize
1611 /// (scope and select) objects. May match selectors of replication controllers
1612 /// and services.
1613 /// More info: <http://kubernetes.io/docs/user-guide/labels>
1614 #[serde(default, skip_serializing_if = "Option::is_none")]
1615 pub labels: Option<BTreeMap<String, String>>,
1616}
1617
1618/// naming allows changing the naming pattern used when creating the MachineDeployment.
1619#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1620pub struct ClusterClassWorkersMachineDeploymentsNaming {
1621 /// template defines the template to use for generating the name of the MachineDeployment object.
1622 /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`.
1623 /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
1624 /// get concatenated with a random suffix of length 5.
1625 /// The templating mechanism provides the following arguments:
1626 /// * `.cluster.name`: The name of the cluster object.
1627 /// * `.random`: A random alphanumeric string, without vowels, of length 5.
1628 /// * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).
1629 #[serde(default, skip_serializing_if = "Option::is_none")]
1630 pub template: Option<String>,
1631}
1632
1633/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
1634#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1635pub struct ClusterClassWorkersMachineDeploymentsReadinessGates {
1636 /// conditionType refers to a condition with matching type in the Machine's condition list.
1637 /// If the conditions doesn't exist, it will be treated as unknown.
1638 /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
1639 #[serde(rename = "conditionType")]
1640 pub condition_type: String,
1641 /// polarity of the conditionType specified in this readinessGate.
1642 /// Valid values are Positive, Negative and omitted.
1643 /// When omitted, the default behaviour will be Positive.
1644 /// A positive polarity means that the condition should report a true status under normal conditions.
1645 /// A negative polarity means that the condition should report a false status under normal conditions.
1646 #[serde(default, skip_serializing_if = "Option::is_none")]
1647 pub polarity: Option<ClusterClassWorkersMachineDeploymentsReadinessGatesPolarity>,
1648}
1649
1650/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
1651#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1652pub enum ClusterClassWorkersMachineDeploymentsReadinessGatesPolarity {
1653 Positive,
1654 Negative,
1655}
1656
1657/// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
1658/// It allows you to define the strategy used during rolling replacements.
1659#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1660pub struct ClusterClassWorkersMachineDeploymentsRollout {
1661 /// strategy specifies how to roll out control plane Machines.
1662 #[serde(default, skip_serializing_if = "Option::is_none")]
1663 pub strategy: Option<ClusterClassWorkersMachineDeploymentsRolloutStrategy>,
1664}
1665
1666/// strategy specifies how to roll out control plane Machines.
1667#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1668pub struct ClusterClassWorkersMachineDeploymentsRolloutStrategy {
1669 /// rollingUpdate is the rolling update config params. Present only if
1670 /// type = RollingUpdate.
1671 #[serde(
1672 default,
1673 skip_serializing_if = "Option::is_none",
1674 rename = "rollingUpdate"
1675 )]
1676 pub rolling_update: Option<ClusterClassWorkersMachineDeploymentsRolloutStrategyRollingUpdate>,
1677 /// type of rollout. Allowed values are RollingUpdate and OnDelete.
1678 /// Default is RollingUpdate.
1679 #[serde(rename = "type")]
1680 pub r#type: ClusterClassWorkersMachineDeploymentsRolloutStrategyType,
1681}
1682
1683/// rollingUpdate is the rolling update config params. Present only if
1684/// type = RollingUpdate.
1685#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1686pub struct ClusterClassWorkersMachineDeploymentsRolloutStrategyRollingUpdate {
1687 /// maxSurge is the maximum number of machines that can be scheduled above the
1688 /// desired number of machines.
1689 /// Value can be an absolute number (ex: 5) or a percentage of
1690 /// desired machines (ex: 10%).
1691 /// This can not be 0 if MaxUnavailable is 0.
1692 /// Absolute number is calculated from percentage by rounding up.
1693 /// Defaults to 1.
1694 /// Example: when this is set to 30%, the new MachineSet can be scaled
1695 /// up immediately when the rolling update starts, such that the total
1696 /// number of old and new machines do not exceed 130% of desired
1697 /// machines. Once old machines have been killed, new MachineSet can
1698 /// be scaled up further, ensuring that total number of machines running
1699 /// at any time during the update is at most 130% of desired machines.
1700 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
1701 pub max_surge: Option<IntOrString>,
1702 /// maxUnavailable is the maximum number of machines that can be unavailable during the update.
1703 /// Value can be an absolute number (ex: 5) or a percentage of desired
1704 /// machines (ex: 10%).
1705 /// Absolute number is calculated from percentage by rounding down.
1706 /// This can not be 0 if MaxSurge is 0.
1707 /// Defaults to 0.
1708 /// Example: when this is set to 30%, the old MachineSet can be scaled
1709 /// down to 70% of desired machines immediately when the rolling update
1710 /// starts. Once new machines are ready, old MachineSet can be scaled
1711 /// down further, followed by scaling up the new MachineSet, ensuring
1712 /// that the total number of machines available at all times
1713 /// during the update is at least 70% of desired machines.
1714 #[serde(
1715 default,
1716 skip_serializing_if = "Option::is_none",
1717 rename = "maxUnavailable"
1718 )]
1719 pub max_unavailable: Option<IntOrString>,
1720}
1721
1722/// strategy specifies how to roll out control plane Machines.
1723#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1724pub enum ClusterClassWorkersMachineDeploymentsRolloutStrategyType {
1725 RollingUpdate,
1726 OnDelete,
1727}
1728
1729/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1730#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1731pub struct ClusterClassWorkersMachineDeploymentsTaints {
1732 /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
1733 pub effect: ClusterClassWorkersMachineDeploymentsTaintsEffect,
1734 /// key is the taint key to be applied to a node.
1735 /// Must be a valid qualified name of maximum size 63 characters
1736 /// with an optional subdomain prefix of maximum size 253 characters,
1737 /// separated by a `/`.
1738 pub key: String,
1739 /// propagation defines how this taint should be propagated to nodes.
1740 /// Valid values are 'Always' and 'OnInitialization'.
1741 /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
1742 /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
1743 pub propagation: ClusterClassWorkersMachineDeploymentsTaintsPropagation,
1744 /// value is the taint value corresponding to the taint key.
1745 /// It must be a valid label value of maximum size 63 characters.
1746 #[serde(default, skip_serializing_if = "Option::is_none")]
1747 pub value: Option<String>,
1748}
1749
1750/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1751#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1752pub enum ClusterClassWorkersMachineDeploymentsTaintsEffect {
1753 NoSchedule,
1754 PreferNoSchedule,
1755 NoExecute,
1756}
1757
1758/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1759#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1760pub enum ClusterClassWorkersMachineDeploymentsTaintsPropagation {
1761 Always,
1762 OnInitialization,
1763}
1764
1765/// MachinePoolClass serves as a template to define a pool of worker nodes of the cluster
1766/// provisioned using `ClusterClass`.
1767#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1768pub struct ClusterClassWorkersMachinePools {
1769 /// bootstrap contains the bootstrap template reference to be used
1770 /// for the creation of the Machines in the MachinePool.
1771 pub bootstrap: ClusterClassWorkersMachinePoolsBootstrap,
1772 /// class denotes a type of machine pool present in the cluster,
1773 /// this name MUST be unique within a ClusterClass and can be referenced
1774 /// in the Cluster to create a managed MachinePool.
1775 pub class: String,
1776 /// deletion contains configuration options for Machine deletion.
1777 #[serde(default, skip_serializing_if = "Option::is_none")]
1778 pub deletion: Option<ClusterClassWorkersMachinePoolsDeletion>,
1779 /// failureDomains is the list of failure domains the MachinePool should be attached to.
1780 /// Must match a key in the FailureDomains map stored on the cluster object.
1781 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
1782 #[serde(
1783 default,
1784 skip_serializing_if = "Option::is_none",
1785 rename = "failureDomains"
1786 )]
1787 pub failure_domains: Option<Vec<String>>,
1788 /// infrastructure contains the infrastructure template reference to be used
1789 /// for the creation of the MachinePool.
1790 pub infrastructure: ClusterClassWorkersMachinePoolsInfrastructure,
1791 /// metadata is the metadata applied to the MachinePool.
1792 /// At runtime this metadata is merged with the corresponding metadata from the topology.
1793 #[serde(default, skip_serializing_if = "Option::is_none")]
1794 pub metadata: Option<ClusterClassWorkersMachinePoolsMetadata>,
1795 /// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
1796 /// be ready.
1797 /// Defaults to 0 (machine will be considered available as soon as it
1798 /// is ready)
1799 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
1800 #[serde(
1801 default,
1802 skip_serializing_if = "Option::is_none",
1803 rename = "minReadySeconds"
1804 )]
1805 pub min_ready_seconds: Option<i32>,
1806 /// naming allows changing the naming pattern used when creating the MachinePool.
1807 #[serde(default, skip_serializing_if = "Option::is_none")]
1808 pub naming: Option<ClusterClassWorkersMachinePoolsNaming>,
1809 /// taints are the node taints that Cluster API will manage.
1810 /// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
1811 /// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
1812 /// Only those taints defined in this list will be added or removed by core Cluster API controllers.
1813 ///
1814 /// There can be at most 64 taints.
1815 /// A pod would have to tolerate all existing taints to run on the corresponding node.
1816 ///
1817 /// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
1818 #[serde(default, skip_serializing_if = "Option::is_none")]
1819 pub taints: Option<Vec<ClusterClassWorkersMachinePoolsTaints>>,
1820}
1821
1822/// bootstrap contains the bootstrap template reference to be used
1823/// for the creation of the Machines in the MachinePool.
1824#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1825pub struct ClusterClassWorkersMachinePoolsBootstrap {
1826 /// templateRef is a required reference to the BootstrapTemplate for a MachinePool.
1827 #[serde(rename = "templateRef")]
1828 pub template_ref: ClusterClassWorkersMachinePoolsBootstrapTemplateRef,
1829}
1830
1831/// templateRef is a required reference to the BootstrapTemplate for a MachinePool.
1832#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1833pub struct ClusterClassWorkersMachinePoolsBootstrapTemplateRef {
1834 /// apiVersion of the template.
1835 /// apiVersion must be fully qualified domain name followed by / and a version.
1836 #[serde(rename = "apiVersion")]
1837 pub api_version: String,
1838 /// kind of the template.
1839 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1840 pub kind: String,
1841 /// name of the template.
1842 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1843 pub name: String,
1844}
1845
1846/// deletion contains configuration options for Machine deletion.
1847#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1848pub struct ClusterClassWorkersMachinePoolsDeletion {
1849 /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
1850 /// hosts after the Machine Pool is marked for deletion. A duration of 0 will retry deletion indefinitely.
1851 /// Defaults to 10 seconds.
1852 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
1853 #[serde(
1854 default,
1855 skip_serializing_if = "Option::is_none",
1856 rename = "nodeDeletionTimeoutSeconds"
1857 )]
1858 pub node_deletion_timeout_seconds: Option<i32>,
1859 /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
1860 /// The default value is 0, meaning that the node can be drained without any time limitations.
1861 /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
1862 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
1863 #[serde(
1864 default,
1865 skip_serializing_if = "Option::is_none",
1866 rename = "nodeDrainTimeoutSeconds"
1867 )]
1868 pub node_drain_timeout_seconds: Option<i32>,
1869 /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
1870 /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
1871 /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
1872 #[serde(
1873 default,
1874 skip_serializing_if = "Option::is_none",
1875 rename = "nodeVolumeDetachTimeoutSeconds"
1876 )]
1877 pub node_volume_detach_timeout_seconds: Option<i32>,
1878}
1879
1880/// infrastructure contains the infrastructure template reference to be used
1881/// for the creation of the MachinePool.
1882#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1883pub struct ClusterClassWorkersMachinePoolsInfrastructure {
1884 /// templateRef is a required reference to the InfrastructureTemplate for a MachinePool.
1885 #[serde(rename = "templateRef")]
1886 pub template_ref: ClusterClassWorkersMachinePoolsInfrastructureTemplateRef,
1887}
1888
1889/// templateRef is a required reference to the InfrastructureTemplate for a MachinePool.
1890#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1891pub struct ClusterClassWorkersMachinePoolsInfrastructureTemplateRef {
1892 /// apiVersion of the template.
1893 /// apiVersion must be fully qualified domain name followed by / and a version.
1894 #[serde(rename = "apiVersion")]
1895 pub api_version: String,
1896 /// kind of the template.
1897 /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
1898 pub kind: String,
1899 /// name of the template.
1900 /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
1901 pub name: String,
1902}
1903
1904/// metadata is the metadata applied to the MachinePool.
1905/// At runtime this metadata is merged with the corresponding metadata from the topology.
1906#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1907pub struct ClusterClassWorkersMachinePoolsMetadata {
1908 /// annotations is an unstructured key value map stored with a resource that may be
1909 /// set by external tools to store and retrieve arbitrary metadata. They are not
1910 /// queryable and should be preserved when modifying objects.
1911 /// More info: <http://kubernetes.io/docs/user-guide/annotations>
1912 #[serde(default, skip_serializing_if = "Option::is_none")]
1913 pub annotations: Option<BTreeMap<String, String>>,
1914 /// labels is a map of string keys and values that can be used to organize and categorize
1915 /// (scope and select) objects. May match selectors of replication controllers
1916 /// and services.
1917 /// More info: <http://kubernetes.io/docs/user-guide/labels>
1918 #[serde(default, skip_serializing_if = "Option::is_none")]
1919 pub labels: Option<BTreeMap<String, String>>,
1920}
1921
1922/// naming allows changing the naming pattern used when creating the MachinePool.
1923#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1924pub struct ClusterClassWorkersMachinePoolsNaming {
1925 /// template defines the template to use for generating the name of the MachinePool object.
1926 /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .machinePool.topologyName }}-{{ .random }}`.
1927 /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
1928 /// get concatenated with a random suffix of length 5.
1929 /// The templating mechanism provides the following arguments:
1930 /// * `.cluster.name`: The name of the cluster object.
1931 /// * `.random`: A random alphanumeric string, without vowels, of length 5.
1932 /// * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name).
1933 #[serde(default, skip_serializing_if = "Option::is_none")]
1934 pub template: Option<String>,
1935}
1936
1937/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1938#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1939pub struct ClusterClassWorkersMachinePoolsTaints {
1940 /// effect is the effect for the taint. Valid values are NoSchedule, PreferNoSchedule and NoExecute.
1941 pub effect: ClusterClassWorkersMachinePoolsTaintsEffect,
1942 /// key is the taint key to be applied to a node.
1943 /// Must be a valid qualified name of maximum size 63 characters
1944 /// with an optional subdomain prefix of maximum size 253 characters,
1945 /// separated by a `/`.
1946 pub key: String,
1947 /// propagation defines how this taint should be propagated to nodes.
1948 /// Valid values are 'Always' and 'OnInitialization'.
1949 /// Always: The taint will be continuously reconciled. If it is not set for a node, it will be added during reconciliation.
1950 /// OnInitialization: The taint will be added during node initialization. If it gets removed from the node later on it will not get added again.
1951 pub propagation: ClusterClassWorkersMachinePoolsTaintsPropagation,
1952 /// value is the taint value corresponding to the taint key.
1953 /// It must be a valid label value of maximum size 63 characters.
1954 #[serde(default, skip_serializing_if = "Option::is_none")]
1955 pub value: Option<String>,
1956}
1957
1958/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1959#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1960pub enum ClusterClassWorkersMachinePoolsTaintsEffect {
1961 NoSchedule,
1962 PreferNoSchedule,
1963 NoExecute,
1964}
1965
1966/// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
1967#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1968pub enum ClusterClassWorkersMachinePoolsTaintsPropagation {
1969 Always,
1970 OnInitialization,
1971}
1972
1973/// status is the observed state of ClusterClass.
1974#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1975pub struct ClusterClassStatus {
1976 /// conditions represents the observations of a ClusterClass's current state.
1977 /// Known condition types are VariablesReady, RefVersionsUpToDate, Paused.
1978 #[serde(default, skip_serializing_if = "Option::is_none")]
1979 pub conditions: Option<Vec<Condition>>,
1980 /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
1981 #[serde(default, skip_serializing_if = "Option::is_none")]
1982 pub deprecated: Option<ClusterClassStatusDeprecated>,
1983 /// observedGeneration is the latest generation observed by the controller.
1984 #[serde(
1985 default,
1986 skip_serializing_if = "Option::is_none",
1987 rename = "observedGeneration"
1988 )]
1989 pub observed_generation: Option<i64>,
1990 /// variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass.
1991 #[serde(default, skip_serializing_if = "Option::is_none")]
1992 pub variables: Option<Vec<ClusterClassStatusVariables>>,
1993}
1994
1995/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
1996#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
1997pub struct ClusterClassStatusDeprecated {
1998 /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
1999 #[serde(default, skip_serializing_if = "Option::is_none")]
2000 pub v1beta1: Option<ClusterClassStatusDeprecatedV1beta1>,
2001}
2002
2003/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
2004#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2005pub struct ClusterClassStatusDeprecatedV1beta1 {
2006 /// conditions defines current observed state of the ClusterClass.
2007 ///
2008 /// 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.
2009 #[serde(default, skip_serializing_if = "Option::is_none")]
2010 pub conditions: Option<Vec<Condition>>,
2011}
2012
2013/// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
2014#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2015pub struct ClusterClassStatusVariables {
2016 /// definitions is a list of definitions for a variable.
2017 pub definitions: Vec<ClusterClassStatusVariablesDefinitions>,
2018 /// definitionsConflict specifies whether or not there are conflicting definitions for a single variable name.
2019 #[serde(
2020 default,
2021 skip_serializing_if = "Option::is_none",
2022 rename = "definitionsConflict"
2023 )]
2024 pub definitions_conflict: Option<bool>,
2025 /// name is the name of the variable.
2026 pub name: String,
2027}
2028
2029/// ClusterClassStatusVariableDefinition defines a variable which appears in the status of a ClusterClass.
2030#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2031pub struct ClusterClassStatusVariablesDefinitions {
2032 /// deprecatedV1Beta1Metadata is the metadata of a variable.
2033 /// It can be used to add additional data for higher level tools to
2034 /// a ClusterClassVariable.
2035 ///
2036 /// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
2037 #[serde(
2038 default,
2039 skip_serializing_if = "Option::is_none",
2040 rename = "deprecatedV1Beta1Metadata"
2041 )]
2042 pub deprecated_v1_beta1_metadata:
2043 Option<ClusterClassStatusVariablesDefinitionsDeprecatedV1Beta1Metadata>,
2044 /// from specifies the origin of the variable definition.
2045 /// This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass
2046 /// for variables discovered from a DiscoverVariables runtime extensions.
2047 pub from: String,
2048 /// required specifies if the variable is required.
2049 /// Note: this applies to the variable as a whole and thus the
2050 /// top-level object defined in the schema. If nested fields are
2051 /// required, this will be specified inside the schema.
2052 pub required: bool,
2053 /// schema defines the schema of the variable.
2054 pub schema: ClusterClassStatusVariablesDefinitionsSchema,
2055}
2056
2057/// deprecatedV1Beta1Metadata is the metadata of a variable.
2058/// It can be used to add additional data for higher level tools to
2059/// a ClusterClassVariable.
2060///
2061/// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
2062#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2063pub struct ClusterClassStatusVariablesDefinitionsDeprecatedV1Beta1Metadata {
2064 /// annotations is an unstructured key value map that can be used to store and
2065 /// retrieve arbitrary metadata.
2066 /// They are not queryable.
2067 #[serde(default, skip_serializing_if = "Option::is_none")]
2068 pub annotations: Option<BTreeMap<String, String>>,
2069 /// labels is a map of string keys and values that can be used to organize and categorize
2070 /// (scope and select) variables.
2071 #[serde(default, skip_serializing_if = "Option::is_none")]
2072 pub labels: Option<BTreeMap<String, String>>,
2073}
2074
2075/// schema defines the schema of the variable.
2076#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2077pub struct ClusterClassStatusVariablesDefinitionsSchema {
2078 /// openAPIV3Schema defines the schema of a variable via OpenAPI v3
2079 /// schema. The schema is a subset of the schema used in
2080 /// Kubernetes CRDs.
2081 #[serde(rename = "openAPIV3Schema")]
2082 pub open_apiv3_schema: ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema,
2083}
2084
2085/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
2086/// schema. The schema is a subset of the schema used in
2087/// Kubernetes CRDs.
2088#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2089pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema {
2090 /// additionalProperties specifies the schema of values in a map (keys are always strings).
2091 /// NOTE: Can only be set if type is object.
2092 /// NOTE: AdditionalProperties is mutually exclusive with Properties.
2093 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2094 /// because recursive validation is not possible.
2095 #[serde(
2096 default,
2097 skip_serializing_if = "Option::is_none",
2098 rename = "additionalProperties"
2099 )]
2100 pub additional_properties: Option<serde_json::Value>,
2101 /// allOf specifies that the variable must validate against all of the subschemas in the array.
2102 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2103 /// because recursive validation is not possible.
2104 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allOf")]
2105 pub all_of: Option<serde_json::Value>,
2106 /// anyOf specifies that the variable must validate against one or more of the subschemas in the array.
2107 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2108 /// because recursive validation is not possible.
2109 #[serde(default, skip_serializing_if = "Option::is_none", rename = "anyOf")]
2110 pub any_of: Option<serde_json::Value>,
2111 /// default is the default value of the variable.
2112 /// NOTE: Can be set for all types.
2113 #[serde(default, skip_serializing_if = "Option::is_none")]
2114 pub default: Option<serde_json::Value>,
2115 /// description is a human-readable description of this variable.
2116 #[serde(default, skip_serializing_if = "Option::is_none")]
2117 pub description: Option<String>,
2118 /// enum is the list of valid values of the variable.
2119 /// NOTE: Can be set for all types.
2120 #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")]
2121 pub r#enum: Option<Vec<serde_json::Value>>,
2122 /// example is an example for this variable.
2123 #[serde(default, skip_serializing_if = "Option::is_none")]
2124 pub example: Option<serde_json::Value>,
2125 /// exclusiveMaximum specifies if the Maximum is exclusive.
2126 /// NOTE: Can only be set if type is integer or number.
2127 #[serde(
2128 default,
2129 skip_serializing_if = "Option::is_none",
2130 rename = "exclusiveMaximum"
2131 )]
2132 pub exclusive_maximum: Option<bool>,
2133 /// exclusiveMinimum specifies if the Minimum is exclusive.
2134 /// NOTE: Can only be set if type is integer or number.
2135 #[serde(
2136 default,
2137 skip_serializing_if = "Option::is_none",
2138 rename = "exclusiveMinimum"
2139 )]
2140 pub exclusive_minimum: Option<bool>,
2141 /// format is an OpenAPI v3 format string. Unknown formats are ignored.
2142 /// For a list of supported formats please see: (of the k8s.io/apiextensions-apiserver version we're currently using)
2143 /// <https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go>
2144 /// NOTE: Can only be set if type is string.
2145 #[serde(default, skip_serializing_if = "Option::is_none")]
2146 pub format: Option<String>,
2147 /// items specifies fields of an array.
2148 /// NOTE: Can only be set if type is array.
2149 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2150 /// because recursive validation is not possible.
2151 #[serde(default, skip_serializing_if = "Option::is_none")]
2152 pub items: Option<serde_json::Value>,
2153 /// maxItems is the max length of an array variable.
2154 /// NOTE: Can only be set if type is array.
2155 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")]
2156 pub max_items: Option<i64>,
2157 /// maxLength is the max length of a string variable.
2158 /// NOTE: Can only be set if type is string.
2159 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")]
2160 pub max_length: Option<i64>,
2161 /// maxProperties is the maximum amount of entries in a map or properties in an object.
2162 /// NOTE: Can only be set if type is object.
2163 #[serde(
2164 default,
2165 skip_serializing_if = "Option::is_none",
2166 rename = "maxProperties"
2167 )]
2168 pub max_properties: Option<i64>,
2169 /// maximum is the maximum of an integer or number variable.
2170 /// If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum.
2171 /// If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum.
2172 /// NOTE: Can only be set if type is integer or number.
2173 #[serde(default, skip_serializing_if = "Option::is_none")]
2174 pub maximum: Option<i64>,
2175 /// minItems is the min length of an array variable.
2176 /// NOTE: Can only be set if type is array.
2177 #[serde(default, skip_serializing_if = "Option::is_none", rename = "minItems")]
2178 pub min_items: Option<i64>,
2179 /// minLength is the min length of a string variable.
2180 /// NOTE: Can only be set if type is string.
2181 #[serde(default, skip_serializing_if = "Option::is_none", rename = "minLength")]
2182 pub min_length: Option<i64>,
2183 /// minProperties is the minimum amount of entries in a map or properties in an object.
2184 /// NOTE: Can only be set if type is object.
2185 #[serde(
2186 default,
2187 skip_serializing_if = "Option::is_none",
2188 rename = "minProperties"
2189 )]
2190 pub min_properties: Option<i64>,
2191 /// minimum is the minimum of an integer or number variable.
2192 /// If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum.
2193 /// If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum.
2194 /// NOTE: Can only be set if type is integer or number.
2195 #[serde(default, skip_serializing_if = "Option::is_none")]
2196 pub minimum: Option<i64>,
2197 /// not specifies that the variable must not validate against the subschema.
2198 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2199 /// because recursive validation is not possible.
2200 #[serde(default, skip_serializing_if = "Option::is_none")]
2201 pub not: Option<serde_json::Value>,
2202 /// oneOf specifies that the variable must validate against exactly one of the subschemas in the array.
2203 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2204 /// because recursive validation is not possible.
2205 #[serde(default, skip_serializing_if = "Option::is_none", rename = "oneOf")]
2206 pub one_of: Option<serde_json::Value>,
2207 /// pattern is the regex which a string variable must match.
2208 /// NOTE: Can only be set if type is string.
2209 #[serde(default, skip_serializing_if = "Option::is_none")]
2210 pub pattern: Option<String>,
2211 /// properties specifies fields of an object.
2212 /// NOTE: Can only be set if type is object.
2213 /// NOTE: Properties is mutually exclusive with AdditionalProperties.
2214 /// NOTE: This field uses PreserveUnknownFields and Schemaless,
2215 /// because recursive validation is not possible.
2216 #[serde(default, skip_serializing_if = "Option::is_none")]
2217 pub properties: Option<serde_json::Value>,
2218 /// required specifies which fields of an object are required.
2219 /// NOTE: Can only be set if type is object.
2220 #[serde(default, skip_serializing_if = "Option::is_none")]
2221 pub required: Option<Vec<String>>,
2222 /// type is the type of the variable.
2223 /// Valid values are: object, array, string, integer, number or boolean.
2224 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2225 pub r#type: Option<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaType>,
2226 /// uniqueItems specifies if items in an array must be unique.
2227 /// NOTE: Can only be set if type is array.
2228 #[serde(
2229 default,
2230 skip_serializing_if = "Option::is_none",
2231 rename = "uniqueItems"
2232 )]
2233 pub unique_items: Option<bool>,
2234 /// x-kubernetes-int-or-string specifies that this value is
2235 /// either an integer or a string. If this is true, an empty
2236 /// type is allowed and type as child of anyOf is permitted
2237 /// if following one of the following patterns:
2238 ///
2239 /// 1) anyOf:
2240 /// - type: integer
2241 /// - type: string
2242 /// 2) allOf:
2243 /// - anyOf:
2244 /// - type: integer
2245 /// - type: string
2246 /// - ... zero or more
2247 #[serde(
2248 default,
2249 skip_serializing_if = "Option::is_none",
2250 rename = "x-kubernetes-int-or-string"
2251 )]
2252 pub x_kubernetes_int_or_string: Option<bool>,
2253 /// x-kubernetes-preserve-unknown-fields allows setting fields in a variable object
2254 /// which are not defined in the variable schema. This affects fields recursively,
2255 /// except if nested properties or additionalProperties are specified in the schema.
2256 #[serde(
2257 default,
2258 skip_serializing_if = "Option::is_none",
2259 rename = "x-kubernetes-preserve-unknown-fields"
2260 )]
2261 pub x_kubernetes_preserve_unknown_fields: Option<bool>,
2262 /// x-kubernetes-validations describes a list of validation rules written in the CEL expression language.
2263 #[serde(
2264 default,
2265 skip_serializing_if = "Option::is_none",
2266 rename = "x-kubernetes-validations"
2267 )]
2268 pub x_kubernetes_validations: Option<
2269 Vec<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidations>,
2270 >,
2271 /// x-metadata is the metadata of a variable or a nested field within a variable.
2272 /// It can be used to add additional data for higher level tools.
2273 #[serde(
2274 default,
2275 skip_serializing_if = "Option::is_none",
2276 rename = "x-metadata"
2277 )]
2278 pub x_metadata: Option<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXMetadata>,
2279}
2280
2281/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
2282/// schema. The schema is a subset of the schema used in
2283/// Kubernetes CRDs.
2284#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2285pub enum ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaType {
2286 #[serde(rename = "object")]
2287 Object,
2288 #[serde(rename = "array")]
2289 Array,
2290 #[serde(rename = "string")]
2291 String,
2292 #[serde(rename = "integer")]
2293 Integer,
2294 #[serde(rename = "number")]
2295 Number,
2296 #[serde(rename = "boolean")]
2297 Boolean,
2298}
2299
2300/// ValidationRule describes a validation rule written in the CEL expression language.
2301#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2302pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidations {
2303 /// fieldPath represents the field path returned when the validation fails.
2304 /// It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field.
2305 /// e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo`
2306 /// If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList`
2307 /// It does not support list numeric index.
2308 /// It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](<https://kubernetes.io/docs/reference/kubectl/jsonpath/)> for more info.
2309 /// Numeric index of array is not supported.
2310 /// For field name which contains special characters, use `['specialName']` to refer the field name.
2311 /// e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`
2312 #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
2313 pub field_path: Option<String>,
2314 /// message represents the message displayed when validation fails. The message is required if the Rule contains
2315 /// line breaks. The message must not contain line breaks.
2316 /// If unset, the message is "failed rule: {Rule}".
2317 /// e.g. "must be a URL with the host matching spec.host"
2318 #[serde(default, skip_serializing_if = "Option::is_none")]
2319 pub message: Option<String>,
2320 /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
2321 /// Since messageExpression is used as a failure message, it must evaluate to a string.
2322 /// If both message and messageExpression are present on a rule, then messageExpression will be used if validation
2323 /// fails. If messageExpression results in a runtime error, the validation failure message is produced
2324 /// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
2325 /// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset.
2326 /// messageExpression has access to all the same variables as the rule; the only difference is the return type.
2327 /// Example:
2328 /// "x must be less than max ("+string(self.max)+")"
2329 #[serde(
2330 default,
2331 skip_serializing_if = "Option::is_none",
2332 rename = "messageExpression"
2333 )]
2334 pub message_expression: Option<String>,
2335 /// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
2336 /// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
2337 /// If not set, default to use "FieldValueInvalid".
2338 /// All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid.
2339 #[serde(default, skip_serializing_if = "Option::is_none")]
2340 pub reason: Option<
2341 ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidationsReason,
2342 >,
2343 /// rule represents the expression which will be evaluated by CEL.
2344 /// ref: <https://github.com/google/cel-spec>
2345 /// The Rule is scoped to the location of the x-kubernetes-validations extension in the schema.
2346 /// The `self` variable in the CEL expression is bound to the scoped value.
2347 /// If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable
2348 /// via `self.field` and field presence can be checked via `has(self.field)`.
2349 /// If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map
2350 /// are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map
2351 /// are accessible via CEL macros and functions such as `self.all(...)`.
2352 /// If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and
2353 /// functions.
2354 /// If the Rule is scoped to a scalar, `self` is bound to the scalar value.
2355 /// Examples:
2356 /// - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"}
2357 /// - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"}
2358 /// - Rule scoped to a string value: {"rule": "self.startsWith('kube')"}
2359 ///
2360 /// Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL
2361 /// expressions. This includes:
2362 /// - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields.
2363 /// - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as:
2364 /// - A schema with no type and x-kubernetes-preserve-unknown-fields set to true
2365 /// - An array where the items schema is of an "unknown type"
2366 /// - An object where the additionalProperties schema is of an "unknown type"
2367 ///
2368 /// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
2369 /// Accessible property names are escaped according to the following rules when accessed in the expression:
2370 /// - '__' escapes to '__underscores__'
2371 /// - '.' escapes to '__dot__'
2372 /// - '-' escapes to '__dash__'
2373 /// - '/' escapes to '__slash__'
2374 /// - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
2375 /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
2376 /// "import", "let", "loop", "package", "namespace", "return".
2377 /// Examples:
2378 /// - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"}
2379 /// - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"}
2380 /// - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"}
2381 ///
2382 /// If `rule` makes use of the `oldSelf` variable it is implicitly a
2383 /// `transition rule`.
2384 ///
2385 /// By default, the `oldSelf` variable is the same type as `self`.
2386 ///
2387 /// Transition rules by default are applied only on UPDATE requests and are
2388 /// skipped if an old value could not be found.
2389 pub rule: String,
2390}
2391
2392/// ValidationRule describes a validation rule written in the CEL expression language.
2393#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2394pub enum ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidationsReason {
2395 FieldValueInvalid,
2396 FieldValueForbidden,
2397 FieldValueRequired,
2398 FieldValueDuplicate,
2399}
2400
2401/// x-metadata is the metadata of a variable or a nested field within a variable.
2402/// It can be used to add additional data for higher level tools.
2403#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
2404pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXMetadata {
2405 /// annotations is an unstructured key value map that can be used to store and
2406 /// retrieve arbitrary metadata.
2407 /// They are not queryable.
2408 #[serde(default, skip_serializing_if = "Option::is_none")]
2409 pub annotations: Option<BTreeMap<String, String>>,
2410 /// labels is a map of string keys and values that can be used to organize and categorize
2411 /// (scope and select) variables.
2412 #[serde(default, skip_serializing_if = "Option::is_none")]
2413 pub labels: Option<BTreeMap<String, String>>,
2414}