2
0

generated.proto 63 KB

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