1package v1
2
3import (
4 "cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
5 "cue.dev/x/k8s.io/apimachinery/pkg/runtime"
6 v1_9 "cue.dev/x/k8s.io/api/core/v1"
7 "cue.dev/x/k8s.io/apimachinery/pkg/api/resource"
8)
9
10// AllocatedDeviceStatus contains the status of an allocated device, if the
11// driver chooses to report it. This may include driver-specific information.
12//
13// The combination of Driver, Pool, Device, and ShareID must match the
14// corresponding key in Status.Allocation.Devices.
15#AllocatedDeviceStatus: {
16 // Conditions contains the latest observation of the device's state. If the
17 // device has been configured according to the class and claim config
18 // references, the `Ready` condition should be True.
19 //
20 // Must not contain more than 8 entries.
21 "conditions"?: [...v1.#Condition]
22
23 // Data contains arbitrary driver-specific data.
24 //
25 // The length of the raw data must be smaller or equal to 10 Ki.
26 "data"?: runtime.#RawExtension
27
28 // Device references one device instance via its name in the driver's resource
29 // pool. It must be a DNS label.
30 "device"!: string
31
32 // Driver specifies the name of the DRA driver whose kubelet plugin should be
33 // invoked to process the allocation once the claim is needed on a node.
34 //
35 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
36 // of the driver. It should use only lower case characters.
37 "driver"!: string
38
39 // NetworkData contains network-related information specific to the device.
40 "networkData"?: #NetworkDeviceData
41
42 // This name together with the driver name and the device name field identify
43 // which device was allocated (`<driver name>/<pool name>/<device name>`).
44 //
45 // Must not be longer than 253 characters and may contain one or more DNS
46 // sub-domains separated by slashes.
47 "pool"!: string
48
49 // ShareID uniquely identifies an individual allocation share of the device.
50 "shareID"?: string
51}
52
53// AllocationResult contains attributes of an allocated resource.
54#AllocationResult: {
55 // AllocationTimestamp stores the time when the resources were allocated. This
56 // field is not guaranteed to be set, in which case that time is unknown.
57 //
58 // This is a beta field and requires enabling the DRADeviceBindingConditions and
59 // DRAResourceClaimDeviceStatus feature gate.
60 "allocationTimestamp"?: v1.#Time
61
62 // Devices is the result of allocating devices.
63 "devices"?: #DeviceAllocationResult
64
65 // NodeSelector defines where the allocated resources are available. If unset,
66 // they are available everywhere.
67 "nodeSelector"?: v1_9.#NodeSelector
68}
69
70// CELDeviceSelector contains a CEL expression for selecting a device.
71#CELDeviceSelector: {
72 // Expression is a CEL expression which evaluates a single device. It must
73 // evaluate to true when the device under consideration satisfies the desired
74 // criteria, and false when it does not. Any other result is an error and
75 // causes allocation of devices to abort.
76 //
77 // The expression's input is an object named "device", which carries the following properties:
78 // - driver (string): the name of the driver which defines this device.
79 // - attributes (map[string]object): the device's attributes, grouped by prefix
80 // (e.g. device.attributes["dra.example.com"] evaluates to an object with all
81 // of the attributes which were prefixed by "dra.example.com".
82 // - capacity (map[string]object): the device's capacities, grouped by prefix.
83 // - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device
84 // (v1.34+ with the DRAConsumableCapacity feature enabled).
85 //
86 // Example: Consider a device with driver="dra.example.com", which exposes two
87 // attributes named "model" and "ext.example.com/family" and which exposes one
88 // capacity named "modules". This input to this expression would have the
89 // following fields:
90 //
91 // device.driver
92 // device.attributes["dra.example.com"].model
93 // device.attributes["ext.example.com"].family
94 // device.capacity["dra.example.com"].modules
95 //
96 // The device.driver field can be used to check for a specific driver, either as
97 // a high-level precondition (i.e. you only want to consider devices from this
98 // driver) or as part of a multi-clause expression that is meant to consider
99 // devices from different drivers.
100 //
101 // The value type of each attribute is defined by the device definition, and
102 // users who write these expressions must consult the documentation for their
103 // specific drivers. The value type of each capacity is Quantity.
104 //
105 // If an unknown prefix is used as a lookup in either device.attributes or
106 // device.capacity, an empty map will be returned. Any reference to an unknown
107 // field will cause an evaluation error and allocation to abort.
108 //
109 // A robust expression should check for the existence of attributes before referencing them.
110 //
111 // For ease of use, the cel.bind() function is enabled, and can be used to
112 // simplify expressions that access multiple attributes with the same domain.
113 // For example:
114 //
115 // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
116 //
117 // When the DRAListTypeAttributes feature gate is enabled, the includes() helper
118 // is available and it can work for both scalar and list-type attributes. It
119 // was introduced to support smooth migration from scalar attributes to
120 // list-type attributes while keeping CEL expressions simple. For example:
121 //
122 // device.attributes["dra.example.com"].models.includes("some-model")
123 //
124 // The length of the expression must be smaller or equal to 10 Ki. The cost of
125 // evaluating it is also limited based on the estimated number of logical
126 // steps.
127 "expression"!: string
128}
129
130// CapacityRequestPolicy defines how requests consume device capacity.
131//
132// Must not set more than one ValidRequestValues.
133#CapacityRequestPolicy: {
134 // Default specifies how much of this capacity is consumed by a request that
135 // does not contain an entry for it in DeviceRequest's Capacity.
136 "default"?: resource.#Quantity
137
138 // ValidRange defines an acceptable quantity value range in consuming requests.
139 //
140 // If this field is set, Default must be defined and it must fall within the defined ValidRange.
141 //
142 // If the requested amount does not fall within the defined range, the request
143 // violates the policy, and this device cannot be allocated.
144 //
145 // If the request doesn't contain this capacity entry, Default value is used.
146 "validRange"?: #CapacityRequestPolicyRange
147
148 // ValidValues defines a set of acceptable quantity values in consuming requests.
149 //
150 // Must not contain more than 10 entries. Must be sorted in ascending order.
151 //
152 // If this field is set, Default must be defined and it must be included in ValidValues list.
153 //
154 // If the requested amount does not match any valid value but smaller than some
155 // valid values, the scheduler calculates the smallest valid value that is
156 // greater than or equal to the request. That is: min(ceil(requestedValue) ∈
157 // validValues), where requestedValue ≤ max(validValues).
158 //
159 // If the requested amount exceeds all valid values, the request violates the
160 // policy, and this device cannot be allocated.
161 "validValues"?: [...resource.#Quantity]
162}
163
164// CapacityRequestPolicyRange defines a valid range for consumable capacity values.
165//
166// - If the requested amount is less than Min, it is rounded up to the Min value.
167// - If Step is set and the requested amount is between Min and Max but not aligned with Step,
168// it will be rounded up to the next value equal to Min + (n * Step).
169// - If Step is not set, the requested amount is used as-is if it falls within
170// the range Min to Max (if set).
171// - If the requested or rounded amount exceeds Max (if set), the request does
172// not satisfy the policy,
173// and the device cannot be allocated.
174#CapacityRequestPolicyRange: {
175 // Max defines the upper limit for capacity that can be requested.
176 //
177 // Max must be less than or equal to the capacity value. Min and
178 // requestPolicy.default must be less than or equal to the maximum.
179 "max"?: resource.#Quantity
180
181 // Min specifies the minimum capacity allowed for a consumption request.
182 //
183 // Min must be greater than or equal to zero, and less than or equal to the
184 // capacity value. requestPolicy.default must be more than or equal to the
185 // minimum.
186 "min"!: resource.#Quantity
187
188 // Step defines the step size between valid capacity amounts within the range.
189 //
190 // Max (if set) and requestPolicy.default must be a multiple of Step. Min + Step
191 // must be less than or equal to the capacity value.
192 "step"?: resource.#Quantity
193}
194
195// CapacityRequirements defines the capacity requirements for a specific device request.
196#CapacityRequirements: {
197 // Requests represent individual device resource requests for distinct
198 // resources, all of which must be provided by the device.
199 //
200 // This value is used as an additional filtering condition against the available
201 // capacity on the device. This is semantically equivalent to a CEL selector
202 // with `device.capacity[<domain>].<name>.compareTo(quantity(<request
203 // quantity>)) >= 0`. For example,
204 // device.capacity['test-driver.cdi.k8s.io'].counters.compareTo(quantity('2'))
205 // >= 0.
206 //
207 // When a requestPolicy is defined, the requested amount is adjusted upward to
208 // the nearest valid value based on the policy. If the requested amount cannot
209 // be adjusted to a valid value—because it exceeds what the requestPolicy
210 // allows— the device is considered ineligible for allocation.
211 //
212 // For any capacity that is not explicitly requested: - If no requestPolicy is
213 // set, the default consumed capacity is equal to the full device capacity
214 // (i.e., the whole device is claimed).
215 // - If a requestPolicy is set, the default consumed capacity is determined
216 // according to that policy.
217 //
218 // If the device allows multiple allocation, the aggregated amount across all
219 // requests must not exceed the capacity value. The consumed capacity, which
220 // may be adjusted based on the requestPolicy if defined, is recorded in the
221 // resource claim’s status.devices[*].consumedCapacity field.
222 "requests"?: [string]: resource.#Quantity
223}
224
225// Counter describes a quantity associated with a device.
226#Counter: {
227 // Value defines how much of a certain device counter is available.
228 "value"!: resource.#Quantity
229}
230
231// CounterSet defines a named set of counters that are available to be used by
232// devices defined in the ResourcePool.
233//
234// The counters are not allocatable by themselves, but can be referenced by
235// devices. When a device is allocated, the portion of counters it uses will no
236// longer be available for use by other devices.
237#CounterSet: {
238 // Counters defines the set of counters for this CounterSet The name of each
239 // counter must be unique in that set and must be a DNS label.
240 //
241 // The maximum number of counters is 32.
242 "counters"!: [string]: #Counter
243
244 // Name defines the name of the counter set. It must be a DNS label.
245 "name"!: string
246}
247
248// Device represents one individual hardware instance that can be selected based
249// on its attributes. Besides the name, exactly one field must be set.
250#Device: {
251 // AllNodes indicates that all nodes have access to the device.
252 //
253 // Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one
254 // of NodeName, NodeSelector and AllNodes can be set.
255 "allNodes"?: bool
256
257 // AllowMultipleAllocations marks whether the device is allowed to be allocated
258 // to multiple DeviceRequests.
259 //
260 // If AllowMultipleAllocations is set to true, the device can be allocated more
261 // than once, and all of its capacity is consumable, regardless of whether the
262 // requestPolicy is defined or not.
263 "allowMultipleAllocations"?: bool
264
265 // Attributes defines the set of attributes for this device. The name of each
266 // attribute must be unique in that set.
267 //
268 // The maximum number of attributes and capacities combined is 32.
269 "attributes"?: [string]: #DeviceAttribute
270
271 // BindingConditions defines the conditions for proceeding with binding. All of
272 // these conditions must be set in the per-device status conditions with a
273 // value of True to proceed with binding the pod to the node while scheduling
274 // the pod.
275 //
276 // The maximum number of binding conditions is 4.
277 //
278 // The conditions must be a valid condition type string.
279 //
280 // This is a beta field and requires enabling the DRADeviceBindingConditions and
281 // DRAResourceClaimDeviceStatus feature gates.
282 "bindingConditions"?: [...string]
283
284 // BindingFailureConditions defines the conditions for binding failure. They may
285 // be set in the per-device status conditions. If any is set to "True", a
286 // binding failure occurred.
287 //
288 // The maximum number of binding failure conditions is 4.
289 //
290 // The conditions must be a valid condition type string.
291 //
292 // This is a beta field and requires enabling the DRADeviceBindingConditions and
293 // DRAResourceClaimDeviceStatus feature gates.
294 "bindingFailureConditions"?: [...string]
295
296 // BindsToNode indicates if the usage of an allocation involving this device has
297 // to be limited to exactly the node that was chosen when allocating the claim.
298 // If set to true, the scheduler will set the
299 // ResourceClaim.Status.Allocation.NodeSelector to match the node where the
300 // allocation was made.
301 //
302 // This is a beta field and requires enabling the DRADeviceBindingConditions and
303 // DRAResourceClaimDeviceStatus feature gates.
304 "bindsToNode"?: bool
305
306 // Capacity defines the set of capacities for this device. The name of each
307 // capacity must be unique in that set.
308 //
309 // The maximum number of attributes and capacities combined is 32.
310 "capacity"?: [string]: #DeviceCapacity
311
312 // ConsumesCounters defines a list of references to sharedCounters and the set
313 // of counters that the device will consume from those counter sets.
314 //
315 // There can only be a single entry per counterSet.
316 //
317 // The maximum number of device counter consumptions per device is 2.
318 "consumesCounters"?: [...#DeviceCounterConsumption]
319
320 // Name is unique identifier among all devices managed by the driver in the
321 // pool. It must be a DNS label.
322 "name"!: string
323
324 // NodeAllocatableResourceMappings defines the mapping of node resources that
325 // are managed by the DRA driver exposing this device. This includes resources
326 // currently reported in v1.Node `status.allocatable` that are not extended
327 // resources (see
328 // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources).
329 // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. In
330 // addition to standard requests made through the Pod `spec`, these resources
331 // can also be requested through claims and allocated by the DRA driver. For
332 // example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node
333 // memory dependencies of an accelerator device. The keys of this map are the
334 // node-allocatable resource names (e.g., "cpu", "memory"). Extended resource
335 // names are not permitted as keys.
336 "nodeAllocatableResourceMappings"?: [string]: #NodeAllocatableResourceMapping
337
338 // NodeName identifies the node where the device is available.
339 //
340 // Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one
341 // of NodeName, NodeSelector and AllNodes can be set.
342 "nodeName"?: string
343
344 // NodeSelector defines the nodes where the device is available.
345 //
346 // Must use exactly one term.
347 //
348 // Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one
349 // of NodeName, NodeSelector and AllNodes can be set.
350 "nodeSelector"?: v1_9.#NodeSelector
351
352 // If specified, these are the driver-defined taints.
353 //
354 // The maximum number of taints is 16. If taints are set for any device in a
355 // ResourceSlice, then the maximum number of allowed devices per ResourceSlice
356 // is 64 instead of 128.
357 //
358 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
359 "taints"?: [...#DeviceTaint]
360}
361
362// DeviceAllocationConfiguration gets embedded in an AllocationResult.
363#DeviceAllocationConfiguration: {
364 // Opaque provides driver-specific configuration parameters.
365 "opaque"?: #OpaqueDeviceConfiguration
366
367 // Requests lists the names of requests where the configuration applies. If
368 // empty, its applies to all requests.
369 //
370 // References to subrequests must include the name of the main request and may
371 // include the subrequest using the format <main request>[/<subrequest>]. If
372 // just the main request is given, the configuration applies to all
373 // subrequests.
374 "requests"?: [...string]
375
376 // Source records whether the configuration comes from a class and thus is not
377 // something that a normal user would have been able to set or from a claim.
378 "source"!: string
379}
380
381// DeviceAllocationResult is the result of allocating devices.
382#DeviceAllocationResult: {
383 // This field is a combination of all the claim and class configuration
384 // parameters. Drivers can distinguish between those based on a flag.
385 //
386 // This includes configuration parameters for drivers which have no allocated
387 // devices in the result because it is up to the drivers which configuration
388 // parameters they support. They can silently ignore unknown configuration
389 // parameters.
390 "config"?: [...#DeviceAllocationConfiguration]
391
392 // Results lists all allocated devices.
393 "results"?: [...#DeviceRequestAllocationResult]
394}
395
396// DeviceAttribute must have exactly one field set.
397#DeviceAttribute: {
398 // BoolValue is a true/false value.
399 "bool"?: bool
400
401 // BoolValues is a non-empty list of true/false values.
402 "bools"?: [...bool]
403
404 // IntValue is a number.
405 "int"?: int64 & int
406
407 // IntValues is a non-empty list of numbers.
408 //
409 // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
410 "ints"?: [...int64 & int]
411
412 // StringValue is a string. Must not be longer than 64 characters.
413 "string"?: string
414
415 // StringValues is a non-empty list of strings. Each string must not be longer than 64 characters.
416 //
417 // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
418 "strings"?: [...string]
419
420 // VersionValue is a semantic version according to semver.org spec 2.0.0. Must
421 // not be longer than 64 characters.
422 "version"?: string
423
424 // VersionValues is a non-empty list of semantic versions according to
425 // semver.org spec 2.0.0. Each version string must not be longer than 64
426 // characters.
427 //
428 // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
429 "versions"?: [...string]
430}
431
432// DeviceCapacity describes a quantity associated with a device.
433#DeviceCapacity: {
434 // RequestPolicy defines how this DeviceCapacity must be consumed when the
435 // device is allowed to be shared by multiple allocations.
436 //
437 // The Device must have allowMultipleAllocations set to true in order to set a requestPolicy.
438 //
439 // If unset, capacity requests are unconstrained: requests can consume any
440 // amount of capacity, as long as the total consumed across all allocations
441 // does not exceed the device's defined capacity. If request is also unset,
442 // default is the full capacity value.
443 "requestPolicy"?: #CapacityRequestPolicy
444
445 // Value defines how much of a certain capacity that device has.
446 //
447 // This field reflects the fixed total capacity and does not change. The
448 // consumed amount is tracked separately by scheduler and does not affect this
449 // value.
450 "value"!: resource.#Quantity
451}
452
453// DeviceClaim defines how to request devices with a ResourceClaim.
454#DeviceClaim: {
455 // This field holds configuration for multiple potential drivers which could
456 // satisfy requests in this claim. It is ignored while allocating the claim.
457 "config"?: [...#DeviceClaimConfiguration]
458
459 // These constraints must be satisfied by the set of devices that get allocated for the claim.
460 "constraints"?: [...#DeviceConstraint]
461
462 // Requests represent individual requests for distinct devices which must all be
463 // satisfied. If empty, nothing needs to be allocated.
464 "requests"?: [...#DeviceRequest]
465}
466
467// DeviceClaimConfiguration is used for configuration parameters in DeviceClaim.
468#DeviceClaimConfiguration: {
469 // Opaque provides driver-specific configuration parameters.
470 "opaque"?: #OpaqueDeviceConfiguration
471
472 // Requests lists the names of requests where the configuration applies. If
473 // empty, it applies to all requests.
474 //
475 // References to subrequests must include the name of the main request and may
476 // include the subrequest using the format <main request>[/<subrequest>]. If
477 // just the main request is given, the configuration applies to all
478 // subrequests.
479 "requests"?: [...string]
480}
481
482// DeviceClass is a vendor- or admin-provided resource that contains device
483// configuration and selectors. It can be referenced in the device requests of
484// a claim to apply these presets. Cluster scoped.
485#DeviceClass: {
486 // APIVersion defines the versioned schema of this representation of an object.
487 // Servers should convert recognized schemas to the latest internal value, and
488 // may reject unrecognized values. More info:
489 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
490 "apiVersion": "resource.k8s.io/v1"
491
492 // Kind is a string value representing the REST resource this object represents.
493 // Servers may infer this from the endpoint the client submits requests to.
494 // Cannot be updated. In CamelCase. More info:
495 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
496 "kind": "DeviceClass"
497
498 // Standard object metadata
499 "metadata"?: v1.#ObjectMeta
500
501 // Spec defines what can be allocated and how to configure it.
502 //
503 // This is mutable. Consumers have to be prepared for classes changing at any
504 // time, either because they get updated or replaced. Claim allocations are
505 // done once based on whatever was set in classes at the time of allocation.
506 //
507 // Changing the spec automatically increments the metadata.generation number.
508 "spec"!: #DeviceClassSpec
509}
510
511// DeviceClassConfiguration is used in DeviceClass.
512#DeviceClassConfiguration: {
513 // Opaque provides driver-specific configuration parameters.
514 "opaque"?: #OpaqueDeviceConfiguration
515}
516
517// DeviceClassList is a collection of classes.
518#DeviceClassList: {
519 // APIVersion defines the versioned schema of this representation of an object.
520 // Servers should convert recognized schemas to the latest internal value, and
521 // may reject unrecognized values. More info:
522 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
523 "apiVersion": "resource.k8s.io/v1"
524
525 // Items is the list of resource classes.
526 "items"!: [...#DeviceClass]
527
528 // Kind is a string value representing the REST resource this object represents.
529 // Servers may infer this from the endpoint the client submits requests to.
530 // Cannot be updated. In CamelCase. More info:
531 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
532 "kind": "DeviceClassList"
533
534 // Standard list metadata
535 "metadata"?: v1.#ListMeta
536}
537
538// DeviceClassSpec is used in a [DeviceClass] to define what can be allocated
539// and how to configure it.
540#DeviceClassSpec: {
541 // Config defines configuration parameters that apply to each device that is
542 // claimed via this class. Some classses may potentially be satisfied by
543 // multiple drivers, so each instance of a vendor configuration applies to
544 // exactly one driver.
545 //
546 // They are passed to the driver, but are not considered while allocating the claim.
547 "config"?: [...#DeviceClassConfiguration]
548
549 // ExtendedResourceName is the extended resource name for the devices of this
550 // class. The devices of this class can be used to satisfy a pod's extended
551 // resource requests. It has the same format as the name of a pod's extended
552 // resource. It should be unique among all the device classes in a cluster. If
553 // two device classes have the same name, then the class created later is
554 // picked to satisfy a pod's extended resource requests. If two classes are
555 // created at the same time, then the name of the class lexicographically
556 // sorted first is picked.
557 //
558 // This is a beta field.
559 "extendedResourceName"?: string
560
561 // Each selector must be satisfied by a device which is claimed via this class.
562 "selectors"?: [...#DeviceSelector]
563}
564
565// DeviceConstraint must have exactly one field set besides Requests.
566#DeviceConstraint: {
567 // DistinctAttribute requires that all devices in question have this attribute
568 // and that its type and value are unique across those devices.
569 //
570 // When the DRAListTypeAttributes feature gate is enabled, comparison uses set
571 // semantics (i.e., element order and duplicates are ignored): list-valued
572 // attributes must be pairwise disjoint across devices. Scalar values are
573 // treated as singleton sets for backward compatibility.
574 //
575 // This acts as the inverse of MatchAttribute.
576 //
577 // This constraint is used to avoid allocating multiple requests to the same
578 // device by ensuring attribute-level differentiation.
579 //
580 // This is useful for scenarios where resource requests must be fulfilled by
581 // separate physical devices. For example, a container requests two network
582 // interfaces that must be allocated from two different physical NICs.
583 "distinctAttribute"?: string
584
585 // MatchAttribute requires that all devices in question have this attribute and
586 // that its type and value are the same across those devices.
587 //
588 // For example, if you specified "dra.example.com/numa" (a hypothetical
589 // example!), then only devices in the same NUMA node will be chosen. A device
590 // which does not have that attribute will not be chosen. All devices should
591 // use a value of the same type for this attribute because that is part of its
592 // specification, but if one device doesn't, then it also will not be chosen.
593 //
594 // When the DRAListTypeAttributes feature gate is enabled, comparison uses set
595 // semantics(i.e., element order and duplicates are ignored): list-valued
596 // attributes match when the intersection across all devices is non-empty.
597 // Scalar values are treated as single-element lists for backward
598 // compatibility.
599 //
600 // Must include the domain qualifier.
601 "matchAttribute"?: string
602
603 // Requests is a list of the one or more requests in this claim which must
604 // co-satisfy this constraint. If a request is fulfilled by multiple devices,
605 // then all of the devices must satisfy the constraint. If this is not
606 // specified, this constraint applies to all requests in this claim.
607 //
608 // References to subrequests must include the name of the main request and may
609 // include the subrequest using the format <main request>[/<subrequest>]. If
610 // just the main request is given, the constraint applies to all subrequests.
611 "requests"?: [...string]
612}
613
614// DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.
615#DeviceCounterConsumption: {
616 // CounterSet is the name of the set from which the counters defined will be consumed.
617 "counterSet"!: string
618
619 // Counters defines the counters that will be consumed by the device.
620 //
621 // The maximum number of counters is 32.
622 "counters"!: [string]: #Counter
623}
624
625// DeviceRequest is a request for devices required for a claim. This is
626// typically a request for a single resource like a device, but can also ask
627// for several identical devices. With FirstAvailable it is also possible to
628// provide a prioritized list of requests.
629#DeviceRequest: {
630 // Exactly specifies the details for a single request that must be met exactly
631 // for the request to be satisfied.
632 //
633 // One of Exactly or FirstAvailable must be set.
634 "exactly"?: #ExactDeviceRequest
635
636 // FirstAvailable contains subrequests, of which exactly one will be selected by
637 // the scheduler. It tries to satisfy them in the order in which they are
638 // listed here. So if there are two entries in the list, the scheduler will
639 // only check the second one if it determines that the first one can not be
640 // used.
641 //
642 // DRA does not yet implement scoring, so the scheduler will select the first
643 // set of devices that satisfies all the requests in the claim. And if the
644 // requirements can be satisfied on more than one node, other scheduling
645 // features will determine which node is chosen. This means that the set of
646 // devices allocated to a claim might not be the optimal set available to the
647 // cluster. Scoring will be implemented later.
648 "firstAvailable"?: [...#DeviceSubRequest]
649
650 // Name can be used to reference this request in a
651 // pod.spec.containers[].resources.claims entry and in a constraint of the
652 // claim.
653 //
654 // References using the name in the DeviceRequest will uniquely identify a
655 // request when the Exactly field is set. When the FirstAvailable field is set,
656 // a reference to the name of the DeviceRequest will match whatever subrequest
657 // is chosen by the scheduler.
658 //
659 // Must be a DNS label.
660 "name"!: string
661}
662
663// DeviceRequestAllocationResult contains the allocation result for one request.
664#DeviceRequestAllocationResult: {
665 // AdminAccess indicates that this device was allocated for administrative
666 // access. See the corresponding request field for a definition of mode.
667 //
668 // Admin access is disabled if this field is unset or set to false, otherwise it is enabled.
669 "adminAccess"?: bool
670
671 // BindingConditions contains a copy of the BindingConditions from the
672 // corresponding ResourceSlice at the time of allocation.
673 //
674 // This is a beta field and requires enabling the DRADeviceBindingConditions and
675 // DRAResourceClaimDeviceStatus feature gates.
676 "bindingConditions"?: [...string]
677
678 // BindingFailureConditions contains a copy of the BindingFailureConditions from
679 // the corresponding ResourceSlice at the time of allocation.
680 //
681 // This is a beta field and requires enabling the DRADeviceBindingConditions and
682 // DRAResourceClaimDeviceStatus feature gates.
683 "bindingFailureConditions"?: [...string]
684
685 // ConsumedCapacity tracks the amount of capacity consumed per device as part of
686 // the claim request. The consumed amount may differ from the requested amount:
687 // it is rounded up to the nearest valid value based on the device’s
688 // requestPolicy if applicable (i.e., may not be less than the requested
689 // amount).
690 //
691 // The total consumed capacity for each device must not exceed the DeviceCapacity's Value.
692 //
693 // This field is populated only for devices that allow multiple allocations. All
694 // capacity entries are included, even if the consumed amount is zero.
695 "consumedCapacity"?: [string]: resource.#Quantity
696
697 // Device references one device instance via its name in the driver's resource
698 // pool. It must be a DNS label.
699 "device"!: string
700
701 // Driver specifies the name of the DRA driver whose kubelet plugin should be
702 // invoked to process the allocation once the claim is needed on a node.
703 //
704 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
705 // of the driver. It should use only lower case characters.
706 "driver"!: string
707
708 // This name together with the driver name and the device name field identify
709 // which device was allocated (`<driver name>/<pool name>/<device name>`).
710 //
711 // Must not be longer than 253 characters and may contain one or more DNS
712 // sub-domains separated by slashes.
713 "pool"!: string
714
715 // Request is the name of the request in the claim which caused this device to
716 // be allocated. If it references a subrequest in the firstAvailable list on a
717 // DeviceRequest, this field must include both the name of the main request and
718 // the subrequest using the format <main request>/<subrequest>.
719 //
720 // Multiple devices may have been allocated per request.
721 "request"!: string
722
723 // ShareID uniquely identifies an individual allocation share of the device,
724 // used when the device supports multiple simultaneous allocations. It serves
725 // as an additional map key to differentiate concurrent shares of the same
726 // device.
727 "shareID"?: string
728
729 // A copy of all tolerations specified in the request at the time when the device got allocated.
730 //
731 // The maximum number of tolerations is 16.
732 //
733 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
734 "tolerations"?: [...#DeviceToleration]
735}
736
737// DeviceSelector must have exactly one field set.
738#DeviceSelector: {
739 // CEL contains a CEL expression for selecting a device.
740 "cel"?: #CELDeviceSelector
741}
742
743// DeviceSubRequest describes a request for device provided in the
744// claim.spec.devices.requests[].firstAvailable array. Each is typically a
745// request for a single resource like a device, but can also ask for several
746// identical devices.
747//
748// DeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the
749// AdminAccess field as that one is only supported when requesting a specific
750// device.
751#DeviceSubRequest: {
752 // AllocationMode and its related fields define how devices are allocated to
753 // satisfy this subrequest. Supported values are:
754 //
755 // - ExactCount: This request is for a specific number of devices.
756 // This is the default. The exact number is provided in the
757 // count field.
758 //
759 // - All: This subrequest is for all of the matching devices in a pool.
760 // Allocation will fail if some devices are already allocated,
761 // unless adminAccess is requested.
762 //
763 // If AllocationMode is not specified, the default mode is ExactCount. If the
764 // mode is ExactCount and count is not specified, the default count is one. Any
765 // other subrequests must specify this field.
766 //
767 // More modes may get added in the future. Clients must refuse to handle
768 // requests with unknown modes.
769 "allocationMode"?: string
770
771 // Capacity define resource requirements against each capacity.
772 //
773 // If this field is unset and the device supports multiple allocations, the
774 // default value will be applied to each capacity according to requestPolicy.
775 // For the capacity that has no requestPolicy, default is the full capacity
776 // value.
777 //
778 // Applies to each device allocation. If Count > 1, the request fails if there
779 // aren't enough devices that meet the requirements. If AllocationMode is set
780 // to All, the request fails if there are devices that otherwise match the
781 // request, and have this capacity, with a value >= the requested amount, but
782 // which cannot be allocated to this request.
783 "capacity"?: #CapacityRequirements
784
785 // Count is used only when the count mode is "ExactCount". Must be greater than
786 // zero. If AllocationMode is ExactCount and this field is not specified, the
787 // default is one.
788 "count"?: int64 & int
789
790 // DeviceClassName references a specific DeviceClass, which can define
791 // additional configuration and selectors to be inherited by this subrequest.
792 //
793 // A class is required. Which classes are available depends on the cluster.
794 //
795 // Administrators may use this to restrict which devices may get requested by
796 // only installing classes with selectors for permitted devices. If users are
797 // free to request anything without restrictions, then administrators can
798 // create an empty DeviceClass for users to reference.
799 "deviceClassName"!: string
800
801 // Name can be used to reference this subrequest in the list of constraints or
802 // the list of configurations for the claim. References must use the format
803 // <main request>/<subrequest>.
804 //
805 // Must be a DNS label.
806 "name"!: string
807
808 // Selectors define criteria which must be satisfied by a specific device in
809 // order for that device to be considered for this subrequest. All selectors
810 // must be satisfied for a device to be considered.
811 "selectors"?: [...#DeviceSelector]
812
813 // If specified, the request's tolerations.
814 //
815 // Tolerations for NoSchedule are required to allocate a device which has a
816 // taint with that effect. The same applies to NoExecute.
817 //
818 // In addition, should any of the allocated devices get tainted with NoExecute
819 // after allocation and that effect is not tolerated, then all pods consuming
820 // the ResourceClaim get deleted to evict them. The scheduler will not let new
821 // pods reserve the claim while it has these tainted devices. Once all pods are
822 // evicted, the claim will get deallocated.
823 //
824 // The maximum number of tolerations is 16.
825 //
826 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
827 "tolerations"?: [...#DeviceToleration]
828}
829
830// The device this taint is attached to has the "effect" on any claim which does
831// not tolerate the taint and, through the claim, to pods using the claim.
832#DeviceTaint: {
833 // The effect of the taint on claims that do not tolerate the taint and through
834 // such claims on the pods using them.
835 //
836 // Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used
837 // for nodes is not valid here. More effects may get added in the future.
838 // Consumers must treat unknown effects like None.
839 "effect"!: string
840
841 // The taint key to be applied to a device. Must be a label name.
842 "key"!: string
843
844 // TimeAdded represents the time at which the taint was added or (only in a
845 // DeviceTaintRule) the effect was modified. Added automatically during create
846 // or update if not set.
847 //
848 // In addition, in a DeviceTaintRule a value provided during an update gets
849 // replaced with the current time if the provided value is the same as the old
850 // one and the new effect is different. Changing the key and/or value while
851 // keeping the effect unchanged is possible and does not update the time stamp
852 // because the eviction which uses it is either already started (NoExecute) or
853 // not started yet (NoEffect, NoSchedule).
854 "timeAdded"?: v1.#Time
855
856 // The taint value corresponding to the taint key. Must be a label value.
857 "value"?: string
858}
859
860// The ResourceClaim this DeviceToleration is attached to tolerates any taint
861// that matches the triple <key,value,effect> using the matching operator
862// <operator>.
863#DeviceToleration: {
864 // Effect indicates the taint effect to match. Empty means match all taint
865 // effects. When specified, allowed values are NoSchedule and NoExecute.
866 "effect"?: string
867
868 // Key is the taint key that the toleration applies to. Empty means match all
869 // taint keys. If the key is empty, operator must be Exists; this combination
870 // means to match all values and all keys. Must be a label name.
871 "key"?: string
872
873 // Operator represents a key's relationship to the value. Valid operators are
874 // Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for
875 // value, so that a ResourceClaim can tolerate all taints of a particular
876 // category.
877 "operator"?: string
878
879 // TolerationSeconds represents the period of time the toleration (which must be
880 // of effect NoExecute, otherwise this field is ignored) tolerates the taint.
881 // By default, it is not set, which means tolerate the taint forever (do not
882 // evict). Zero and negative values will be treated as 0 (evict immediately) by
883 // the system. If larger than zero, the time when the pod needs to be evicted
884 // is calculated as <time when taint was adedd> + <toleration seconds>.
885 "tolerationSeconds"?: int64 & int
886
887 // Value is the taint value the toleration matches to. If the operator is
888 // Exists, the value must be empty, otherwise just a regular string. Must be a
889 // label value.
890 "value"?: string
891}
892
893// ExactDeviceRequest is a request for one or more identical devices.
894#ExactDeviceRequest: {
895 // AdminAccess indicates that this is a claim for administrative access to the
896 // device(s). Claims with AdminAccess are expected to be used for monitoring or
897 // other management services for a device. They ignore all ordinary claims to
898 // the device with respect to access modes and any resource allocations.
899 //
900 // Admin access is disabled if this field is unset or set to false, otherwise it is enabled.
901 "adminAccess"?: bool
902
903 // AllocationMode and its related fields define how devices are allocated to
904 // satisfy this request. Supported values are:
905 //
906 // - ExactCount: This request is for a specific number of devices.
907 // This is the default. The exact number is provided in the
908 // count field.
909 //
910 // - All: This request is for all of the matching devices in a pool.
911 // At least one device must exist on the node for the allocation to succeed.
912 // Allocation will fail if some devices are already allocated,
913 // unless adminAccess is requested.
914 //
915 // If AllocationMode is not specified, the default mode is ExactCount. If the
916 // mode is ExactCount and count is not specified, the default count is one. Any
917 // other requests must specify this field.
918 //
919 // More modes may get added in the future. Clients must refuse to handle
920 // requests with unknown modes.
921 "allocationMode"?: string
922
923 // Capacity define resource requirements against each capacity.
924 //
925 // If this field is unset and the device supports multiple allocations, the
926 // default value will be applied to each capacity according to requestPolicy.
927 // For the capacity that has no requestPolicy, default is the full capacity
928 // value.
929 //
930 // Applies to each device allocation. If Count > 1, the request fails if there
931 // aren't enough devices that meet the requirements. If AllocationMode is set
932 // to All, the request fails if there are devices that otherwise match the
933 // request, and have this capacity, with a value >= the requested amount, but
934 // which cannot be allocated to this request.
935 "capacity"?: #CapacityRequirements
936
937 // Count is used only when the count mode is "ExactCount". Must be greater than
938 // zero. If AllocationMode is ExactCount and this field is not specified, the
939 // default is one.
940 "count"?: int64 & int
941
942 // DeviceClassName references a specific DeviceClass, which can define
943 // additional configuration and selectors to be inherited by this request.
944 //
945 // A DeviceClassName is required.
946 //
947 // Administrators may use this to restrict which devices may get requested by
948 // only installing classes with selectors for permitted devices. If users are
949 // free to request anything without restrictions, then administrators can
950 // create an empty DeviceClass for users to reference.
951 "deviceClassName"!: string
952
953 // Selectors define criteria which must be satisfied by a specific device in
954 // order for that device to be considered for this request. All selectors must
955 // be satisfied for a device to be considered.
956 "selectors"?: [...#DeviceSelector]
957
958 // If specified, the request's tolerations.
959 //
960 // Tolerations for NoSchedule are required to allocate a device which has a
961 // taint with that effect. The same applies to NoExecute.
962 //
963 // In addition, should any of the allocated devices get tainted with NoExecute
964 // after allocation and that effect is not tolerated, then all pods consuming
965 // the ResourceClaim get deleted to evict them. The scheduler will not let new
966 // pods reserve the claim while it has these tainted devices. Once all pods are
967 // evicted, the claim will get deallocated.
968 //
969 // The maximum number of tolerations is 16.
970 //
971 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
972 "tolerations"?: [...#DeviceToleration]
973}
974
975// NetworkDeviceData provides network-related details for the allocated device.
976// This information may be filled by drivers or other components to configure
977// or identify the device within a network context.
978#NetworkDeviceData: {
979 // HardwareAddress represents the hardware address (e.g. MAC Address) of the
980 // device's network interface.
981 //
982 // Must not be longer than 128 bytes.
983 "hardwareAddress"?: string
984
985 // InterfaceName specifies the name of the network interface associated with the
986 // allocated device. This might be the name of a physical or virtual network
987 // interface being configured in the pod.
988 //
989 // Must not be longer than 256 bytes.
990 "interfaceName"?: string
991
992 // IPs lists the network addresses assigned to the device's network interface.
993 // This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR
994 // notation, which includes both the address and the associated subnet mask.
995 // e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
996 "ips"?: [...string]
997}
998
999// NodeAllocatableResourceMapping defines the translation between the DRA
1000// device/capacity units requested to the corresponding quantity of the node
1001// allocatable resource.
1002#NodeAllocatableResourceMapping: {
1003 // AllocationMultiplier is used as a multiplier for the allocated device count
1004 // or the allocated capacity in the claim. It defaults to 1 if not specified.
1005 // How the field is used also depends on whether `capacityKey` is set. 1. If
1006 // `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count
1007 // allocated to the claim.
1008 // a. A DRA driver representing each CPU core as a device would have
1009 // {ResourceName: "cpu", allocationMultiplier: "2"} in its
1010 // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,
1011 // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.
1012 // b. A GPU device that needs additional node memory per GPU allocation would
1013 // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated
1014 // GPU device instance of this type will account for 2Gi of memory.
1015 //
1016 // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the
1017 // amount of that capacity consumed.
1018 // The final node allocatable resource amount is `consumedCapacity[capacityKey]`
1019 // * `allocationMultiplier`.
1020 // For example, if a Device's capacity "dra.example.com/cores" is consumed,
1021 // and each "core" provides 2 "cpu"s, the mapping would be:
1022 // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}.
1023 // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
1024 "allocationMultiplier"?: resource.#Quantity
1025
1026 // CapacityKey references a capacity name defined as a key in the
1027 // `spec.devices[*].capacity` map. When this field is set, the value associated
1028 // with this key in the `status.allocation.devices.results[*].consumedCapacity`
1029 // map (for a specific claim allocation) determines the base quantity for the
1030 // node allocatable resource. If `allocationMultiplier` is also set, it is
1031 // multiplied with the base quantity. For example, if
1032 // `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi",
1033 // and this field is set to "dra.example.com/memory", then for a claim
1034 // allocation that consumes { "dra.example.com/memory": "4Gi" } the base
1035 // quantity for the node allocatable resource mapping will be "4Gi", and
1036 // `allocationMultiplier` should be omitted or set to "1".
1037 "capacityKey"?: string
1038}
1039
1040// OpaqueDeviceConfiguration contains configuration parameters for a driver in a
1041// format defined by the driver vendor.
1042#OpaqueDeviceConfiguration: {
1043 // Driver is used to determine which kubelet plugin needs to be passed these
1044 // configuration parameters.
1045 //
1046 // An admission policy provided by the driver developer could use this to decide
1047 // whether it needs to validate them.
1048 //
1049 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
1050 // of the driver. It should use only lower case characters.
1051 "driver"!: string
1052
1053 // Parameters can contain arbitrary data. It is the responsibility of the driver
1054 // developer to handle validation and versioning. Typically this includes
1055 // self-identification and a version ("kind" + "apiVersion" for Kubernetes
1056 // types), with conversion between different versions.
1057 //
1058 // The length of the raw data must be smaller or equal to 10 Ki.
1059 "parameters"!: runtime.#RawExtension
1060}
1061
1062// ResourceClaim describes a request for access to resources in the cluster, for
1063// use by workloads. For example, if a workload needs an accelerator device
1064// with specific properties, this is how that request is expressed. The status
1065// stanza tracks whether this claim has been satisfied and what specific
1066// resources have been allocated.
1067#ResourceClaim: {
1068 // APIVersion defines the versioned schema of this representation of an object.
1069 // Servers should convert recognized schemas to the latest internal value, and
1070 // may reject unrecognized values. More info:
1071 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1072 "apiVersion": "resource.k8s.io/v1"
1073
1074 // Kind is a string value representing the REST resource this object represents.
1075 // Servers may infer this from the endpoint the client submits requests to.
1076 // Cannot be updated. In CamelCase. More info:
1077 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1078 "kind": "ResourceClaim"
1079
1080 // Standard object metadata
1081 "metadata"?: v1.#ObjectMeta
1082
1083 // Spec describes what is being requested and how to configure it. The spec is immutable.
1084 "spec"!: #ResourceClaimSpec
1085
1086 // Status describes whether the claim is ready to use and what has been allocated.
1087 "status"?: #ResourceClaimStatus
1088}
1089
1090// ResourceClaimConsumerReference contains enough information to let you locate
1091// the consumer of a ResourceClaim. The user must be a resource in the same
1092// namespace as the ResourceClaim.
1093#ResourceClaimConsumerReference: {
1094 // APIGroup is the group for the resource being referenced. It is empty for the
1095 // core API. This matches the group in the APIVersion that is used when
1096 // creating the resources.
1097 "apiGroup"?: string
1098
1099 // Name is the name of resource being referenced.
1100 "name"!: string
1101
1102 // Resource is the type of resource being referenced, for example "pods".
1103 "resource"!: string
1104
1105 // UID identifies exactly one incarnation of the resource.
1106 "uid"!: string
1107}
1108
1109// ResourceClaimList is a collection of claims.
1110#ResourceClaimList: {
1111 // APIVersion defines the versioned schema of this representation of an object.
1112 // Servers should convert recognized schemas to the latest internal value, and
1113 // may reject unrecognized values. More info:
1114 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1115 "apiVersion": "resource.k8s.io/v1"
1116
1117 // Items is the list of resource claims.
1118 "items"!: [...#ResourceClaim]
1119
1120 // Kind is a string value representing the REST resource this object represents.
1121 // Servers may infer this from the endpoint the client submits requests to.
1122 // Cannot be updated. In CamelCase. More info:
1123 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1124 "kind": "ResourceClaimList"
1125
1126 // Standard list metadata
1127 "metadata"?: v1.#ListMeta
1128}
1129
1130// ResourceClaimSpec defines what is being requested in a ResourceClaim and how to configure it.
1131#ResourceClaimSpec: {
1132 // Devices defines how to request devices.
1133 "devices"?: #DeviceClaim
1134}
1135
1136// ResourceClaimStatus tracks whether the resource has been allocated and what
1137// the result of that was.
1138#ResourceClaimStatus: {
1139 // Allocation is set once the claim has been allocated successfully.
1140 "allocation"?: #AllocationResult
1141
1142 // Devices contains the status of each device allocated for this claim, as
1143 // reported by the driver. This can include driver-specific information.
1144 // Entries are owned by their respective drivers.
1145 "devices"?: [...#AllocatedDeviceStatus]
1146
1147 // ReservedFor indicates which entities are currently allowed to use the claim.
1148 // A Pod which references a ResourceClaim which is not reserved for that Pod
1149 // will not be started. A claim that is in use or might be in use because it
1150 // has been reserved must not get deallocated.
1151 //
1152 // In a cluster with multiple scheduler instances, two pods might get scheduled
1153 // concurrently by different schedulers. When they reference the same
1154 // ResourceClaim which already has reached its maximum number of consumers,
1155 // only one pod can be scheduled.
1156 //
1157 // Both schedulers try to add their pod to the claim.status.reservedFor field,
1158 // but only the update that reaches the API server first gets stored. The other
1159 // one fails with an error and the scheduler which issued it knows that it must
1160 // put the pod back into the queue, waiting for the ResourceClaim to become
1161 // usable again.
1162 //
1163 // There can be at most 256 such reservations. This may get increased in the
1164 // future, but not reduced.
1165 "reservedFor"?: [...#ResourceClaimConsumerReference]
1166}
1167
1168// ResourceClaimTemplate is used to produce ResourceClaim objects.
1169#ResourceClaimTemplate: {
1170 // APIVersion defines the versioned schema of this representation of an object.
1171 // Servers should convert recognized schemas to the latest internal value, and
1172 // may reject unrecognized values. More info:
1173 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1174 "apiVersion": "resource.k8s.io/v1"
1175
1176 // Kind is a string value representing the REST resource this object represents.
1177 // Servers may infer this from the endpoint the client submits requests to.
1178 // Cannot be updated. In CamelCase. More info:
1179 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1180 "kind": "ResourceClaimTemplate"
1181
1182 // Standard object metadata
1183 "metadata"?: v1.#ObjectMeta
1184
1185 // Describes the ResourceClaim that is to be generated.
1186 //
1187 // This field is immutable. A ResourceClaim will get created by the control
1188 // plane for a Pod when needed and then not get updated anymore.
1189 "spec"!: #ResourceClaimTemplateSpec
1190}
1191
1192// ResourceClaimTemplateList is a collection of claim templates.
1193#ResourceClaimTemplateList: {
1194 // APIVersion defines the versioned schema of this representation of an object.
1195 // Servers should convert recognized schemas to the latest internal value, and
1196 // may reject unrecognized values. More info:
1197 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1198 "apiVersion": "resource.k8s.io/v1"
1199
1200 // Items is the list of resource claim templates.
1201 "items"!: [...#ResourceClaimTemplate]
1202
1203 // Kind is a string value representing the REST resource this object represents.
1204 // Servers may infer this from the endpoint the client submits requests to.
1205 // Cannot be updated. In CamelCase. More info:
1206 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1207 "kind": "ResourceClaimTemplateList"
1208
1209 // Standard list metadata
1210 "metadata"?: v1.#ListMeta
1211}
1212
1213// ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.
1214#ResourceClaimTemplateSpec: {
1215 // ObjectMeta may contain labels and annotations that will be copied into the
1216 // ResourceClaim when creating it. No other fields are allowed and will be
1217 // rejected during validation.
1218 "metadata"?: v1.#ObjectMeta
1219
1220 // Spec for the ResourceClaim. The entire content is copied unchanged into the
1221 // ResourceClaim that gets created from this template. The same fields as in a
1222 // ResourceClaim are also valid here.
1223 "spec"!: #ResourceClaimSpec
1224}
1225
1226// ResourcePool describes the pool that ResourceSlices belong to.
1227#ResourcePool: {
1228 // Generation tracks the change in a pool over time. Whenever a driver changes
1229 // something about one or more of the resources in a pool, it must change the
1230 // generation in all ResourceSlices which are part of that pool. Consumers of
1231 // ResourceSlices should only consider resources from the pool with the highest
1232 // generation number. The generation may be reset by drivers, which should be
1233 // fine for consumers, assuming that all ResourceSlices in a pool are updated
1234 // to match or deleted.
1235 //
1236 // Combined with ResourceSliceCount, this mechanism enables consumers to detect
1237 // pools which are comprised of multiple ResourceSlices and are in an
1238 // incomplete state.
1239 "generation"!: int64 & int
1240
1241 // Name is used to identify the pool. For node-local devices, this is often the
1242 // node name, but this is not required.
1243 //
1244 // It must not be longer than 253 characters and must consist of one or more DNS
1245 // sub-domains separated by slashes. This field is immutable.
1246 "name"!: string
1247
1248 // ResourceSliceCount is the total number of ResourceSlices in the pool at this
1249 // generation number. Must be greater than zero.
1250 //
1251 // Consumers can use this to check whether they have seen all ResourceSlices
1252 // belonging to the same pool.
1253 "resourceSliceCount"!: int64 & int
1254}
1255
1256// ResourceSlice represents one or more resources in a pool of similar
1257// resources, managed by a common driver. A pool may span more than one
1258// ResourceSlice, and exactly how many ResourceSlices comprise a pool is
1259// determined by the driver.
1260//
1261// At the moment, the only supported resources are devices with attributes and
1262// capacities. Each device in a given pool, regardless of how many
1263// ResourceSlices, must have a unique name. The ResourceSlice in which a device
1264// gets published may change over time. The unique identifier for a device is
1265// the tuple <driver name>, <pool name>, <device name>.
1266//
1267// Whenever a driver needs to update a pool, it increments the
1268// pool.Spec.Pool.Generation number and updates all ResourceSlices with that
1269// new number and new resource definitions. A consumer must only use
1270// ResourceSlices with the highest generation number and ignore all others.
1271//
1272// When allocating all resources in a pool matching certain criteria or when
1273// looking for the best solution among several different alternatives, a
1274// consumer should check the number of ResourceSlices in a pool (included in
1275// each ResourceSlice) to determine whether its view of a pool is complete and
1276// if not, should wait until the driver has completed updating the pool.
1277//
1278// For resources that are not local to a node, the node name is not set.
1279// Instead, the driver may use a node selector to specify where the devices are
1280// available.
1281#ResourceSlice: {
1282 // APIVersion defines the versioned schema of this representation of an object.
1283 // Servers should convert recognized schemas to the latest internal value, and
1284 // may reject unrecognized values. More info:
1285 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1286 "apiVersion": "resource.k8s.io/v1"
1287
1288 // Kind is a string value representing the REST resource this object represents.
1289 // Servers may infer this from the endpoint the client submits requests to.
1290 // Cannot be updated. In CamelCase. More info:
1291 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1292 "kind": "ResourceSlice"
1293
1294 // Standard object metadata
1295 "metadata"?: v1.#ObjectMeta
1296
1297 // Contains the information published by the driver.
1298 //
1299 // Changing the spec automatically increments the metadata.generation number.
1300 "spec"!: #ResourceSliceSpec
1301}
1302
1303// ResourceSliceList is a collection of ResourceSlices.
1304#ResourceSliceList: {
1305 // APIVersion defines the versioned schema of this representation of an object.
1306 // Servers should convert recognized schemas to the latest internal value, and
1307 // may reject unrecognized values. More info:
1308 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1309 "apiVersion": "resource.k8s.io/v1"
1310
1311 // Items is the list of resource ResourceSlices.
1312 "items"!: [...#ResourceSlice]
1313
1314 // Kind is a string value representing the REST resource this object represents.
1315 // Servers may infer this from the endpoint the client submits requests to.
1316 // Cannot be updated. In CamelCase. More info:
1317 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1318 "kind": "ResourceSliceList"
1319
1320 // Standard list metadata
1321 "metadata"?: v1.#ListMeta
1322}
1323
1324// ResourceSliceSpec contains the information published by the driver in one ResourceSlice.
1325#ResourceSliceSpec: {
1326 // AllNodes indicates that all nodes have access to the resources in the pool.
1327 //
1328 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1329 "allNodes"?: bool
1330
1331 // Devices lists some or all of the devices in this pool.
1332 //
1333 // Must not have more than 128 entries. If any device uses taints or consumes
1334 // counters the limit is 64.
1335 //
1336 // Only one of Devices and SharedCounters can be set in a ResourceSlice.
1337 "devices"?: [...#Device]
1338
1339 // Driver identifies the DRA driver providing the capacity information. A field
1340 // selector can be used to list only ResourceSlice objects with a certain
1341 // driver name.
1342 //
1343 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
1344 // of the driver. It should use only lower case characters. This field is
1345 // immutable.
1346 "driver"!: string
1347
1348 // NodeName identifies the node which provides the resources in this pool. A
1349 // field selector can be used to list only ResourceSlice objects belonging to a
1350 // certain node.
1351 //
1352 // This field can be used to limit access from nodes to ResourceSlices with the
1353 // same node name. It also indicates to autoscalers that adding new nodes of
1354 // the same type as some old node might also make new resources available.
1355 //
1356 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection
1357 // must be set. This field is immutable.
1358 "nodeName"?: string
1359
1360 // NodeSelector defines which nodes have access to the resources in the pool,
1361 // when that pool is not limited to a single node.
1362 //
1363 // Must use exactly one term.
1364 //
1365 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1366 "nodeSelector"?: v1_9.#NodeSelector
1367
1368 // PerDeviceNodeSelection defines whether the access from nodes to resources in
1369 // the pool is set on the ResourceSlice level or on each device. If it is set
1370 // to true, every device defined the ResourceSlice must specify this
1371 // individually.
1372 //
1373 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1374 "perDeviceNodeSelection"?: bool
1375
1376 // Pool describes the pool that this ResourceSlice belongs to.
1377 "pool"!: #ResourcePool
1378
1379 // SharedCounters defines a list of counter sets, each of which has a name and a
1380 // list of counters available.
1381 //
1382 // The names of the counter sets must be unique in the ResourcePool.
1383 //
1384 // Only one of Devices and SharedCounters can be set in a ResourceSlice.
1385 //
1386 // The maximum number of counter sets is 8.
1387 "sharedCounters"?: [...#CounterSet]
1388}