1package v1beta2
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//
486// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
487#DeviceClass: {
488 // APIVersion defines the versioned schema of this representation of an object.
489 // Servers should convert recognized schemas to the latest internal value, and
490 // may reject unrecognized values. More info:
491 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
492 "apiVersion": "resource.k8s.io/v1beta2"
493
494 // Kind is a string value representing the REST resource this object represents.
495 // Servers may infer this from the endpoint the client submits requests to.
496 // Cannot be updated. In CamelCase. More info:
497 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
498 "kind": "DeviceClass"
499
500 // Standard object metadata
501 "metadata"?: v1.#ObjectMeta
502
503 // Spec defines what can be allocated and how to configure it.
504 //
505 // This is mutable. Consumers have to be prepared for classes changing at any
506 // time, either because they get updated or replaced. Claim allocations are
507 // done once based on whatever was set in classes at the time of allocation.
508 //
509 // Changing the spec automatically increments the metadata.generation number.
510 "spec"!: #DeviceClassSpec
511}
512
513// DeviceClassConfiguration is used in DeviceClass.
514#DeviceClassConfiguration: {
515 // Opaque provides driver-specific configuration parameters.
516 "opaque"?: #OpaqueDeviceConfiguration
517}
518
519// DeviceClassList is a collection of classes.
520#DeviceClassList: {
521 // APIVersion defines the versioned schema of this representation of an object.
522 // Servers should convert recognized schemas to the latest internal value, and
523 // may reject unrecognized values. More info:
524 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
525 "apiVersion": "resource.k8s.io/v1beta2"
526
527 // Items is the list of resource classes.
528 "items"!: [...#DeviceClass]
529
530 // Kind is a string value representing the REST resource this object represents.
531 // Servers may infer this from the endpoint the client submits requests to.
532 // Cannot be updated. In CamelCase. More info:
533 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
534 "kind": "DeviceClassList"
535
536 // Standard list metadata
537 "metadata"?: v1.#ListMeta
538}
539
540// DeviceClassSpec is used in a [DeviceClass] to define what can be allocated
541// and how to configure it.
542#DeviceClassSpec: {
543 // Config defines configuration parameters that apply to each device that is
544 // claimed via this class. Some classses may potentially be satisfied by
545 // multiple drivers, so each instance of a vendor configuration applies to
546 // exactly one driver.
547 //
548 // They are passed to the driver, but are not considered while allocating the claim.
549 "config"?: [...#DeviceClassConfiguration]
550
551 // ExtendedResourceName is the extended resource name for the devices of this
552 // class. The devices of this class can be used to satisfy a pod's extended
553 // resource requests. It has the same format as the name of a pod's extended
554 // resource. It should be unique among all the device classes in a cluster. If
555 // two device classes have the same name, then the class created later is
556 // picked to satisfy a pod's extended resource requests. If two classes are
557 // created at the same time, then the name of the class lexicographically
558 // sorted first is picked.
559 //
560 // This is a beta field.
561 "extendedResourceName"?: string
562
563 // Each selector must be satisfied by a device which is claimed via this class.
564 "selectors"?: [...#DeviceSelector]
565}
566
567// DeviceConstraint must have exactly one field set besides Requests.
568#DeviceConstraint: {
569 // DistinctAttribute requires that all devices in question have this attribute
570 // and that its type and value are unique across those devices.
571 //
572 // When the DRAListTypeAttributes feature gate is enabled, comparison uses set
573 // semantics (i.e., element order and duplicates are ignored): list-valued
574 // attributes must be pairwise disjoint across devices. Scalar values are
575 // treated as singleton sets for backward compatibility.
576 //
577 // This acts as the inverse of MatchAttribute.
578 //
579 // This constraint is used to avoid allocating multiple requests to the same
580 // device by ensuring attribute-level differentiation.
581 //
582 // This is useful for scenarios where resource requests must be fulfilled by
583 // separate physical devices. For example, a container requests two network
584 // interfaces that must be allocated from two different physical NICs.
585 "distinctAttribute"?: string
586
587 // MatchAttribute requires that all devices in question have this attribute and
588 // that its type and value are the same across those devices.
589 //
590 // For example, if you specified "dra.example.com/numa" (a hypothetical
591 // example!), then only devices in the same NUMA node will be chosen. A device
592 // which does not have that attribute will not be chosen. All devices should
593 // use a value of the same type for this attribute because that is part of its
594 // specification, but if one device doesn't, then it also will not be chosen.
595 //
596 // When the DRAListTypeAttributes feature gate is enabled, comparison uses set
597 // semantics(i.e., element order and duplicates are ignored): list-valued
598 // attributes match when the intersection across all devices is non-empty.
599 // Scalar values are treated as singleton sets for backward compatibility.
600 //
601 // Must include the domain qualifier.
602 "matchAttribute"?: string
603
604 // Requests is a list of the one or more requests in this claim which must
605 // co-satisfy this constraint. If a request is fulfilled by multiple devices,
606 // then all of the devices must satisfy the constraint. If this is not
607 // specified, this constraint applies to all requests in this claim.
608 //
609 // References to subrequests must include the name of the main request and may
610 // include the subrequest using the format <main request>[/<subrequest>]. If
611 // just the main request is given, the constraint applies to all subrequests.
612 "requests"?: [...string]
613}
614
615// DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.
616#DeviceCounterConsumption: {
617 // CounterSet is the name of the set from which the counters defined will be consumed.
618 "counterSet"!: string
619
620 // Counters defines the counters that will be consumed by the device.
621 //
622 // The maximum number of counters is 32.
623 "counters"!: [string]: #Counter
624}
625
626// DeviceRequest is a request for devices required for a claim. This is
627// typically a request for a single resource like a device, but can also ask
628// for several identical devices. With FirstAvailable it is also possible to
629// provide a prioritized list of requests.
630#DeviceRequest: {
631 // Exactly specifies the details for a single request that must be met exactly
632 // for the request to be satisfied.
633 //
634 // One of Exactly or FirstAvailable must be set.
635 "exactly"?: #ExactDeviceRequest
636
637 // FirstAvailable contains subrequests, of which exactly one will be selected by
638 // the scheduler. It tries to satisfy them in the order in which they are
639 // listed here. So if there are two entries in the list, the scheduler will
640 // only check the second one if it determines that the first one can not be
641 // used.
642 //
643 // DRA does not yet implement scoring, so the scheduler will select the first
644 // set of devices that satisfies all the requests in the claim. And if the
645 // requirements can be satisfied on more than one node, other scheduling
646 // features will determine which node is chosen. This means that the set of
647 // devices allocated to a claim might not be the optimal set available to the
648 // cluster. Scoring will be implemented later.
649 "firstAvailable"?: [...#DeviceSubRequest]
650
651 // Name can be used to reference this request in a
652 // pod.spec.containers[].resources.claims entry and in a constraint of the
653 // claim.
654 //
655 // References using the name in the DeviceRequest will uniquely identify a
656 // request when the Exactly field is set. When the FirstAvailable field is set,
657 // a reference to the name of the DeviceRequest will match whatever subrequest
658 // is chosen by the scheduler.
659 //
660 // Must be a DNS label.
661 "name"!: string
662}
663
664// DeviceRequestAllocationResult contains the allocation result for one request.
665#DeviceRequestAllocationResult: {
666 // AdminAccess indicates that this device was allocated for administrative
667 // access. See the corresponding request field for a definition of mode.
668 //
669 // This is an alpha field and requires enabling the DRAAdminAccess feature gate.
670 // Admin access is disabled if this field is unset or set to false, otherwise
671 // it is enabled.
672 "adminAccess"?: bool
673
674 // BindingConditions contains a copy of the BindingConditions from the
675 // corresponding ResourceSlice at the time of allocation.
676 //
677 // This is a beta field and requires enabling the DRADeviceBindingConditions and
678 // DRAResourceClaimDeviceStatus feature gates.
679 "bindingConditions"?: [...string]
680
681 // BindingFailureConditions contains a copy of the BindingFailureConditions from
682 // the corresponding ResourceSlice at the time of allocation.
683 //
684 // This is a beta field and requires enabling the DRADeviceBindingConditions and
685 // DRAResourceClaimDeviceStatus feature gates.
686 "bindingFailureConditions"?: [...string]
687
688 // ConsumedCapacity tracks the amount of capacity consumed per device as part of
689 // the claim request. The consumed amount may differ from the requested amount:
690 // it is rounded up to the nearest valid value based on the device’s
691 // requestPolicy if applicable (i.e., may not be less than the requested
692 // amount).
693 //
694 // The total consumed capacity for each device must not exceed the DeviceCapacity's Value.
695 //
696 // This field is populated only for devices that allow multiple allocations. All
697 // capacity entries are included, even if the consumed amount is zero.
698 "consumedCapacity"?: [string]: resource.#Quantity
699
700 // Device references one device instance via its name in the driver's resource
701 // pool. It must be a DNS label.
702 "device"!: string
703
704 // Driver specifies the name of the DRA driver whose kubelet plugin should be
705 // invoked to process the allocation once the claim is needed on a node.
706 //
707 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
708 // of the driver. It should use only lower case characters.
709 "driver"!: string
710
711 // This name together with the driver name and the device name field identify
712 // which device was allocated (`<driver name>/<pool name>/<device name>`).
713 //
714 // Must not be longer than 253 characters and may contain one or more DNS
715 // sub-domains separated by slashes.
716 "pool"!: string
717
718 // Request is the name of the request in the claim which caused this device to
719 // be allocated. If it references a subrequest in the firstAvailable list on a
720 // DeviceRequest, this field must include both the name of the main request and
721 // the subrequest using the format <main request>/<subrequest>.
722 //
723 // Multiple devices may have been allocated per request.
724 "request"!: string
725
726 // ShareID uniquely identifies an individual allocation share of the device,
727 // used when the device supports multiple simultaneous allocations. It serves
728 // as an additional map key to differentiate concurrent shares of the same
729 // device.
730 "shareID"?: string
731
732 // A copy of all tolerations specified in the request at the time when the device got allocated.
733 //
734 // The maximum number of tolerations is 16.
735 //
736 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
737 "tolerations"?: [...#DeviceToleration]
738}
739
740// DeviceSelector must have exactly one field set.
741#DeviceSelector: {
742 // CEL contains a CEL expression for selecting a device.
743 "cel"?: #CELDeviceSelector
744}
745
746// DeviceSubRequest describes a request for device provided in the
747// claim.spec.devices.requests[].firstAvailable array. Each is typically a
748// request for a single resource like a device, but can also ask for several
749// identical devices.
750//
751// DeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the
752// AdminAccess field as that one is only supported when requesting a specific
753// device.
754#DeviceSubRequest: {
755 // AllocationMode and its related fields define how devices are allocated to
756 // satisfy this subrequest. Supported values are:
757 //
758 // - ExactCount: This request is for a specific number of devices.
759 // This is the default. The exact number is provided in the
760 // count field.
761 //
762 // - All: This subrequest is for all of the matching devices in a pool.
763 // Allocation will fail if some devices are already allocated,
764 // unless adminAccess is requested.
765 //
766 // If AllocationMode is not specified, the default mode is ExactCount. If the
767 // mode is ExactCount and count is not specified, the default count is one. Any
768 // other subrequests must specify this field.
769 //
770 // More modes may get added in the future. Clients must refuse to handle
771 // requests with unknown modes.
772 "allocationMode"?: string
773
774 // Capacity define resource requirements against each capacity.
775 //
776 // If this field is unset and the device supports multiple allocations, the
777 // default value will be applied to each capacity according to requestPolicy.
778 // For the capacity that has no requestPolicy, default is the full capacity
779 // value.
780 //
781 // Applies to each device allocation. If Count > 1, the request fails if there
782 // aren't enough devices that meet the requirements. If AllocationMode is set
783 // to All, the request fails if there are devices that otherwise match the
784 // request, and have this capacity, with a value >= the requested amount, but
785 // which cannot be allocated to this request.
786 "capacity"?: #CapacityRequirements
787
788 // Count is used only when the count mode is "ExactCount". Must be greater than
789 // zero. If AllocationMode is ExactCount and this field is not specified, the
790 // default is one.
791 "count"?: int64 & int
792
793 // DeviceClassName references a specific DeviceClass, which can define
794 // additional configuration and selectors to be inherited by this subrequest.
795 //
796 // A class is required. Which classes are available depends on the cluster.
797 //
798 // Administrators may use this to restrict which devices may get requested by
799 // only installing classes with selectors for permitted devices. If users are
800 // free to request anything without restrictions, then administrators can
801 // create an empty DeviceClass for users to reference.
802 "deviceClassName"!: string
803
804 // Name can be used to reference this subrequest in the list of constraints or
805 // the list of configurations for the claim. References must use the format
806 // <main request>/<subrequest>.
807 //
808 // Must be a DNS label.
809 "name"!: string
810
811 // Selectors define criteria which must be satisfied by a specific device in
812 // order for that device to be considered for this subrequest. All selectors
813 // must be satisfied for a device to be considered.
814 "selectors"?: [...#DeviceSelector]
815
816 // If specified, the request's tolerations.
817 //
818 // Tolerations for NoSchedule are required to allocate a device which has a
819 // taint with that effect. The same applies to NoExecute.
820 //
821 // In addition, should any of the allocated devices get tainted with NoExecute
822 // after allocation and that effect is not tolerated, then all pods consuming
823 // the ResourceClaim get deleted to evict them. The scheduler will not let new
824 // pods reserve the claim while it has these tainted devices. Once all pods are
825 // evicted, the claim will get deallocated.
826 //
827 // The maximum number of tolerations is 16.
828 //
829 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
830 "tolerations"?: [...#DeviceToleration]
831}
832
833// The device this taint is attached to has the "effect" on any claim which does
834// not tolerate the taint and, through the claim, to pods using the claim.
835#DeviceTaint: {
836 // The effect of the taint on claims that do not tolerate the taint and through
837 // such claims on the pods using them.
838 //
839 // Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used
840 // for nodes is not valid here. More effects may get added in the future.
841 // Consumers must treat unknown effects like None.
842 "effect"!: string
843
844 // The taint key to be applied to a device. Must be a label name.
845 "key"!: string
846
847 // TimeAdded represents the time at which the taint was added or (only in a
848 // DeviceTaintRule) the effect was modified. Added automatically during create
849 // or update if not set.
850 //
851 // In addition, in a DeviceTaintRule a value provided during an update gets
852 // replaced with the current time if the provided value is the same as the old
853 // one and the new effect is different. Changing the key and/or value while
854 // keeping the effect unchanged is possible and does not update the time stamp
855 // because the eviction which uses it is either already started (NoExecute) or
856 // not started yet (NoEffect, NoSchedule).
857 "timeAdded"?: v1.#Time
858
859 // The taint value corresponding to the taint key. Must be a label value.
860 "value"?: string
861}
862
863// DeviceTaintRule adds one taint to all devices which match the selector. This
864// has the same effect as if the taint was specified directly in the
865// ResourceSlice by the DRA driver.
866#DeviceTaintRule: {
867 // APIVersion defines the versioned schema of this representation of an object.
868 // Servers should convert recognized schemas to the latest internal value, and
869 // may reject unrecognized values. More info:
870 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
871 "apiVersion": "resource.k8s.io/v1beta2"
872
873 // Kind is a string value representing the REST resource this object represents.
874 // Servers may infer this from the endpoint the client submits requests to.
875 // Cannot be updated. In CamelCase. More info:
876 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
877 "kind": "DeviceTaintRule"
878
879 // Standard object metadata
880 "metadata"?: v1.#ObjectMeta
881
882 // Spec specifies the selector and one taint.
883 //
884 // Changing the spec automatically increments the metadata.generation number.
885 "spec"!: #DeviceTaintRuleSpec
886
887 // Status provides information about what was requested in the spec.
888 "status"?: #DeviceTaintRuleStatus
889}
890
891// DeviceTaintRuleList is a collection of DeviceTaintRules.
892#DeviceTaintRuleList: {
893 // APIVersion defines the versioned schema of this representation of an object.
894 // Servers should convert recognized schemas to the latest internal value, and
895 // may reject unrecognized values. More info:
896 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
897 "apiVersion": "resource.k8s.io/v1beta2"
898
899 // Items is the list of DeviceTaintRules.
900 "items"!: [...#DeviceTaintRule]
901
902 // Kind is a string value representing the REST resource this object represents.
903 // Servers may infer this from the endpoint the client submits requests to.
904 // Cannot be updated. In CamelCase. More info:
905 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
906 "kind": "DeviceTaintRuleList"
907
908 // Standard list metadata
909 "metadata"?: v1.#ListMeta
910}
911
912// DeviceTaintRuleSpec specifies the selector and one taint.
913#DeviceTaintRuleSpec: {
914 // DeviceSelector defines which device(s) the taint is applied to. All selector
915 // criteria must be satisfied for a device to match. The empty selector matches
916 // all devices. Without a selector, no devices are matches.
917 "deviceSelector"?: #DeviceTaintSelector
918
919 // The taint that gets applied to matching devices.
920 "taint"!: #DeviceTaint
921}
922
923// DeviceTaintRuleStatus provides information about an on-going pod eviction.
924#DeviceTaintRuleStatus: {
925 // Conditions provide information about the state of the DeviceTaintRule and the
926 // cluster at some point in time, in a machine-readable and human-readable
927 // format.
928 //
929 // The following condition is currently defined as part of this API, more may
930 // get added: - Type: EvictionInProgress - Status: True if there are currently
931 // pods which need to be evicted, False otherwise
932 // (includes the effects which don't cause eviction).
933 // - Reason: not specified, may change - Message: includes information about
934 // number of pending pods and already evicted pods
935 // in a human-readable format, updated periodically, may change
936 //
937 // For `effect: None`, the condition above gets set once for each change to the
938 // spec, with the message containing information about what would happen if the
939 // effect was `NoExecute`. This feedback can be used to decide whether changing
940 // the effect to `NoExecute` will work as intended. It only gets set once to
941 // avoid having to constantly update the status.
942 //
943 // Must have 8 or fewer entries.
944 "conditions"?: [...v1.#Condition]
945}
946
947// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The
948// empty selector matches all devices. Without a selector, no devices are
949// matched.
950#DeviceTaintSelector: {
951 // If device is set, only devices with that name are selected. This field
952 // corresponds to slice.spec.devices[].name.
953 //
954 // Setting also driver and pool may be required to avoid ambiguity, but is not required.
955 "device"?: string
956
957 // If driver is set, only devices from that driver are selected. This fields
958 // corresponds to slice.spec.driver.
959 "driver"?: string
960
961 // If pool is set, only devices in that pool are selected.
962 //
963 // Also setting the driver name may be useful to avoid ambiguity when different
964 // drivers use the same pool name, but this is not required because selecting
965 // pools from different drivers may also be useful, for example when drivers
966 // with node-local devices use the node name as their pool name.
967 "pool"?: string
968}
969
970// The ResourceClaim this DeviceToleration is attached to tolerates any taint
971// that matches the triple <key,value,effect> using the matching operator
972// <operator>.
973#DeviceToleration: {
974 // Effect indicates the taint effect to match. Empty means match all taint
975 // effects. When specified, allowed values are NoSchedule and NoExecute.
976 "effect"?: string
977
978 // Key is the taint key that the toleration applies to. Empty means match all
979 // taint keys. If the key is empty, operator must be Exists; this combination
980 // means to match all values and all keys. Must be a label name.
981 "key"?: string
982
983 // Operator represents a key's relationship to the value. Valid operators are
984 // Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for
985 // value, so that a ResourceClaim can tolerate all taints of a particular
986 // category.
987 "operator"?: string
988
989 // TolerationSeconds represents the period of time the toleration (which must be
990 // of effect NoExecute, otherwise this field is ignored) tolerates the taint.
991 // By default, it is not set, which means tolerate the taint forever (do not
992 // evict). Zero and negative values will be treated as 0 (evict immediately) by
993 // the system. If larger than zero, the time when the pod needs to be evicted
994 // is calculated as <time when taint was adedd> + <toleration seconds>.
995 "tolerationSeconds"?: int64 & int
996
997 // Value is the taint value the toleration matches to. If the operator is
998 // Exists, the value must be empty, otherwise just a regular string. Must be a
999 // label value.
1000 "value"?: string
1001}
1002
1003// ExactDeviceRequest is a request for one or more identical devices.
1004#ExactDeviceRequest: {
1005 // AdminAccess indicates that this is a claim for administrative access to the
1006 // device(s). Claims with AdminAccess are expected to be used for monitoring or
1007 // other management services for a device. They ignore all ordinary claims to
1008 // the device with respect to access modes and any resource allocations.
1009 //
1010 // This is an alpha field and requires enabling the DRAAdminAccess feature gate.
1011 // Admin access is disabled if this field is unset or set to false, otherwise
1012 // it is enabled.
1013 "adminAccess"?: bool
1014
1015 // AllocationMode and its related fields define how devices are allocated to
1016 // satisfy this request. Supported values are:
1017 //
1018 // - ExactCount: This request is for a specific number of devices.
1019 // This is the default. The exact number is provided in the
1020 // count field.
1021 //
1022 // - All: This request is for all of the matching devices in a pool.
1023 // At least one device must exist on the node for the allocation to succeed.
1024 // Allocation will fail if some devices are already allocated,
1025 // unless adminAccess is requested.
1026 //
1027 // If AllocationMode is not specified, the default mode is ExactCount. If the
1028 // mode is ExactCount and count is not specified, the default count is one. Any
1029 // other requests must specify this field.
1030 //
1031 // More modes may get added in the future. Clients must refuse to handle
1032 // requests with unknown modes.
1033 "allocationMode"?: string
1034
1035 // Capacity define resource requirements against each capacity.
1036 //
1037 // If this field is unset and the device supports multiple allocations, the
1038 // default value will be applied to each capacity according to requestPolicy.
1039 // For the capacity that has no requestPolicy, default is the full capacity
1040 // value.
1041 //
1042 // Applies to each device allocation. If Count > 1, the request fails if there
1043 // aren't enough devices that meet the requirements. If AllocationMode is set
1044 // to All, the request fails if there are devices that otherwise match the
1045 // request, and have this capacity, with a value >= the requested amount, but
1046 // which cannot be allocated to this request.
1047 "capacity"?: #CapacityRequirements
1048
1049 // Count is used only when the count mode is "ExactCount". Must be greater than
1050 // zero. If AllocationMode is ExactCount and this field is not specified, the
1051 // default is one.
1052 "count"?: int64 & int
1053
1054 // DeviceClassName references a specific DeviceClass, which can define
1055 // additional configuration and selectors to be inherited by this request.
1056 //
1057 // A DeviceClassName is required.
1058 //
1059 // Administrators may use this to restrict which devices may get requested by
1060 // only installing classes with selectors for permitted devices. If users are
1061 // free to request anything without restrictions, then administrators can
1062 // create an empty DeviceClass for users to reference.
1063 "deviceClassName"!: string
1064
1065 // Selectors define criteria which must be satisfied by a specific device in
1066 // order for that device to be considered for this request. All selectors must
1067 // be satisfied for a device to be considered.
1068 "selectors"?: [...#DeviceSelector]
1069
1070 // If specified, the request's tolerations.
1071 //
1072 // Tolerations for NoSchedule are required to allocate a device which has a
1073 // taint with that effect. The same applies to NoExecute.
1074 //
1075 // In addition, should any of the allocated devices get tainted with NoExecute
1076 // after allocation and that effect is not tolerated, then all pods consuming
1077 // the ResourceClaim get deleted to evict them. The scheduler will not let new
1078 // pods reserve the claim while it has these tainted devices. Once all pods are
1079 // evicted, the claim will get deallocated.
1080 //
1081 // The maximum number of tolerations is 16.
1082 //
1083 // This is a beta field and requires enabling the DRADeviceTaints feature gate.
1084 "tolerations"?: [...#DeviceToleration]
1085}
1086
1087// NetworkDeviceData provides network-related details for the allocated device.
1088// This information may be filled by drivers or other components to configure
1089// or identify the device within a network context.
1090#NetworkDeviceData: {
1091 // HardwareAddress represents the hardware address (e.g. MAC Address) of the
1092 // device's network interface.
1093 //
1094 // Must not be longer than 128 bytes.
1095 "hardwareAddress"?: string
1096
1097 // InterfaceName specifies the name of the network interface associated with the
1098 // allocated device. This might be the name of a physical or virtual network
1099 // interface being configured in the pod.
1100 //
1101 // Must not be longer than 256 bytes.
1102 "interfaceName"?: string
1103
1104 // IPs lists the network addresses assigned to the device's network interface.
1105 // This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR
1106 // notation, which includes both the address and the associated subnet mask.
1107 // e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
1108 "ips"?: [...string]
1109}
1110
1111// NodeAllocatableResourceMapping defines the translation between the DRA
1112// device/capacity units requested to the corresponding quantity of the node
1113// allocatable resource.
1114#NodeAllocatableResourceMapping: {
1115 // AllocationMultiplier is used as a multiplier for the allocated device count
1116 // or the allocated capacity in the claim. It defaults to 1 if not specified.
1117 // How the field is used also depends on whether `capacityKey` is set. 1. If
1118 // `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count
1119 // allocated to the claim.
1120 // a. A DRA driver representing each CPU core as a device would have
1121 // {ResourceName: "cpu", allocationMultiplier: "2"} in its
1122 // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,
1123 // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.
1124 // b. A GPU device that needs additional node memory per GPU allocation would
1125 // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated
1126 // GPU device instance of this type will account for 2Gi of memory.
1127 //
1128 // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the
1129 // amount of that capacity consumed.
1130 // The final node allocatable resource amount is `consumedCapacity[capacityKey]`
1131 // * `allocationMultiplier`.
1132 // For example, if a Device's capacity "dra.example.com/cores" is consumed,
1133 // and each "core" provides 2 "cpu"s, the mapping would be:
1134 // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}.
1135 // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
1136 "allocationMultiplier"?: resource.#Quantity
1137
1138 // CapacityKey references a capacity name defined as a key in the
1139 // `spec.devices[*].capacity` map. When this field is set, the value associated
1140 // with this key in the `status.allocation.devices.results[*].consumedCapacity`
1141 // map (for a specific claim allocation) determines the base quantity for the
1142 // node allocatable resource. If `allocationMultiplier` is also set, it is
1143 // multiplied with the base quantity. For example, if
1144 // `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi",
1145 // and this field is set to "dra.example.com/memory", then for a claim
1146 // allocation that consumes { "dra.example.com/memory": "4Gi" } the base
1147 // quantity for the node allocatable resource mapping will be "4Gi", and
1148 // `allocationMultiplier` should be omitted or set to "1".
1149 "capacityKey"?: string
1150}
1151
1152// OpaqueDeviceConfiguration contains configuration parameters for a driver in a
1153// format defined by the driver vendor.
1154#OpaqueDeviceConfiguration: {
1155 // Driver is used to determine which kubelet plugin needs to be passed these
1156 // configuration parameters.
1157 //
1158 // An admission policy provided by the driver developer could use this to decide
1159 // whether it needs to validate them.
1160 //
1161 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
1162 // of the driver. It should use only lower case characters.
1163 "driver"!: string
1164
1165 // Parameters can contain arbitrary data. It is the responsibility of the driver
1166 // developer to handle validation and versioning. Typically this includes
1167 // self-identification and a version ("kind" + "apiVersion" for Kubernetes
1168 // types), with conversion between different versions.
1169 //
1170 // The length of the raw data must be smaller or equal to 10 Ki.
1171 "parameters"!: runtime.#RawExtension
1172}
1173
1174// ResourceClaim describes a request for access to resources in the cluster, for
1175// use by workloads. For example, if a workload needs an accelerator device
1176// with specific properties, this is how that request is expressed. The status
1177// stanza tracks whether this claim has been satisfied and what specific
1178// resources have been allocated.
1179//
1180// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
1181#ResourceClaim: {
1182 // APIVersion defines the versioned schema of this representation of an object.
1183 // Servers should convert recognized schemas to the latest internal value, and
1184 // may reject unrecognized values. More info:
1185 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1186 "apiVersion": "resource.k8s.io/v1beta2"
1187
1188 // Kind is a string value representing the REST resource this object represents.
1189 // Servers may infer this from the endpoint the client submits requests to.
1190 // Cannot be updated. In CamelCase. More info:
1191 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1192 "kind": "ResourceClaim"
1193
1194 // Standard object metadata
1195 "metadata"?: v1.#ObjectMeta
1196
1197 // Spec describes what is being requested and how to configure it. The spec is immutable.
1198 "spec"!: #ResourceClaimSpec
1199
1200 // Status describes whether the claim is ready to use and what has been allocated.
1201 "status"?: #ResourceClaimStatus
1202}
1203
1204// ResourceClaimConsumerReference contains enough information to let you locate
1205// the consumer of a ResourceClaim. The user must be a resource in the same
1206// namespace as the ResourceClaim.
1207#ResourceClaimConsumerReference: {
1208 // APIGroup is the group for the resource being referenced. It is empty for the
1209 // core API. This matches the group in the APIVersion that is used when
1210 // creating the resources.
1211 "apiGroup"?: string
1212
1213 // Name is the name of resource being referenced.
1214 "name"!: string
1215
1216 // Resource is the type of resource being referenced, for example "pods".
1217 "resource"!: string
1218
1219 // UID identifies exactly one incarnation of the resource.
1220 "uid"!: string
1221}
1222
1223// ResourceClaimList is a collection of claims.
1224#ResourceClaimList: {
1225 // APIVersion defines the versioned schema of this representation of an object.
1226 // Servers should convert recognized schemas to the latest internal value, and
1227 // may reject unrecognized values. More info:
1228 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1229 "apiVersion": "resource.k8s.io/v1beta2"
1230
1231 // Items is the list of resource claims.
1232 "items"!: [...#ResourceClaim]
1233
1234 // Kind is a string value representing the REST resource this object represents.
1235 // Servers may infer this from the endpoint the client submits requests to.
1236 // Cannot be updated. In CamelCase. More info:
1237 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1238 "kind": "ResourceClaimList"
1239
1240 // Standard list metadata
1241 "metadata"?: v1.#ListMeta
1242}
1243
1244// ResourceClaimSpec defines what is being requested in a ResourceClaim and how to configure it.
1245#ResourceClaimSpec: {
1246 // Devices defines how to request devices.
1247 "devices"?: #DeviceClaim
1248}
1249
1250// ResourceClaimStatus tracks whether the resource has been allocated and what
1251// the result of that was.
1252#ResourceClaimStatus: {
1253 // Allocation is set once the claim has been allocated successfully.
1254 "allocation"?: #AllocationResult
1255
1256 // Devices contains the status of each device allocated for this claim, as
1257 // reported by the driver. This can include driver-specific information.
1258 // Entries are owned by their respective drivers.
1259 "devices"?: [...#AllocatedDeviceStatus]
1260
1261 // ReservedFor indicates which entities are currently allowed to use the claim.
1262 // A Pod which references a ResourceClaim which is not reserved for that Pod
1263 // will not be started. A claim that is in use or might be in use because it
1264 // has been reserved must not get deallocated.
1265 //
1266 // In a cluster with multiple scheduler instances, two pods might get scheduled
1267 // concurrently by different schedulers. When they reference the same
1268 // ResourceClaim which already has reached its maximum number of consumers,
1269 // only one pod can be scheduled.
1270 //
1271 // Both schedulers try to add their pod to the claim.status.reservedFor field,
1272 // but only the update that reaches the API server first gets stored. The other
1273 // one fails with an error and the scheduler which issued it knows that it must
1274 // put the pod back into the queue, waiting for the ResourceClaim to become
1275 // usable again.
1276 //
1277 // There can be at most 256 such reservations. This may get increased in the
1278 // future, but not reduced.
1279 "reservedFor"?: [...#ResourceClaimConsumerReference]
1280}
1281
1282// ResourceClaimTemplate is used to produce ResourceClaim objects.
1283//
1284// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
1285#ResourceClaimTemplate: {
1286 // APIVersion defines the versioned schema of this representation of an object.
1287 // Servers should convert recognized schemas to the latest internal value, and
1288 // may reject unrecognized values. More info:
1289 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1290 "apiVersion": "resource.k8s.io/v1beta2"
1291
1292 // Kind is a string value representing the REST resource this object represents.
1293 // Servers may infer this from the endpoint the client submits requests to.
1294 // Cannot be updated. In CamelCase. More info:
1295 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1296 "kind": "ResourceClaimTemplate"
1297
1298 // Standard object metadata
1299 "metadata"?: v1.#ObjectMeta
1300
1301 // Describes the ResourceClaim that is to be generated.
1302 //
1303 // This field is immutable. A ResourceClaim will get created by the control
1304 // plane for a Pod when needed and then not get updated anymore.
1305 "spec"!: #ResourceClaimTemplateSpec
1306}
1307
1308// ResourceClaimTemplateList is a collection of claim templates.
1309#ResourceClaimTemplateList: {
1310 // APIVersion defines the versioned schema of this representation of an object.
1311 // Servers should convert recognized schemas to the latest internal value, and
1312 // may reject unrecognized values. More info:
1313 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1314 "apiVersion": "resource.k8s.io/v1beta2"
1315
1316 // Items is the list of resource claim templates.
1317 "items"!: [...#ResourceClaimTemplate]
1318
1319 // Kind is a string value representing the REST resource this object represents.
1320 // Servers may infer this from the endpoint the client submits requests to.
1321 // Cannot be updated. In CamelCase. More info:
1322 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1323 "kind": "ResourceClaimTemplateList"
1324
1325 // Standard list metadata
1326 "metadata"?: v1.#ListMeta
1327}
1328
1329// ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.
1330#ResourceClaimTemplateSpec: {
1331 // ObjectMeta may contain labels and annotations that will be copied into the
1332 // ResourceClaim when creating it. No other fields are allowed and will be
1333 // rejected during validation.
1334 "metadata"?: v1.#ObjectMeta
1335
1336 // Spec for the ResourceClaim. The entire content is copied unchanged into the
1337 // ResourceClaim that gets created from this template. The same fields as in a
1338 // ResourceClaim are also valid here.
1339 "spec"!: #ResourceClaimSpec
1340}
1341
1342// ResourcePool describes the pool that ResourceSlices belong to.
1343#ResourcePool: {
1344 // Generation tracks the change in a pool over time. Whenever a driver changes
1345 // something about one or more of the resources in a pool, it must change the
1346 // generation in all ResourceSlices which are part of that pool. Consumers of
1347 // ResourceSlices should only consider resources from the pool with the highest
1348 // generation number. The generation may be reset by drivers, which should be
1349 // fine for consumers, assuming that all ResourceSlices in a pool are updated
1350 // to match or deleted.
1351 //
1352 // Combined with ResourceSliceCount, this mechanism enables consumers to detect
1353 // pools which are comprised of multiple ResourceSlices and are in an
1354 // incomplete state.
1355 "generation"!: int64 & int
1356
1357 // Name is used to identify the pool. For node-local devices, this is often the
1358 // node name, but this is not required.
1359 //
1360 // It must not be longer than 253 characters and must consist of one or more DNS
1361 // sub-domains separated by slashes. This field is immutable.
1362 "name"!: string
1363
1364 // ResourceSliceCount is the total number of ResourceSlices in the pool at this
1365 // generation number. Must be greater than zero.
1366 //
1367 // Consumers can use this to check whether they have seen all ResourceSlices
1368 // belonging to the same pool.
1369 "resourceSliceCount"!: int64 & int
1370}
1371
1372// ResourceSlice represents one or more resources in a pool of similar
1373// resources, managed by a common driver. A pool may span more than one
1374// ResourceSlice, and exactly how many ResourceSlices comprise a pool is
1375// determined by the driver.
1376//
1377// At the moment, the only supported resources are devices with attributes and
1378// capacities. Each device in a given pool, regardless of how many
1379// ResourceSlices, must have a unique name. The ResourceSlice in which a device
1380// gets published may change over time. The unique identifier for a device is
1381// the tuple <driver name>, <pool name>, <device name>.
1382//
1383// Whenever a driver needs to update a pool, it increments the
1384// pool.Spec.Pool.Generation number and updates all ResourceSlices with that
1385// new number and new resource definitions. A consumer must only use
1386// ResourceSlices with the highest generation number and ignore all others.
1387//
1388// When allocating all resources in a pool matching certain criteria or when
1389// looking for the best solution among several different alternatives, a
1390// consumer should check the number of ResourceSlices in a pool (included in
1391// each ResourceSlice) to determine whether its view of a pool is complete and
1392// if not, should wait until the driver has completed updating the pool.
1393//
1394// For resources that are not local to a node, the node name is not set.
1395// Instead, the driver may use a node selector to specify where the devices are
1396// available.
1397//
1398// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
1399#ResourceSlice: {
1400 // APIVersion defines the versioned schema of this representation of an object.
1401 // Servers should convert recognized schemas to the latest internal value, and
1402 // may reject unrecognized values. More info:
1403 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1404 "apiVersion": "resource.k8s.io/v1beta2"
1405
1406 // Kind is a string value representing the REST resource this object represents.
1407 // Servers may infer this from the endpoint the client submits requests to.
1408 // Cannot be updated. In CamelCase. More info:
1409 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1410 "kind": "ResourceSlice"
1411
1412 // Standard object metadata
1413 "metadata"?: v1.#ObjectMeta
1414
1415 // Contains the information published by the driver.
1416 //
1417 // Changing the spec automatically increments the metadata.generation number.
1418 "spec"!: #ResourceSliceSpec
1419}
1420
1421// ResourceSliceList is a collection of ResourceSlices.
1422#ResourceSliceList: {
1423 // APIVersion defines the versioned schema of this representation of an object.
1424 // Servers should convert recognized schemas to the latest internal value, and
1425 // may reject unrecognized values. More info:
1426 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
1427 "apiVersion": "resource.k8s.io/v1beta2"
1428
1429 // Items is the list of resource ResourceSlices.
1430 "items"!: [...#ResourceSlice]
1431
1432 // Kind is a string value representing the REST resource this object represents.
1433 // Servers may infer this from the endpoint the client submits requests to.
1434 // Cannot be updated. In CamelCase. More info:
1435 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1436 "kind": "ResourceSliceList"
1437
1438 // Standard list metadata
1439 "metadata"?: v1.#ListMeta
1440}
1441
1442// ResourceSliceSpec contains the information published by the driver in one ResourceSlice.
1443#ResourceSliceSpec: {
1444 // AllNodes indicates that all nodes have access to the resources in the pool.
1445 //
1446 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1447 "allNodes"?: bool
1448
1449 // Devices lists some or all of the devices in this pool.
1450 //
1451 // Must not have more than 128 entries. If any device uses taints or consumes
1452 // counters the limit is 64.
1453 //
1454 // Only one of Devices and SharedCounters can be set in a ResourceSlice.
1455 "devices"?: [...#Device]
1456
1457 // Driver identifies the DRA driver providing the capacity information. A field
1458 // selector can be used to list only ResourceSlice objects with a certain
1459 // driver name.
1460 //
1461 // Must be a DNS subdomain and should end with a DNS domain owned by the vendor
1462 // of the driver. It should use only lower case characters. This field is
1463 // immutable.
1464 "driver"!: string
1465
1466 // NodeName identifies the node which provides the resources in this pool. A
1467 // field selector can be used to list only ResourceSlice objects belonging to a
1468 // certain node.
1469 //
1470 // This field can be used to limit access from nodes to ResourceSlices with the
1471 // same node name. It also indicates to autoscalers that adding new nodes of
1472 // the same type as some old node might also make new resources available.
1473 //
1474 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection
1475 // must be set. This field is immutable.
1476 "nodeName"?: string
1477
1478 // NodeSelector defines which nodes have access to the resources in the pool,
1479 // when that pool is not limited to a single node.
1480 //
1481 // Must use exactly one term.
1482 //
1483 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1484 "nodeSelector"?: v1_9.#NodeSelector
1485
1486 // PerDeviceNodeSelection defines whether the access from nodes to resources in
1487 // the pool is set on the ResourceSlice level or on each device. If it is set
1488 // to true, every device defined the ResourceSlice must specify this
1489 // individually.
1490 //
1491 // Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
1492 "perDeviceNodeSelection"?: bool
1493
1494 // Pool describes the pool that this ResourceSlice belongs to.
1495 "pool"!: #ResourcePool
1496
1497 // SharedCounters defines a list of counter sets, each of which has a name and a
1498 // list of counters available.
1499 //
1500 // The names of the counter sets must be unique in the ResourcePool.
1501 //
1502 // Only one of Devices and SharedCounters can be set in a ResourceSlice.
1503 //
1504 // The maximum number of counter sets is 8.
1505 "sharedCounters"?: [...#CounterSet]
1506}