generated.proto 13 KB

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