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