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