1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct Device {
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::v1::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::v1::DeviceCapacity>>,
48
49 pub consumes_counters: Option<std::vec::Vec<crate::api::resource::v1::DeviceCounterConsumption>>,
55
56 pub name: std::string::String,
58
59 pub node_allocatable_resource_mappings: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1::NodeAllocatableResourceMapping>>,
61
62 pub node_name: Option<std::string::String>,
66
67 pub node_selector: Option<crate::api::core::v1::NodeSelector>,
73
74 pub taints: Option<std::vec::Vec<crate::api::resource::v1::DeviceTaint>>,
80}
81
82impl crate::DeepMerge for Device {
83 fn merge_from(&mut self, other: Self) {
84 crate::DeepMerge::merge_from(&mut self.all_nodes, other.all_nodes);
85 crate::DeepMerge::merge_from(&mut self.allow_multiple_allocations, other.allow_multiple_allocations);
86 crate::merge_strategies::map::granular(&mut self.attributes, other.attributes, |current_item, other_item| {
87 crate::DeepMerge::merge_from(current_item, other_item);
88 });
89 crate::merge_strategies::list::atomic(&mut self.binding_conditions, other.binding_conditions);
90 crate::merge_strategies::list::atomic(&mut self.binding_failure_conditions, other.binding_failure_conditions);
91 crate::DeepMerge::merge_from(&mut self.binds_to_node, other.binds_to_node);
92 crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| {
93 crate::DeepMerge::merge_from(current_item, other_item);
94 });
95 crate::merge_strategies::list::atomic(&mut self.consumes_counters, other.consumes_counters);
96 crate::DeepMerge::merge_from(&mut self.name, other.name);
97 crate::merge_strategies::map::granular(&mut self.node_allocatable_resource_mappings, other.node_allocatable_resource_mappings, |current_item, other_item| {
98 crate::DeepMerge::merge_from(current_item, other_item);
99 });
100 crate::DeepMerge::merge_from(&mut self.node_name, other.node_name);
101 crate::DeepMerge::merge_from(&mut self.node_selector, other.node_selector);
102 crate::merge_strategies::list::atomic(&mut self.taints, other.taints);
103 }
104}
105
106impl<'de> crate::serde::Deserialize<'de> for Device {
107 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
108 #[allow(non_camel_case_types)]
109 enum Field {
110 Key_all_nodes,
111 Key_allow_multiple_allocations,
112 Key_attributes,
113 Key_binding_conditions,
114 Key_binding_failure_conditions,
115 Key_binds_to_node,
116 Key_capacity,
117 Key_consumes_counters,
118 Key_name,
119 Key_node_allocatable_resource_mappings,
120 Key_node_name,
121 Key_node_selector,
122 Key_taints,
123 Other,
124 }
125
126 impl<'de> crate::serde::Deserialize<'de> for Field {
127 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
128 struct Visitor;
129
130 impl crate::serde::de::Visitor<'_> for Visitor {
131 type Value = Field;
132
133 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
134 f.write_str("field identifier")
135 }
136
137 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
138 Ok(match v {
139 "allNodes" => Field::Key_all_nodes,
140 "allowMultipleAllocations" => Field::Key_allow_multiple_allocations,
141 "attributes" => Field::Key_attributes,
142 "bindingConditions" => Field::Key_binding_conditions,
143 "bindingFailureConditions" => Field::Key_binding_failure_conditions,
144 "bindsToNode" => Field::Key_binds_to_node,
145 "capacity" => Field::Key_capacity,
146 "consumesCounters" => Field::Key_consumes_counters,
147 "name" => Field::Key_name,
148 "nodeAllocatableResourceMappings" => Field::Key_node_allocatable_resource_mappings,
149 "nodeName" => Field::Key_node_name,
150 "nodeSelector" => Field::Key_node_selector,
151 "taints" => Field::Key_taints,
152 _ => Field::Other,
153 })
154 }
155 }
156
157 deserializer.deserialize_identifier(Visitor)
158 }
159 }
160
161 struct Visitor;
162
163 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
164 type Value = Device;
165
166 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
167 f.write_str("Device")
168 }
169
170 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
171 let mut value_all_nodes: Option<bool> = None;
172 let mut value_allow_multiple_allocations: Option<bool> = None;
173 let mut value_attributes: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1::DeviceAttribute>> = None;
174 let mut value_binding_conditions: Option<std::vec::Vec<std::string::String>> = None;
175 let mut value_binding_failure_conditions: Option<std::vec::Vec<std::string::String>> = None;
176 let mut value_binds_to_node: Option<bool> = None;
177 let mut value_capacity: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1::DeviceCapacity>> = None;
178 let mut value_consumes_counters: Option<std::vec::Vec<crate::api::resource::v1::DeviceCounterConsumption>> = None;
179 let mut value_name: Option<std::string::String> = None;
180 let mut value_node_allocatable_resource_mappings: Option<std::collections::BTreeMap<std::string::String, crate::api::resource::v1::NodeAllocatableResourceMapping>> = None;
181 let mut value_node_name: Option<std::string::String> = None;
182 let mut value_node_selector: Option<crate::api::core::v1::NodeSelector> = None;
183 let mut value_taints: Option<std::vec::Vec<crate::api::resource::v1::DeviceTaint>> = None;
184
185 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
186 match key {
187 Field::Key_all_nodes => value_all_nodes = crate::serde::de::MapAccess::next_value(&mut map)?,
188 Field::Key_allow_multiple_allocations => value_allow_multiple_allocations = crate::serde::de::MapAccess::next_value(&mut map)?,
189 Field::Key_attributes => value_attributes = crate::serde::de::MapAccess::next_value(&mut map)?,
190 Field::Key_binding_conditions => value_binding_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
191 Field::Key_binding_failure_conditions => value_binding_failure_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
192 Field::Key_binds_to_node => value_binds_to_node = crate::serde::de::MapAccess::next_value(&mut map)?,
193 Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?,
194 Field::Key_consumes_counters => value_consumes_counters = crate::serde::de::MapAccess::next_value(&mut map)?,
195 Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?,
196 Field::Key_node_allocatable_resource_mappings => value_node_allocatable_resource_mappings = crate::serde::de::MapAccess::next_value(&mut map)?,
197 Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?,
198 Field::Key_node_selector => value_node_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
199 Field::Key_taints => value_taints = crate::serde::de::MapAccess::next_value(&mut map)?,
200 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
201 }
202 }
203
204 Ok(Device {
205 all_nodes: value_all_nodes,
206 allow_multiple_allocations: value_allow_multiple_allocations,
207 attributes: value_attributes,
208 binding_conditions: value_binding_conditions,
209 binding_failure_conditions: value_binding_failure_conditions,
210 binds_to_node: value_binds_to_node,
211 capacity: value_capacity,
212 consumes_counters: value_consumes_counters,
213 name: value_name.unwrap_or_default(),
214 node_allocatable_resource_mappings: value_node_allocatable_resource_mappings,
215 node_name: value_node_name,
216 node_selector: value_node_selector,
217 taints: value_taints,
218 })
219 }
220 }
221
222 deserializer.deserialize_struct(
223 "Device",
224 &[
225 "allNodes",
226 "allowMultipleAllocations",
227 "attributes",
228 "bindingConditions",
229 "bindingFailureConditions",
230 "bindsToNode",
231 "capacity",
232 "consumesCounters",
233 "name",
234 "nodeAllocatableResourceMappings",
235 "nodeName",
236 "nodeSelector",
237 "taints",
238 ],
239 Visitor,
240 )
241 }
242}
243
244impl crate::serde::Serialize for Device {
245 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
246 let mut state = serializer.serialize_struct(
247 "Device",
248 1 +
249 self.all_nodes.as_ref().map_or(0, |_| 1) +
250 self.allow_multiple_allocations.as_ref().map_or(0, |_| 1) +
251 self.attributes.as_ref().map_or(0, |_| 1) +
252 self.binding_conditions.as_ref().map_or(0, |_| 1) +
253 self.binding_failure_conditions.as_ref().map_or(0, |_| 1) +
254 self.binds_to_node.as_ref().map_or(0, |_| 1) +
255 self.capacity.as_ref().map_or(0, |_| 1) +
256 self.consumes_counters.as_ref().map_or(0, |_| 1) +
257 self.node_allocatable_resource_mappings.as_ref().map_or(0, |_| 1) +
258 self.node_name.as_ref().map_or(0, |_| 1) +
259 self.node_selector.as_ref().map_or(0, |_| 1) +
260 self.taints.as_ref().map_or(0, |_| 1),
261 )?;
262 if let Some(value) = &self.all_nodes {
263 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allNodes", value)?;
264 }
265 if let Some(value) = &self.allow_multiple_allocations {
266 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowMultipleAllocations", value)?;
267 }
268 if let Some(value) = &self.attributes {
269 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attributes", value)?;
270 }
271 if let Some(value) = &self.binding_conditions {
272 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindingConditions", value)?;
273 }
274 if let Some(value) = &self.binding_failure_conditions {
275 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindingFailureConditions", value)?;
276 }
277 if let Some(value) = &self.binds_to_node {
278 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bindsToNode", value)?;
279 }
280 if let Some(value) = &self.capacity {
281 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?;
282 }
283 if let Some(value) = &self.consumes_counters {
284 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "consumesCounters", value)?;
285 }
286 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?;
287 if let Some(value) = &self.node_allocatable_resource_mappings {
288 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAllocatableResourceMappings", value)?;
289 }
290 if let Some(value) = &self.node_name {
291 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?;
292 }
293 if let Some(value) = &self.node_selector {
294 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelector", value)?;
295 }
296 if let Some(value) = &self.taints {
297 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "taints", value)?;
298 }
299 crate::serde::ser::SerializeStruct::end(state)
300 }
301}
302
303#[cfg(feature = "schemars")]
304impl crate::schemars::JsonSchema for Device {
305 fn schema_name() -> std::borrow::Cow<'static, str> {
306 "io.k8s.api.resource.v1.Device".into()
307 }
308
309 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
310 crate::schemars::json_schema!({
311 "description": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.",
312 "type": "object",
313 "properties": {
314 "allNodes": {
315 "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.",
316 "type": "boolean",
317 },
318 "allowMultipleAllocations": {
319 "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.",
320 "type": "boolean",
321 },
322 "attributes": {
323 "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.",
324 "type": "object",
325 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1::DeviceAttribute>()),
326 },
327 "bindingConditions": {
328 "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.",
329 "type": "array",
330 "items": {
331 "type": "string",
332 },
333 },
334 "bindingFailureConditions": {
335 "description": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"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.",
336 "type": "array",
337 "items": {
338 "type": "string",
339 },
340 },
341 "bindsToNode": {
342 "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.",
343 "type": "boolean",
344 },
345 "capacity": {
346 "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.",
347 "type": "object",
348 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1::DeviceCapacity>()),
349 },
350 "consumesCounters": {
351 "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.",
352 "type": "array",
353 "items": (__gen.subschema_for::<crate::api::resource::v1::DeviceCounterConsumption>()),
354 },
355 "name": {
356 "description": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.",
357 "type": "string",
358 },
359 "nodeAllocatableResourceMappings": {
360 "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.",
361 "type": "object",
362 "additionalProperties": (__gen.subschema_for::<crate::api::resource::v1::NodeAllocatableResourceMapping>()),
363 },
364 "nodeName": {
365 "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.",
366 "type": "string",
367 },
368 "nodeSelector": ({
369 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NodeSelector>();
370 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());
371 schema_obj
372 }),
373 "taints": {
374 "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.",
375 "type": "array",
376 "items": (__gen.subschema_for::<crate::api::resource::v1::DeviceTaint>()),
377 },
378 },
379 "required": [
380 "name",
381 ],
382 })
383 }
384}
385
386#[cfg(feature = "schemars08")]
387impl crate::schemars08::JsonSchema for Device {
388 fn schema_name() -> std::string::String {
389 "io.k8s.api.resource.v1.Device".into()
390 }
391
392 fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
393 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
394 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
395 description: Some("Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.".into()),
396 ..Default::default()
397 })),
398 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
399 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
400 properties: [
401 (
402 "allNodes".into(),
403 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
404 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
405 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()),
406 ..Default::default()
407 })),
408 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
409 ..Default::default()
410 }),
411 ),
412 (
413 "allowMultipleAllocations".into(),
414 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
415 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
416 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()),
417 ..Default::default()
418 })),
419 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
420 ..Default::default()
421 }),
422 ),
423 (
424 "attributes".into(),
425 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
426 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
427 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()),
428 ..Default::default()
429 })),
430 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
431 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
432 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1::DeviceAttribute>())),
433 ..Default::default()
434 })),
435 ..Default::default()
436 }),
437 ),
438 (
439 "bindingConditions".into(),
440 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
441 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
442 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()),
443 ..Default::default()
444 })),
445 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
446 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
447 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(
448 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
449 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
450 ..Default::default()
451 })
452 ))),
453 ..Default::default()
454 })),
455 ..Default::default()
456 }),
457 ),
458 (
459 "bindingFailureConditions".into(),
460 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
461 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
462 description: Some("BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"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()),
463 ..Default::default()
464 })),
465 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
466 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
467 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(
468 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
469 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
470 ..Default::default()
471 })
472 ))),
473 ..Default::default()
474 })),
475 ..Default::default()
476 }),
477 ),
478 (
479 "bindsToNode".into(),
480 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
481 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
482 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()),
483 ..Default::default()
484 })),
485 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
486 ..Default::default()
487 }),
488 ),
489 (
490 "capacity".into(),
491 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
492 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
493 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()),
494 ..Default::default()
495 })),
496 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
497 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
498 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1::DeviceCapacity>())),
499 ..Default::default()
500 })),
501 ..Default::default()
502 }),
503 ),
504 (
505 "consumesCounters".into(),
506 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
507 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
508 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()),
509 ..Default::default()
510 })),
511 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
512 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
513 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1::DeviceCounterConsumption>()))),
514 ..Default::default()
515 })),
516 ..Default::default()
517 }),
518 ),
519 (
520 "name".into(),
521 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
522 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
523 description: Some("Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.".into()),
524 ..Default::default()
525 })),
526 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
527 ..Default::default()
528 }),
529 ),
530 (
531 "nodeAllocatableResourceMappings".into(),
532 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
533 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
534 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()),
535 ..Default::default()
536 })),
537 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
538 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
539 additional_properties: Some(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1::NodeAllocatableResourceMapping>())),
540 ..Default::default()
541 })),
542 ..Default::default()
543 }),
544 ),
545 (
546 "nodeName".into(),
547 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
548 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
549 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()),
550 ..Default::default()
551 })),
552 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
553 ..Default::default()
554 }),
555 ),
556 (
557 "nodeSelector".into(),
558 {
559 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NodeSelector>().into_object();
560 schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
561 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()),
562 ..Default::default()
563 }));
564 crate::schemars08::schema::Schema::Object(schema_obj)
565 },
566 ),
567 (
568 "taints".into(),
569 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
570 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
571 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()),
572 ..Default::default()
573 })),
574 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
575 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
576 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::api::resource::v1::DeviceTaint>()))),
577 ..Default::default()
578 })),
579 ..Default::default()
580 }),
581 ),
582 ].into(),
583 required: [
584 "name".into(),
585 ].into(),
586 ..Default::default()
587 })),
588 ..Default::default()
589 })
590 }
591}