1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct BasicDevice {
6 pub all_nodes: Option<bool>,
10
11 pub allow_multiple_allocations: Option<bool>,
15
16 pub attributes: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::DeviceAttribute>>,
20
21 pub binding_conditions: Option<std::vec::Vec<std::string::String>>,
29
30 pub binding_failure_conditions: Option<std::vec::Vec<std::string::String>>,
38
39 pub binds_to_node: Option<bool>,
43
44 pub capacity: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::DeviceCapacity>>,
48
49 pub consumes_counters: Option<std::vec::Vec<crate::api::resource::v1beta1::DeviceCounterConsumption>>,
55
56 pub node_allocatable_resource_mappings: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::NodeAllocatableResourceMapping>>,
58
59 pub node_name: Option<std::string::String>,
63
64 pub node_selector: Option<crate::api::core::v1::NodeSelector>,
70
71 pub taints: Option<std::vec::Vec<crate::api::resource::v1beta1::DeviceTaint>>,
77}
78
79impl crate::DeepMerge for BasicDevice {
80 fn merge_from(&mut self, other: Self) {
81 crate::DeepMerge::merge_from(&mut self.all_nodes, other.all_nodes);
82 crate::DeepMerge::merge_from(&mut self.allow_multiple_allocations, other.allow_multiple_allocations);
83 crate::merge_strategies::map::granular(&mut self.attributes, other.attributes, |current_item, other_item| {
84 crate::DeepMerge::merge_from(current_item, other_item);
85 });
86 crate::merge_strategies::list::atomic(&mut self.binding_conditions, other.binding_conditions);
87 crate::merge_strategies::list::atomic(&mut self.binding_failure_conditions, other.binding_failure_conditions);
88 crate::DeepMerge::merge_from(&mut self.binds_to_node, other.binds_to_node);
89 crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| {
90 crate::DeepMerge::merge_from(current_item, other_item);
91 });
92 crate::merge_strategies::list::atomic(&mut self.consumes_counters, other.consumes_counters);
93 crate::merge_strategies::map::granular(&mut self.node_allocatable_resource_mappings, other.node_allocatable_resource_mappings, |current_item, other_item| {
94 crate::DeepMerge::merge_from(current_item, other_item);
95 });
96 crate::DeepMerge::merge_from(&mut self.node_name, other.node_name);
97 crate::DeepMerge::merge_from(&mut self.node_selector, other.node_selector);
98 crate::merge_strategies::list::atomic(&mut self.taints, other.taints);
99 }
100}
101
102impl<'de> crate::serde::Deserialize<'de> for BasicDevice {
103 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
104 #[allow(non_camel_case_types)]
105 enum Field {
106 Key_all_nodes,
107 Key_allow_multiple_allocations,
108 Key_attributes,
109 Key_binding_conditions,
110 Key_binding_failure_conditions,
111 Key_binds_to_node,
112 Key_capacity,
113 Key_consumes_counters,
114 Key_node_allocatable_resource_mappings,
115 Key_node_name,
116 Key_node_selector,
117 Key_taints,
118 Other,
119 }
120
121 impl<'de> crate::serde::Deserialize<'de> for Field {
122 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
123 struct Visitor;
124
125 impl crate::serde::de::Visitor<'_> for Visitor {
126 type Value = Field;
127
128 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
129 f.write_str("field identifier")
130 }
131
132 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
133 Ok(match v {
134 "allNodes" => Field::Key_all_nodes,
135 "allowMultipleAllocations" => Field::Key_allow_multiple_allocations,
136 "attributes" => Field::Key_attributes,
137 "bindingConditions" => Field::Key_binding_conditions,
138 "bindingFailureConditions" => Field::Key_binding_failure_conditions,
139 "bindsToNode" => Field::Key_binds_to_node,
140 "capacity" => Field::Key_capacity,
141 "consumesCounters" => Field::Key_consumes_counters,
142 "nodeAllocatableResourceMappings" => Field::Key_node_allocatable_resource_mappings,
143 "nodeName" => Field::Key_node_name,
144 "nodeSelector" => Field::Key_node_selector,
145 "taints" => Field::Key_taints,
146 _ => Field::Other,
147 })
148 }
149 }
150
151 deserializer.deserialize_identifier(Visitor)
152 }
153 }
154
155 struct Visitor;
156
157 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
158 type Value = BasicDevice;
159
160 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
161 f.write_str("BasicDevice")
162 }
163
164 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
165 let mut value_all_nodes: Option<bool> = None;
166 let mut value_allow_multiple_allocations: Option<bool> = None;
167 let mut value_attributes: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::DeviceAttribute>> = None;
168 let mut value_binding_conditions: Option<std::vec::Vec<std::string::String>> = None;
169 let mut value_binding_failure_conditions: Option<std::vec::Vec<std::string::String>> = None;
170 let mut value_binds_to_node: Option<bool> = None;
171 let mut value_capacity: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::DeviceCapacity>> = None;
172 let mut value_consumes_counters: Option<std::vec::Vec<crate::api::resource::v1beta1::DeviceCounterConsumption>> = None;
173 let mut value_node_allocatable_resource_mappings: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1beta1::NodeAllocatableResourceMapping>> = None;
174 let mut value_node_name: Option<std::string::String> = None;
175 let mut value_node_selector: Option<crate::api::core::v1::NodeSelector> = None;
176 let mut value_taints: Option<std::vec::Vec<crate::api::resource::v1beta1::DeviceTaint>> = None;
177
178 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
179 match key {
180 Field::Key_all_nodes => value_all_nodes = crate::serde::de::MapAccess::next_value(&mut map)?,
181 Field::Key_allow_multiple_allocations => value_allow_multiple_allocations = crate::serde::de::MapAccess::next_value(&mut map)?,
182 Field::Key_attributes => value_attributes = crate::serde::de::MapAccess::next_value(&mut map)?,
183 Field::Key_binding_conditions => value_binding_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
184 Field::Key_binding_failure_conditions => value_binding_failure_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
185 Field::Key_binds_to_node => value_binds_to_node = crate::serde::de::MapAccess::next_value(&mut map)?,
186 Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?,
187 Field::Key_consumes_counters => value_consumes_counters = crate::serde::de::MapAccess::next_value(&mut map)?,
188 Field::Key_node_allocatable_resource_mappings => value_node_allocatable_resource_mappings = crate::serde::de::MapAccess::next_value(&mut map)?,
189 Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?,
190 Field::Key_node_selector => value_node_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
191 Field::Key_taints => value_taints = crate::serde::de::MapAccess::next_value(&mut map)?,
192 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
193 }
194 }
195
196 Ok(BasicDevice {
197 all_nodes: value_all_nodes,
198 allow_multiple_allocations: value_allow_multiple_allocations,
199 attributes: value_attributes,
200 binding_conditions: value_binding_conditions,
201 binding_failure_conditions: value_binding_failure_conditions,
202 binds_to_node: value_binds_to_node,
203 capacity: value_capacity,
204 consumes_counters: value_consumes_counters,
205 node_allocatable_resource_mappings: value_node_allocatable_resource_mappings,
206 node_name: value_node_name,
207 node_selector: value_node_selector,
208 taints: value_taints,
209 })
210 }
211 }
212
213 deserializer.deserialize_struct(
214 "BasicDevice",
215 &[
216 "allNodes",
217 "allowMultipleAllocations",
218 "attributes",
219 "bindingConditions",
220 "bindingFailureConditions",
221 "bindsToNode",
222 "capacity",
223 "consumesCounters",
224 "nodeAllocatableResourceMappings",
225 "nodeName",
226 "nodeSelector",
227 "taints",
228 ],
229 Visitor,
230 )
231 }
232}
233
234impl crate::serde::Serialize for BasicDevice {
235 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
236 let mut state = serializer.serialize_struct(
237 "BasicDevice",
238 self.all_nodes.as_ref().map_or(0, |_| 1) +
239 self.allow_multiple_allocations.as_ref().map_or(0, |_| 1) +
240 self.attributes.as_ref().map_or(0, |_| 1) +
241 self.binding_conditions.as_ref().map_or(0, |_| 1) +
242 self.binding_failure_conditions.as_ref().map_or(0, |_| 1) +
243 self.binds_to_node.as_ref().map_or(0, |_| 1) +
244 self.capacity.as_ref().map_or(0, |_| 1) +
245 self.consumes_counters.as_ref().map_or(0, |_| 1) +
246 self.node_allocatable_resource_mappings.as_ref().map_or(0, |_| 1) +
247 self.node_name.as_ref().map_or(0, |_| 1) +
248 self.node_selector.as_ref().map_or(0, |_| 1) +
249 self.taints.as_ref().map_or(0, |_| 1),
250 )?;
251 if let Some(value) = &self.all_nodes {
252 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allNodes", value)?;
253 }
254 if let Some(value) = &self.allow_multiple_allocations {
255 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowMultipleAllocations", value)?;
256 }
257 if let Some(value) = &self.attributes {
258 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attributes", value)?;
259 }
260 if let Some(value) = &self.binding_conditions {
261 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindingConditions", value)?;
262 }
263 if let Some(value) = &self.binding_failure_conditions {
264 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindingFailureConditions", value)?;
265 }
266 if let Some(value) = &self.binds_to_node {
267 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindsToNode", value)?;
268 }
269 if let Some(value) = &self.capacity {
270 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?;
271 }
272 if let Some(value) = &self.consumes_counters {
273 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "consumesCounters", value)?;
274 }
275 if let Some(value) = &self.node_allocatable_resource_mappings {
276 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAllocatableResourceMappings", value)?;
277 }
278 if let Some(value) = &self.node_name {
279 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?;
280 }
281 if let Some(value) = &self.node_selector {
282 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelector", value)?;
283 }
284 if let Some(value) = &self.taints {
285 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "taints", value)?;
286 }
287 crate::serde::ser::SerializeStruct::end(state)
288 }
289}
290
291#[cfg(feature = "schemars")]
292impl crate::schemars::JsonSchema for BasicDevice {
293 fn schema_name() -> std::borrow::Cow<'static, str> {
294 "io.k8s.api.resource.v1beta1.BasicDevice".into()
295 }
296
297 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
298 crate::schemars::json_schema!({
299 "description": "BasicDevice defines one device instance.",
300 "type": "object",
301 "properties": {
302 "allNodes": {
303 "description": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
304 "type": "boolean",
305 },
306 "allowMultipleAllocations": {
307 "description": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.",
308 "type": "boolean",
309 },
310 "attributes": {
311 "description": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
312 "type": "object",
313 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1beta1::DeviceAttribute>()),
314 },
315 "bindingConditions": {
316 "description": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
317 "type": "array",
318 "items": {
319 "type": "string",
320 },
321 },
322 "bindingFailureConditions": {
323 "description": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
324 "type": "array",
325 "items": {
326 "type": "string",
327 },
328 },
329 "bindsToNode": {
330 "description": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
331 "type": "boolean",
332 },
333 "capacity": {
334 "description": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
335 "type": "object",
336 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1beta1::DeviceCapacity>()),
337 },
338 "consumesCounters": {
339 "description": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.",
340 "type": "array",
341 "items": (__gen.subschema_for::<crate::api::resource::v1beta1::DeviceCounterConsumption>()),
342 },
343 "nodeAllocatableResourceMappings": {
344 "description": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.",
345 "type": "object",
346 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1beta1::NodeAllocatableResourceMapping>()),
347 },
348 "nodeName": {
349 "description": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
350 "type": "string",
351 },
352 "nodeSelector": ({
353 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NodeSelector>();
354 schema_obj.ensure_object().insert("description".into(), "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.".into());
355 schema_obj
356 }),
357 "taints": {
358 "description": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
359 "type": "array",
360 "items": (__gen.subschema_for::<crate::api::resource::v1beta1::DeviceTaint>()),
361 },
362 },
363 })
364 }
365}
366
367#[cfg(feature = "schemars08")]
368impl crate::schemars08::JsonSchema for BasicDevice {
369 fn schema_name() -> std::string::String {
370 "io.k8s.api.resource.v1beta1.BasicDevice".into()
371 }
372
373 fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
374 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
375 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
376 description: Some("BasicDevice defines one device instance.".into()),
377 ..Default::default()
378 })),
379 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
380 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
381 properties: [
382 (
383 "allNodes".into(),
384 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
385 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
386 description: Some("AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.".into()),
387 ..Default::default()
388 })),
389 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
390 ..Default::default()
391 }),
392 ),
393 (
394 "allowMultipleAllocations".into(),
395 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
396 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
397 description: Some("AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.".into()),
398 ..Default::default()
399 })),
400 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
401 ..Default::default()
402 }),
403 ),
404 (
405 "attributes".into(),
406 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
407 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
408 description: Some("Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.".into()),
409 ..Default::default()
410 })),
411 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
412 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
413 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1beta1::DeviceAttribute>())),
414 ..Default::default()
415 })),
416 ..Default::default()
417 }),
418 ),
419 (
420 "bindingConditions".into(),
421 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
422 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
423 description: Some("BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.".into()),
424 ..Default::default()
425 })),
426 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
427 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
428 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(
429 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
430 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
431 ..Default::default()
432 })
433 ))),
434 ..Default::default()
435 })),
436 ..Default::default()
437 }),
438 ),
439 (
440 "bindingFailureConditions".into(),
441 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
442 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
443 description: Some("BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.".into()),
444 ..Default::default()
445 })),
446 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
447 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
448 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(
449 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
450 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
451 ..Default::default()
452 })
453 ))),
454 ..Default::default()
455 })),
456 ..Default::default()
457 }),
458 ),
459 (
460 "bindsToNode".into(),
461 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
462 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
463 description: Some("BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.".into()),
464 ..Default::default()
465 })),
466 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
467 ..Default::default()
468 }),
469 ),
470 (
471 "capacity".into(),
472 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
473 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
474 description: Some("Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.".into()),
475 ..Default::default()
476 })),
477 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
478 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
479 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1beta1::DeviceCapacity>())),
480 ..Default::default()
481 })),
482 ..Default::default()
483 }),
484 ),
485 (
486 "consumesCounters".into(),
487 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
488 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
489 description: Some("ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.".into()),
490 ..Default::default()
491 })),
492 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
493 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
494 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1beta1::DeviceCounterConsumption>()))),
495 ..Default::default()
496 })),
497 ..Default::default()
498 }),
499 ),
500 (
501 "nodeAllocatableResourceMappings".into(),
502 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
503 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
504 description: Some("NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.".into()),
505 ..Default::default()
506 })),
507 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
508 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
509 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1beta1::NodeAllocatableResourceMapping>())),
510 ..Default::default()
511 })),
512 ..Default::default()
513 }),
514 ),
515 (
516 "nodeName".into(),
517 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
518 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
519 description: Some("NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.".into()),
520 ..Default::default()
521 })),
522 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
523 ..Default::default()
524 }),
525 ),
526 (
527 "nodeSelector".into(),
528 {
529 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NodeSelector>().into_object();
530 schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
531 description: Some("NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.".into()),
532 ..Default::default()
533 }));
534 crate::schemars08::schema::Schema::Object(schema_obj)
535 },
536 ),
537 (
538 "taints".into(),
539 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
540 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
541 description: Some("If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.".into()),
542 ..Default::default()
543 })),
544 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
545 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
546 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1beta1::DeviceTaint>()))),
547 ..Default::default()
548 })),
549 ..Default::default()
550 }),
551 ),
552 ].into(),
553 ..Default::default()
554 })),
555 ..Default::default()
556 })
557 }
558}