generated.proto 62 KB

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