generated.proto 21 KB

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