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