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