cue.dev/x/k8s.io@v0.8.0

api/resource/v1beta1/schema.cue raw

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