generated.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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.flowcontrol.v1beta1;
  16. import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
  17. import "k8s.io/apimachinery/pkg/runtime/generated.proto";
  18. import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
  19. // Package-wide variables from generator "generated".
  20. option go_package = "k8s.io/api/flowcontrol/v1beta1";
  21. // FlowDistinguisherMethod specifies the method of a flow distinguisher.
  22. message FlowDistinguisherMethod {
  23. // `type` is the type of flow distinguisher method
  24. // The supported types are "ByUser" and "ByNamespace".
  25. // Required.
  26. optional string type = 1;
  27. }
  28. // FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with
  29. // similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher".
  30. message FlowSchema {
  31. // `metadata` is the standard object's metadata.
  32. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  33. // +optional
  34. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  35. // `spec` is the specification of the desired behavior of a FlowSchema.
  36. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  37. // +optional
  38. optional FlowSchemaSpec spec = 2;
  39. // `status` is the current status of a FlowSchema.
  40. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  41. // +optional
  42. optional FlowSchemaStatus status = 3;
  43. }
  44. // FlowSchemaCondition describes conditions for a FlowSchema.
  45. message FlowSchemaCondition {
  46. // `type` is the type of the condition.
  47. // Required.
  48. optional string type = 1;
  49. // `status` is the status of the condition.
  50. // Can be True, False, Unknown.
  51. // Required.
  52. optional string status = 2;
  53. // `lastTransitionTime` is the last time the condition transitioned from one status to another.
  54. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
  55. // `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
  56. optional string reason = 4;
  57. // `message` is a human-readable message indicating details about last transition.
  58. optional string message = 5;
  59. }
  60. // FlowSchemaList is a list of FlowSchema objects.
  61. message FlowSchemaList {
  62. // `metadata` is the standard list metadata.
  63. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  64. // +optional
  65. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  66. // `items` is a list of FlowSchemas.
  67. repeated FlowSchema items = 2;
  68. }
  69. // FlowSchemaSpec describes how the FlowSchema's specification looks like.
  70. message FlowSchemaSpec {
  71. // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot
  72. // be resolved, the FlowSchema will be ignored and marked as invalid in its status.
  73. // Required.
  74. optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1;
  75. // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen
  76. // FlowSchema is among those with the numerically lowest (which we take to be logically highest)
  77. // MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000].
  78. // Note that if the precedence is not specified, it will be set to 1000 as default.
  79. // +optional
  80. optional int32 matchingPrecedence = 2;
  81. // `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema.
  82. // `nil` specifies that the distinguisher is disabled and thus will always be the empty string.
  83. // +optional
  84. optional FlowDistinguisherMethod distinguisherMethod = 3;
  85. // `rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if
  86. // at least one member of rules matches the request.
  87. // if it is an empty slice, there will be no requests matching the FlowSchema.
  88. // +listType=atomic
  89. // +optional
  90. repeated PolicyRulesWithSubjects rules = 4;
  91. }
  92. // FlowSchemaStatus represents the current state of a FlowSchema.
  93. message FlowSchemaStatus {
  94. // `conditions` is a list of the current states of FlowSchema.
  95. // +listType=map
  96. // +listMapKey=type
  97. // +optional
  98. repeated FlowSchemaCondition conditions = 1;
  99. }
  100. // GroupSubject holds detailed information for group-kind subject.
  101. message GroupSubject {
  102. // name is the user group that matches, or "*" to match all user groups.
  103. // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some
  104. // well-known group names.
  105. // Required.
  106. optional string name = 1;
  107. }
  108. // LimitResponse defines how to handle requests that can not be executed right now.
  109. // +union
  110. message LimitResponse {
  111. // `type` is "Queue" or "Reject".
  112. // "Queue" means that requests that can not be executed upon arrival
  113. // are held in a queue until they can be executed or a queuing limit
  114. // is reached.
  115. // "Reject" means that requests that can not be executed upon arrival
  116. // are rejected.
  117. // Required.
  118. // +unionDiscriminator
  119. optional string type = 1;
  120. // `queuing` holds the configuration parameters for queuing.
  121. // This field may be non-empty only if `type` is `"Queue"`.
  122. // +optional
  123. optional QueuingConfiguration queuing = 2;
  124. }
  125. // LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits.
  126. // It addresses two issues:
  127. // - How are requests for this priority level limited?
  128. // - What should be done with requests that exceed the limit?
  129. message LimitedPriorityLevelConfiguration {
  130. // `assuredConcurrencyShares` (ACS) configures the execution
  131. // limit, which is a limit on the number of requests of this
  132. // priority level that may be exeucting at a given time. ACS must
  133. // be a positive number. The server's concurrency limit (SCL) is
  134. // divided among the concurrency-controlled priority levels in
  135. // proportion to their assured concurrency shares. This produces
  136. // the assured concurrency value (ACV) --- the number of requests
  137. // that may be executing at a time --- for each such priority
  138. // level:
  139. //
  140. // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )
  141. //
  142. // bigger numbers of ACS mean more reserved concurrent requests (at the
  143. // expense of every other PL).
  144. // This field has a default value of 30.
  145. // +optional
  146. optional int32 assuredConcurrencyShares = 1;
  147. // `limitResponse` indicates what to do with requests that can not be executed right now
  148. optional LimitResponse limitResponse = 2;
  149. // `lendablePercent` prescribes the fraction of the level's NominalCL that
  150. // can be borrowed by other priority levels. The value of this
  151. // field must be between 0 and 100, inclusive, and it defaults to 0.
  152. // The number of seats that other levels can borrow from this level, known
  153. // as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.
  154. //
  155. // LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )
  156. //
  157. // +optional
  158. optional int32 lendablePercent = 3;
  159. // `borrowingLimitPercent`, if present, configures a limit on how many
  160. // seats this priority level can borrow from other priority levels.
  161. // The limit is known as this level's BorrowingConcurrencyLimit
  162. // (BorrowingCL) and is a limit on the total number of seats that this
  163. // level may borrow at any one time.
  164. // This field holds the ratio of that limit to the level's nominal
  165. // concurrency limit. When this field is non-nil, it must hold a
  166. // non-negative integer and the limit is calculated as follows.
  167. //
  168. // BorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 )
  169. //
  170. // The value of this field can be more than 100, implying that this
  171. // priority level can borrow a number of seats that is greater than
  172. // its own nominal concurrency limit (NominalCL).
  173. // When this field is left `nil`, the limit is effectively infinite.
  174. // +optional
  175. optional int32 borrowingLimitPercent = 4;
  176. }
  177. // NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the
  178. // target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member
  179. // of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.
  180. message NonResourcePolicyRule {
  181. // `verbs` is a list of matching verbs and may not be empty.
  182. // "*" matches all verbs. If it is present, it must be the only entry.
  183. // +listType=set
  184. // Required.
  185. repeated string verbs = 1;
  186. // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty.
  187. // For example:
  188. // - "/healthz" is legal
  189. // - "/hea*" is illegal
  190. // - "/hea" is legal but matches nothing
  191. // - "/hea/*" also matches nothing
  192. // - "/healthz/*" matches all per-component health checks.
  193. // "*" matches all non-resource urls. if it is present, it must be the only entry.
  194. // +listType=set
  195. // Required.
  196. repeated string nonResourceURLs = 6;
  197. }
  198. // PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject
  199. // making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches
  200. // a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member
  201. // of resourceRules or nonResourceRules matches the request.
  202. message PolicyRulesWithSubjects {
  203. // subjects is the list of normal user, serviceaccount, or group that this rule cares about.
  204. // There must be at least one member in this slice.
  205. // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request.
  206. // +listType=atomic
  207. // Required.
  208. repeated Subject subjects = 1;
  209. // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the
  210. // target resource.
  211. // At least one of `resourceRules` and `nonResourceRules` has to be non-empty.
  212. // +listType=atomic
  213. // +optional
  214. repeated ResourcePolicyRule resourceRules = 2;
  215. // `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb
  216. // and the target non-resource URL.
  217. // +listType=atomic
  218. // +optional
  219. repeated NonResourcePolicyRule nonResourceRules = 3;
  220. }
  221. // PriorityLevelConfiguration represents the configuration of a priority level.
  222. message PriorityLevelConfiguration {
  223. // `metadata` is the standard object's metadata.
  224. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  225. // +optional
  226. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  227. // `spec` is the specification of the desired behavior of a "request-priority".
  228. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  229. // +optional
  230. optional PriorityLevelConfigurationSpec spec = 2;
  231. // `status` is the current status of a "request-priority".
  232. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  233. // +optional
  234. optional PriorityLevelConfigurationStatus status = 3;
  235. }
  236. // PriorityLevelConfigurationCondition defines the condition of priority level.
  237. message PriorityLevelConfigurationCondition {
  238. // `type` is the type of the condition.
  239. // Required.
  240. optional string type = 1;
  241. // `status` is the status of the condition.
  242. // Can be True, False, Unknown.
  243. // Required.
  244. optional string status = 2;
  245. // `lastTransitionTime` is the last time the condition transitioned from one status to another.
  246. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
  247. // `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
  248. optional string reason = 4;
  249. // `message` is a human-readable message indicating details about last transition.
  250. optional string message = 5;
  251. }
  252. // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.
  253. message PriorityLevelConfigurationList {
  254. // `metadata` is the standard object's metadata.
  255. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  256. // +optional
  257. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  258. // `items` is a list of request-priorities.
  259. repeated PriorityLevelConfiguration items = 2;
  260. }
  261. // PriorityLevelConfigurationReference contains information that points to the "request-priority" being used.
  262. message PriorityLevelConfigurationReference {
  263. // `name` is the name of the priority level configuration being referenced
  264. // Required.
  265. optional string name = 1;
  266. }
  267. // PriorityLevelConfigurationSpec specifies the configuration of a priority level.
  268. // +union
  269. message PriorityLevelConfigurationSpec {
  270. // `type` indicates whether this priority level is subject to
  271. // limitation on request execution. A value of `"Exempt"` means
  272. // that requests of this priority level are not subject to a limit
  273. // (and thus are never queued) and do not detract from the
  274. // capacity made available to other priority levels. A value of
  275. // `"Limited"` means that (a) requests of this priority level
  276. // _are_ subject to limits and (b) some of the server's limited
  277. // capacity is made available exclusively to this priority level.
  278. // Required.
  279. // +unionDiscriminator
  280. optional string type = 1;
  281. // `limited` specifies how requests are handled for a Limited priority level.
  282. // This field must be non-empty if and only if `type` is `"Limited"`.
  283. // +optional
  284. optional LimitedPriorityLevelConfiguration limited = 2;
  285. }
  286. // PriorityLevelConfigurationStatus represents the current state of a "request-priority".
  287. message PriorityLevelConfigurationStatus {
  288. // `conditions` is the current state of "request-priority".
  289. // +listType=map
  290. // +listMapKey=type
  291. // +optional
  292. repeated PriorityLevelConfigurationCondition conditions = 1;
  293. }
  294. // QueuingConfiguration holds the configuration parameters for queuing
  295. message QueuingConfiguration {
  296. // `queues` is the number of queues for this priority level. The
  297. // queues exist independently at each apiserver. The value must be
  298. // positive. Setting it to 1 effectively precludes
  299. // shufflesharding and thus makes the distinguisher method of
  300. // associated flow schemas irrelevant. This field has a default
  301. // value of 64.
  302. // +optional
  303. optional int32 queues = 1;
  304. // `handSize` is a small positive number that configures the
  305. // shuffle sharding of requests into queues. When enqueuing a request
  306. // at this priority level the request's flow identifier (a string
  307. // pair) is hashed and the hash value is used to shuffle the list
  308. // of queues and deal a hand of the size specified here. The
  309. // request is put into one of the shortest queues in that hand.
  310. // `handSize` must be no larger than `queues`, and should be
  311. // significantly smaller (so that a few heavy flows do not
  312. // saturate most of the queues). See the user-facing
  313. // documentation for more extensive guidance on setting this
  314. // field. This field has a default value of 8.
  315. // +optional
  316. optional int32 handSize = 2;
  317. // `queueLengthLimit` is the maximum number of requests allowed to
  318. // be waiting in a given queue of this priority level at a time;
  319. // excess requests are rejected. This value must be positive. If
  320. // not specified, it will be defaulted to 50.
  321. // +optional
  322. optional int32 queueLengthLimit = 3;
  323. }
  324. // ResourcePolicyRule is a predicate that matches some resource
  325. // requests, testing the request's verb and the target resource. A
  326. // ResourcePolicyRule matches a resource request if and only if: (a)
  327. // at least one member of verbs matches the request, (b) at least one
  328. // member of apiGroups matches the request, (c) at least one member of
  329. // resources matches the request, and (d) either (d1) the request does
  330. // not specify a namespace (i.e., `Namespace==""`) and clusterScope is
  331. // true or (d2) the request specifies a namespace and least one member
  332. // of namespaces matches the request's namespace.
  333. message ResourcePolicyRule {
  334. // `verbs` is a list of matching verbs and may not be empty.
  335. // "*" matches all verbs and, if present, must be the only entry.
  336. // +listType=set
  337. // Required.
  338. repeated string verbs = 1;
  339. // `apiGroups` is a list of matching API groups and may not be empty.
  340. // "*" matches all API groups and, if present, must be the only entry.
  341. // +listType=set
  342. // Required.
  343. repeated string apiGroups = 2;
  344. // `resources` is a list of matching resources (i.e., lowercase
  345. // and plural) with, if desired, subresource. For example, [
  346. // "services", "nodes/status" ]. This list may not be empty.
  347. // "*" matches all resources and, if present, must be the only entry.
  348. // Required.
  349. // +listType=set
  350. repeated string resources = 3;
  351. // `clusterScope` indicates whether to match requests that do not
  352. // specify a namespace (which happens either because the resource
  353. // is not namespaced or the request targets all namespaces).
  354. // If this field is omitted or false then the `namespaces` field
  355. // must contain a non-empty list.
  356. // +optional
  357. optional bool clusterScope = 4;
  358. // `namespaces` is a list of target namespaces that restricts
  359. // matches. A request that specifies a target namespace matches
  360. // only if either (a) this list contains that target namespace or
  361. // (b) this list contains "*". Note that "*" matches any
  362. // specified namespace but does not match a request that _does
  363. // not specify_ a namespace (see the `clusterScope` field for
  364. // that).
  365. // This list may be empty, but only if `clusterScope` is true.
  366. // +optional
  367. // +listType=set
  368. repeated string namespaces = 5;
  369. }
  370. // ServiceAccountSubject holds detailed information for service-account-kind subject.
  371. message ServiceAccountSubject {
  372. // `namespace` is the namespace of matching ServiceAccount objects.
  373. // Required.
  374. optional string namespace = 1;
  375. // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name.
  376. // Required.
  377. optional string name = 2;
  378. }
  379. // Subject matches the originator of a request, as identified by the request authentication system. There are three
  380. // ways of matching an originator; by user, group, or service account.
  381. // +union
  382. message Subject {
  383. // `kind` indicates which one of the other fields is non-empty.
  384. // Required
  385. // +unionDiscriminator
  386. optional string kind = 1;
  387. // `user` matches based on username.
  388. // +optional
  389. optional UserSubject user = 2;
  390. // `group` matches based on user group name.
  391. // +optional
  392. optional GroupSubject group = 3;
  393. // `serviceAccount` matches ServiceAccounts.
  394. // +optional
  395. optional ServiceAccountSubject serviceAccount = 4;
  396. }
  397. // UserSubject holds detailed information for user-kind subject.
  398. message UserSubject {
  399. // `name` is the username that matches, or "*" to match all usernames.
  400. // Required.
  401. optional string name = 1;
  402. }