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