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