generated.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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.v1alpha2;
  16. import "k8s.io/api/core/v1/generated.proto";
  17. import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
  18. import "k8s.io/apimachinery/pkg/runtime/generated.proto";
  19. import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
  20. // Package-wide variables from generator "generated".
  21. option go_package = "k8s.io/api/resource/v1alpha2";
  22. // AllocationResult contains attributes of an allocated resource.
  23. message AllocationResult {
  24. // ResourceHandles contain the state associated with an allocation that
  25. // should be maintained throughout the lifetime of a claim. Each
  26. // ResourceHandle contains data that should be passed to a specific kubelet
  27. // plugin once it lands on a node. This data is returned by the driver
  28. // after a successful allocation and is opaque to Kubernetes. Driver
  29. // documentation may explain to users how to interpret this data if needed.
  30. //
  31. // Setting this field is optional. It has a maximum size of 32 entries.
  32. // If null (or empty), it is assumed this allocation will be processed by a
  33. // single kubelet plugin with no ResourceHandle data attached. The name of
  34. // the kubelet plugin invoked will match the DriverName set in the
  35. // ResourceClaimStatus this AllocationResult is embedded in.
  36. //
  37. // +listType=atomic
  38. // +optional
  39. repeated ResourceHandle resourceHandles = 1;
  40. // This field will get set by the resource driver after it has allocated
  41. // the resource to inform the scheduler where it can schedule Pods using
  42. // the ResourceClaim.
  43. //
  44. // Setting this field is optional. If null, the resource is available
  45. // everywhere.
  46. // +optional
  47. optional k8s.io.api.core.v1.NodeSelector availableOnNodes = 2;
  48. // Shareable determines whether the resource supports more
  49. // than one consumer at a time.
  50. // +optional
  51. optional bool shareable = 3;
  52. }
  53. // PodSchedulingContext objects hold information that is needed to schedule
  54. // a Pod with ResourceClaims that use "WaitForFirstConsumer" allocation
  55. // mode.
  56. //
  57. // This is an alpha type and requires enabling the DynamicResourceAllocation
  58. // feature gate.
  59. message PodSchedulingContext {
  60. // Standard object metadata
  61. // +optional
  62. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  63. // Spec describes where resources for the Pod are needed.
  64. optional PodSchedulingContextSpec spec = 2;
  65. // Status describes where resources for the Pod can be allocated.
  66. // +optional
  67. optional PodSchedulingContextStatus status = 3;
  68. }
  69. // PodSchedulingContextList is a collection of Pod scheduling objects.
  70. message PodSchedulingContextList {
  71. // Standard list metadata
  72. // +optional
  73. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  74. // Items is the list of PodSchedulingContext objects.
  75. repeated PodSchedulingContext items = 2;
  76. }
  77. // PodSchedulingContextSpec describes where resources for the Pod are needed.
  78. message PodSchedulingContextSpec {
  79. // SelectedNode is the node for which allocation of ResourceClaims that
  80. // are referenced by the Pod and that use "WaitForFirstConsumer"
  81. // allocation is to be attempted.
  82. // +optional
  83. optional string selectedNode = 1;
  84. // PotentialNodes lists nodes where the Pod might be able to run.
  85. //
  86. // The size of this field is limited to 128. This is large enough for
  87. // many clusters. Larger clusters may need more attempts to find a node
  88. // that suits all pending resources. This may get increased in the
  89. // future, but not reduced.
  90. //
  91. // +listType=set
  92. // +optional
  93. repeated string potentialNodes = 2;
  94. }
  95. // PodSchedulingContextStatus describes where resources for the Pod can be allocated.
  96. message PodSchedulingContextStatus {
  97. // ResourceClaims describes resource availability for each
  98. // pod.spec.resourceClaim entry where the corresponding ResourceClaim
  99. // uses "WaitForFirstConsumer" allocation mode.
  100. //
  101. // +listType=map
  102. // +listMapKey=name
  103. // +optional
  104. repeated ResourceClaimSchedulingStatus resourceClaims = 1;
  105. }
  106. // ResourceClaim describes which resources are needed by a resource consumer.
  107. // Its status tracks whether the resource has been allocated and what the
  108. // resulting attributes are.
  109. //
  110. // This is an alpha type and requires enabling the DynamicResourceAllocation
  111. // feature gate.
  112. message ResourceClaim {
  113. // Standard object metadata
  114. // +optional
  115. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  116. // Spec describes the desired attributes of a resource that then needs
  117. // to be allocated. It can only be set once when creating the
  118. // ResourceClaim.
  119. optional ResourceClaimSpec spec = 2;
  120. // Status describes whether the resource is available and with which
  121. // attributes.
  122. // +optional
  123. optional ResourceClaimStatus status = 3;
  124. }
  125. // ResourceClaimConsumerReference contains enough information to let you
  126. // locate the consumer of a ResourceClaim. The user must be a resource in the same
  127. // namespace as the ResourceClaim.
  128. message ResourceClaimConsumerReference {
  129. // APIGroup is the group for the resource being referenced. It is
  130. // empty for the core API. This matches the group in the APIVersion
  131. // that is used when creating the resources.
  132. // +optional
  133. optional string apiGroup = 1;
  134. // Resource is the type of resource being referenced, for example "pods".
  135. optional string resource = 3;
  136. // Name is the name of resource being referenced.
  137. optional string name = 4;
  138. // UID identifies exactly one incarnation of the resource.
  139. optional string uid = 5;
  140. }
  141. // ResourceClaimList is a collection of claims.
  142. message ResourceClaimList {
  143. // Standard list metadata
  144. // +optional
  145. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  146. // Items is the list of resource claims.
  147. repeated ResourceClaim items = 2;
  148. }
  149. // ResourceClaimParametersReference contains enough information to let you
  150. // locate the parameters for a ResourceClaim. The object must be in the same
  151. // namespace as the ResourceClaim.
  152. message ResourceClaimParametersReference {
  153. // APIGroup is the group for the resource being referenced. It is
  154. // empty for the core API. This matches the group in the APIVersion
  155. // that is used when creating the resources.
  156. // +optional
  157. optional string apiGroup = 1;
  158. // Kind is the type of resource being referenced. This is the same
  159. // value as in the parameter object's metadata, for example "ConfigMap".
  160. optional string kind = 2;
  161. // Name is the name of resource being referenced.
  162. optional string name = 3;
  163. }
  164. // ResourceClaimSchedulingStatus contains information about one particular
  165. // ResourceClaim with "WaitForFirstConsumer" allocation mode.
  166. message ResourceClaimSchedulingStatus {
  167. // Name matches the pod.spec.resourceClaims[*].Name field.
  168. // +optional
  169. optional string name = 1;
  170. // UnsuitableNodes lists nodes that the ResourceClaim cannot be
  171. // allocated for.
  172. //
  173. // The size of this field is limited to 128, the same as for
  174. // PodSchedulingSpec.PotentialNodes. This may get increased in the
  175. // future, but not reduced.
  176. //
  177. // +listType=set
  178. // +optional
  179. repeated string unsuitableNodes = 2;
  180. }
  181. // ResourceClaimSpec defines how a resource is to be allocated.
  182. message ResourceClaimSpec {
  183. // ResourceClassName references the driver and additional parameters
  184. // via the name of a ResourceClass that was created as part of the
  185. // driver deployment.
  186. optional string resourceClassName = 1;
  187. // ParametersRef references a separate object with arbitrary parameters
  188. // that will be used by the driver when allocating a resource for the
  189. // claim.
  190. //
  191. // The object must be in the same namespace as the ResourceClaim.
  192. // +optional
  193. optional ResourceClaimParametersReference parametersRef = 2;
  194. // Allocation can start immediately or when a Pod wants to use the
  195. // resource. "WaitForFirstConsumer" is the default.
  196. // +optional
  197. optional string allocationMode = 3;
  198. }
  199. // ResourceClaimStatus tracks whether the resource has been allocated and what
  200. // the resulting attributes are.
  201. message ResourceClaimStatus {
  202. // DriverName is a copy of the driver name from the ResourceClass at
  203. // the time when allocation started.
  204. // +optional
  205. optional string driverName = 1;
  206. // Allocation is set by the resource driver once a resource or set of
  207. // resources has been allocated successfully. If this is not specified, the
  208. // resources have not been allocated yet.
  209. // +optional
  210. optional AllocationResult allocation = 2;
  211. // ReservedFor indicates which entities are currently allowed to use
  212. // the claim. A Pod which references a ResourceClaim which is not
  213. // reserved for that Pod will not be started.
  214. //
  215. // There can be at most 32 such reservations. This may get increased in
  216. // the future, but not reduced.
  217. //
  218. // +listType=map
  219. // +listMapKey=uid
  220. // +optional
  221. repeated ResourceClaimConsumerReference reservedFor = 3;
  222. // DeallocationRequested indicates that a ResourceClaim is to be
  223. // deallocated.
  224. //
  225. // The driver then must deallocate this claim and reset the field
  226. // together with clearing the Allocation field.
  227. //
  228. // While DeallocationRequested is set, no new consumers may be added to
  229. // ReservedFor.
  230. // +optional
  231. optional bool deallocationRequested = 4;
  232. }
  233. // ResourceClaimTemplate is used to produce ResourceClaim objects.
  234. message ResourceClaimTemplate {
  235. // Standard object metadata
  236. // +optional
  237. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  238. // Describes the ResourceClaim that is to be generated.
  239. //
  240. // This field is immutable. A ResourceClaim will get created by the
  241. // control plane for a Pod when needed and then not get updated
  242. // anymore.
  243. optional ResourceClaimTemplateSpec spec = 2;
  244. }
  245. // ResourceClaimTemplateList is a collection of claim templates.
  246. message ResourceClaimTemplateList {
  247. // Standard list metadata
  248. // +optional
  249. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  250. // Items is the list of resource claim templates.
  251. repeated ResourceClaimTemplate items = 2;
  252. }
  253. // ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.
  254. message ResourceClaimTemplateSpec {
  255. // ObjectMeta may contain labels and annotations that will be copied into the PVC
  256. // when creating it. No other fields are allowed and will be rejected during
  257. // validation.
  258. // +optional
  259. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  260. // Spec for the ResourceClaim. The entire content is copied unchanged
  261. // into the ResourceClaim that gets created from this template. The
  262. // same fields as in a ResourceClaim are also valid here.
  263. optional ResourceClaimSpec spec = 2;
  264. }
  265. // ResourceClass is used by administrators to influence how resources
  266. // are allocated.
  267. //
  268. // This is an alpha type and requires enabling the DynamicResourceAllocation
  269. // feature gate.
  270. message ResourceClass {
  271. // Standard object metadata
  272. // +optional
  273. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  274. // DriverName defines the name of the dynamic resource driver that is
  275. // used for allocation of a ResourceClaim that uses this class.
  276. //
  277. // Resource drivers have a unique name in forward domain order
  278. // (acme.example.com).
  279. optional string driverName = 2;
  280. // ParametersRef references an arbitrary separate object that may hold
  281. // parameters that will be used by the driver when allocating a
  282. // resource that uses this class. A dynamic resource driver can
  283. // distinguish between parameters stored here and and those stored in
  284. // ResourceClaimSpec.
  285. // +optional
  286. optional ResourceClassParametersReference parametersRef = 3;
  287. // Only nodes matching the selector will be considered by the scheduler
  288. // when trying to find a Node that fits a Pod when that Pod uses
  289. // a ResourceClaim that has not been allocated yet.
  290. //
  291. // Setting this field is optional. If null, all nodes are candidates.
  292. // +optional
  293. optional k8s.io.api.core.v1.NodeSelector suitableNodes = 4;
  294. }
  295. // ResourceClassList is a collection of classes.
  296. message ResourceClassList {
  297. // Standard list metadata
  298. // +optional
  299. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  300. // Items is the list of resource classes.
  301. repeated ResourceClass items = 2;
  302. }
  303. // ResourceClassParametersReference contains enough information to let you
  304. // locate the parameters for a ResourceClass.
  305. message ResourceClassParametersReference {
  306. // APIGroup is the group for the resource being referenced. It is
  307. // empty for the core API. This matches the group in the APIVersion
  308. // that is used when creating the resources.
  309. // +optional
  310. optional string apiGroup = 1;
  311. // Kind is the type of resource being referenced. This is the same
  312. // value as in the parameter object's metadata.
  313. optional string kind = 2;
  314. // Name is the name of resource being referenced.
  315. optional string name = 3;
  316. // Namespace that contains the referenced resource. Must be empty
  317. // for cluster-scoped resources and non-empty for namespaced
  318. // resources.
  319. // +optional
  320. optional string namespace = 4;
  321. }
  322. // ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.
  323. message ResourceHandle {
  324. // DriverName specifies the name of the resource driver whose kubelet
  325. // plugin should be invoked to process this ResourceHandle's data once it
  326. // lands on a node. This may differ from the DriverName set in
  327. // ResourceClaimStatus this ResourceHandle is embedded in.
  328. optional string driverName = 1;
  329. // Data contains the opaque data associated with this ResourceHandle. It is
  330. // set by the controller component of the resource driver whose name
  331. // matches the DriverName set in the ResourceClaimStatus this
  332. // ResourceHandle is embedded in. It is set at allocation time and is
  333. // intended for processing by the kubelet plugin whose name matches
  334. // the DriverName set in this ResourceHandle.
  335. //
  336. // The maximum size of this field is 16KiB. This may get increased in the
  337. // future, but not reduced.
  338. // +optional
  339. optional string data = 2;
  340. }