generated.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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.v1alpha1;
  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 = "v1alpha1";
  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. }
  150. // NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the
  151. // target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member
  152. // of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.
  153. message NonResourcePolicyRule {
  154. // `verbs` is a list of matching verbs and may not be empty.
  155. // "*" matches all verbs. If it is present, it must be the only entry.
  156. // +listType=set
  157. // Required.
  158. repeated string verbs = 1;
  159. // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty.
  160. // For example:
  161. // - "/healthz" is legal
  162. // - "/hea*" is illegal
  163. // - "/hea" is legal but matches nothing
  164. // - "/hea/*" also matches nothing
  165. // - "/healthz/*" matches all per-component health checks.
  166. // "*" matches all non-resource urls. if it is present, it must be the only entry.
  167. // +listType=set
  168. // Required.
  169. repeated string nonResourceURLs = 6;
  170. }
  171. // PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject
  172. // making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches
  173. // a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member
  174. // of resourceRules or nonResourceRules matches the request.
  175. message PolicyRulesWithSubjects {
  176. // subjects is the list of normal user, serviceaccount, or group that this rule cares about.
  177. // There must be at least one member in this slice.
  178. // A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request.
  179. // +listType=atomic
  180. // Required.
  181. repeated Subject subjects = 1;
  182. // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the
  183. // target resource.
  184. // At least one of `resourceRules` and `nonResourceRules` has to be non-empty.
  185. // +listType=atomic
  186. // +optional
  187. repeated ResourcePolicyRule resourceRules = 2;
  188. // `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb
  189. // and the target non-resource URL.
  190. // +listType=atomic
  191. // +optional
  192. repeated NonResourcePolicyRule nonResourceRules = 3;
  193. }
  194. // PriorityLevelConfiguration represents the configuration of a priority level.
  195. message PriorityLevelConfiguration {
  196. // `metadata` is the standard object's metadata.
  197. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  198. // +optional
  199. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  200. // `spec` is the specification of the desired behavior of a "request-priority".
  201. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  202. // +optional
  203. optional PriorityLevelConfigurationSpec spec = 2;
  204. // `status` is the current status of a "request-priority".
  205. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  206. // +optional
  207. optional PriorityLevelConfigurationStatus status = 3;
  208. }
  209. // PriorityLevelConfigurationCondition defines the condition of priority level.
  210. message PriorityLevelConfigurationCondition {
  211. // `type` is the type of the condition.
  212. // Required.
  213. optional string type = 1;
  214. // `status` is the status of the condition.
  215. // Can be True, False, Unknown.
  216. // Required.
  217. optional string status = 2;
  218. // `lastTransitionTime` is the last time the condition transitioned from one status to another.
  219. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
  220. // `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
  221. optional string reason = 4;
  222. // `message` is a human-readable message indicating details about last transition.
  223. optional string message = 5;
  224. }
  225. // PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.
  226. message PriorityLevelConfigurationList {
  227. // `metadata` is the standard object's metadata.
  228. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  229. // +optional
  230. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  231. // `items` is a list of request-priorities.
  232. repeated PriorityLevelConfiguration items = 2;
  233. }
  234. // PriorityLevelConfigurationReference contains information that points to the "request-priority" being used.
  235. message PriorityLevelConfigurationReference {
  236. // `name` is the name of the priority level configuration being referenced
  237. // Required.
  238. optional string name = 1;
  239. }
  240. // PriorityLevelConfigurationSpec specifies the configuration of a priority level.
  241. // +union
  242. message PriorityLevelConfigurationSpec {
  243. // `type` indicates whether this priority level is subject to
  244. // limitation on request execution. A value of `"Exempt"` means
  245. // that requests of this priority level are not subject to a limit
  246. // (and thus are never queued) and do not detract from the
  247. // capacity made available to other priority levels. A value of
  248. // `"Limited"` means that (a) requests of this priority level
  249. // _are_ subject to limits and (b) some of the server's limited
  250. // capacity is made available exclusively to this priority level.
  251. // Required.
  252. // +unionDiscriminator
  253. optional string type = 1;
  254. // `limited` specifies how requests are handled for a Limited priority level.
  255. // This field must be non-empty if and only if `type` is `"Limited"`.
  256. // +optional
  257. optional LimitedPriorityLevelConfiguration limited = 2;
  258. }
  259. // PriorityLevelConfigurationStatus represents the current state of a "request-priority".
  260. message PriorityLevelConfigurationStatus {
  261. // `conditions` is the current state of "request-priority".
  262. // +listType=map
  263. // +listMapKey=type
  264. // +optional
  265. repeated PriorityLevelConfigurationCondition conditions = 1;
  266. }
  267. // QueuingConfiguration holds the configuration parameters for queuing
  268. message QueuingConfiguration {
  269. // `queues` is the number of queues for this priority level. The
  270. // queues exist independently at each apiserver. The value must be
  271. // positive. Setting it to 1 effectively precludes
  272. // shufflesharding and thus makes the distinguisher method of
  273. // associated flow schemas irrelevant. This field has a default
  274. // value of 64.
  275. // +optional
  276. optional int32 queues = 1;
  277. // `handSize` is a small positive number that configures the
  278. // shuffle sharding of requests into queues. When enqueuing a request
  279. // at this priority level the request's flow identifier (a string
  280. // pair) is hashed and the hash value is used to shuffle the list
  281. // of queues and deal a hand of the size specified here. The
  282. // request is put into one of the shortest queues in that hand.
  283. // `handSize` must be no larger than `queues`, and should be
  284. // significantly smaller (so that a few heavy flows do not
  285. // saturate most of the queues). See the user-facing
  286. // documentation for more extensive guidance on setting this
  287. // field. This field has a default value of 8.
  288. // +optional
  289. optional int32 handSize = 2;
  290. // `queueLengthLimit` is the maximum number of requests allowed to
  291. // be waiting in a given queue of this priority level at a time;
  292. // excess requests are rejected. This value must be positive. If
  293. // not specified, it will be defaulted to 50.
  294. // +optional
  295. optional int32 queueLengthLimit = 3;
  296. }
  297. // ResourcePolicyRule is a predicate that matches some resource
  298. // requests, testing the request's verb and the target resource. A
  299. // ResourcePolicyRule matches a resource request if and only if: (a)
  300. // at least one member of verbs matches the request, (b) at least one
  301. // member of apiGroups matches the request, (c) at least one member of
  302. // resources matches the request, and (d) least one member of
  303. // namespaces matches the request.
  304. message ResourcePolicyRule {
  305. // `verbs` is a list of matching verbs and may not be empty.
  306. // "*" matches all verbs and, if present, must be the only entry.
  307. // +listType=set
  308. // Required.
  309. repeated string verbs = 1;
  310. // `apiGroups` is a list of matching API groups and may not be empty.
  311. // "*" matches all API groups and, if present, must be the only entry.
  312. // +listType=set
  313. // Required.
  314. repeated string apiGroups = 2;
  315. // `resources` is a list of matching resources (i.e., lowercase
  316. // and plural) with, if desired, subresource. For example, [
  317. // "services", "nodes/status" ]. This list may not be empty.
  318. // "*" matches all resources and, if present, must be the only entry.
  319. // Required.
  320. // +listType=set
  321. repeated string resources = 3;
  322. // `clusterScope` indicates whether to match requests that do not
  323. // specify a namespace (which happens either because the resource
  324. // is not namespaced or the request targets all namespaces).
  325. // If this field is omitted or false then the `namespaces` field
  326. // must contain a non-empty list.
  327. // +optional
  328. optional bool clusterScope = 4;
  329. // `namespaces` is a list of target namespaces that restricts
  330. // matches. A request that specifies a target namespace matches
  331. // only if either (a) this list contains that target namespace or
  332. // (b) this list contains "*". Note that "*" matches any
  333. // specified namespace but does not match a request that _does
  334. // not specify_ a namespace (see the `clusterScope` field for
  335. // that).
  336. // This list may be empty, but only if `clusterScope` is true.
  337. // +optional
  338. // +listType=set
  339. repeated string namespaces = 5;
  340. }
  341. // ServiceAccountSubject holds detailed information for service-account-kind subject.
  342. message ServiceAccountSubject {
  343. // `namespace` is the namespace of matching ServiceAccount objects.
  344. // Required.
  345. optional string namespace = 1;
  346. // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name.
  347. // Required.
  348. optional string name = 2;
  349. }
  350. // Subject matches the originator of a request, as identified by the request authentication system. There are three
  351. // ways of matching an originator; by user, group, or service account.
  352. // +union
  353. message Subject {
  354. // Required
  355. // +unionDiscriminator
  356. optional string kind = 1;
  357. // +optional
  358. optional UserSubject user = 2;
  359. // +optional
  360. optional GroupSubject group = 3;
  361. // +optional
  362. optional ServiceAccountSubject serviceAccount = 4;
  363. }
  364. // UserSubject holds detailed information for user-kind subject.
  365. message UserSubject {
  366. // `name` is the username that matches, or "*" to match all usernames.
  367. // Required.
  368. optional string name = 1;
  369. }