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