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