generated.proto 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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.autoscaling.v2;
  16. import "k8s.io/api/core/v1/generated.proto";
  17. import "k8s.io/apimachinery/pkg/api/resource/generated.proto";
  18. import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
  19. import "k8s.io/apimachinery/pkg/runtime/generated.proto";
  20. import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
  21. // Package-wide variables from generator "generated".
  22. option go_package = "k8s.io/api/autoscaling/v2";
  23. // ContainerResourceMetricSource indicates how to scale on a resource metric known to
  24. // Kubernetes, as specified in requests and limits, describing each pod in the
  25. // current scale target (e.g. CPU or memory). The values will be averaged
  26. // together before being compared to the target. Such metrics are built in to
  27. // Kubernetes, and have special scaling options on top of those available to
  28. // normal per-pod metrics using the "pods" source. Only one "target" type
  29. // should be set.
  30. message ContainerResourceMetricSource {
  31. // name is the name of the resource in question.
  32. optional string name = 1;
  33. // target specifies the target value for the given metric
  34. optional MetricTarget target = 2;
  35. // container is the name of the container in the pods of the scaling target
  36. optional string container = 3;
  37. }
  38. // ContainerResourceMetricStatus indicates the current value of a resource metric known to
  39. // Kubernetes, as specified in requests and limits, describing a single container in each pod in the
  40. // current scale target (e.g. CPU or memory). Such metrics are built in to
  41. // Kubernetes, and have special scaling options on top of those available to
  42. // normal per-pod metrics using the "pods" source.
  43. message ContainerResourceMetricStatus {
  44. // name is the name of the resource in question.
  45. optional string name = 1;
  46. // current contains the current value for the given metric
  47. optional MetricValueStatus current = 2;
  48. // container is the name of the container in the pods of the scaling target
  49. optional string container = 3;
  50. }
  51. // CrossVersionObjectReference contains enough information to let you identify the referred resource.
  52. message CrossVersionObjectReference {
  53. // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  54. optional string kind = 1;
  55. // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
  56. optional string name = 2;
  57. // apiVersion is the API version of the referent
  58. // +optional
  59. optional string apiVersion = 3;
  60. }
  61. // ExternalMetricSource indicates how to scale on a metric not associated with
  62. // any Kubernetes object (for example length of queue in cloud
  63. // messaging service, or QPS from loadbalancer running outside of cluster).
  64. message ExternalMetricSource {
  65. // metric identifies the target metric by name and selector
  66. optional MetricIdentifier metric = 1;
  67. // target specifies the target value for the given metric
  68. optional MetricTarget target = 2;
  69. }
  70. // ExternalMetricStatus indicates the current value of a global metric
  71. // not associated with any Kubernetes object.
  72. message ExternalMetricStatus {
  73. // metric identifies the target metric by name and selector
  74. optional MetricIdentifier metric = 1;
  75. // current contains the current value for the given metric
  76. optional MetricValueStatus current = 2;
  77. }
  78. // HPAScalingPolicy is a single policy which must hold true for a specified past interval.
  79. message HPAScalingPolicy {
  80. // type is used to specify the scaling policy.
  81. optional string type = 1;
  82. // value contains the amount of change which is permitted by the policy.
  83. // It must be greater than zero
  84. optional int32 value = 2;
  85. // periodSeconds specifies the window of time for which the policy should hold true.
  86. // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).
  87. optional int32 periodSeconds = 3;
  88. }
  89. // HPAScalingRules configures the scaling behavior for one direction via
  90. // scaling Policy Rules and a configurable metric tolerance.
  91. //
  92. // Scaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA.
  93. // They can limit the scaling velocity by specifying scaling policies.
  94. // They can prevent flapping by specifying the stabilization window, so that the
  95. // number of replicas is not set instantly, instead, the safest value from the stabilization
  96. // window is chosen.
  97. //
  98. // The tolerance is applied to the metric values and prevents scaling too
  99. // eagerly for small metric variations. (Note that setting a tolerance requires
  100. // the beta HPAConfigurableTolerance feature gate to be enabled.)
  101. message HPAScalingRules {
  102. // stabilizationWindowSeconds is the number of seconds for which past recommendations should be
  103. // considered while scaling up or scaling down.
  104. // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).
  105. // If not set, use the default values:
  106. // - For scale up: 0 (i.e. no stabilization is done).
  107. // - For scale down: 300 (i.e. the stabilization window is 300 seconds long).
  108. // +optional
  109. optional int32 stabilizationWindowSeconds = 3;
  110. // selectPolicy is used to specify which policy should be used.
  111. // If not set, the default value Max is used.
  112. // +optional
  113. optional string selectPolicy = 1;
  114. // policies is a list of potential scaling polices which can be used during scaling.
  115. // If not set, use the default values:
  116. // - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.
  117. // - For scale down: allow all pods to be removed in a 15s window.
  118. // +listType=atomic
  119. // +optional
  120. repeated HPAScalingPolicy policies = 2;
  121. // tolerance is the tolerance on the ratio between the current and desired
  122. // metric value under which no updates are made to the desired number of
  123. // replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not
  124. // set, the default cluster-wide tolerance is applied (by default 10%).
  125. //
  126. // For example, if autoscaling is configured with a memory consumption target of 100Mi,
  127. // and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be
  128. // triggered when the actual consumption falls below 95Mi or exceeds 101Mi.
  129. //
  130. // This is an beta field and requires the HPAConfigurableTolerance feature
  131. // gate to be enabled.
  132. //
  133. // +featureGate=HPAConfigurableTolerance
  134. // +optional
  135. optional .k8s.io.apimachinery.pkg.api.resource.Quantity tolerance = 4;
  136. }
  137. // HorizontalPodAutoscaler is the configuration for a horizontal pod
  138. // autoscaler, which automatically manages the replica count of any resource
  139. // implementing the scale subresource based on the metrics specified.
  140. message HorizontalPodAutoscaler {
  141. // metadata is the standard object metadata.
  142. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  143. // +optional
  144. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  145. // spec is the specification for the behaviour of the autoscaler.
  146. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
  147. // +optional
  148. optional HorizontalPodAutoscalerSpec spec = 2;
  149. // status is the current information about the autoscaler.
  150. // +optional
  151. optional HorizontalPodAutoscalerStatus status = 3;
  152. }
  153. // HorizontalPodAutoscalerBehavior configures the scaling behavior of the target
  154. // in both Up and Down directions (scaleUp and scaleDown fields respectively).
  155. message HorizontalPodAutoscalerBehavior {
  156. // scaleUp is scaling policy for scaling Up.
  157. // If not set, the default value is the higher of:
  158. // * increase no more than 4 pods per 60 seconds
  159. // * double the number of pods per 60 seconds
  160. // No stabilization is used.
  161. // +optional
  162. optional HPAScalingRules scaleUp = 1;
  163. // scaleDown is scaling policy for scaling Down.
  164. // If not set, the default value is to allow to scale down to minReplicas pods, with a
  165. // 300 second stabilization window (i.e., the highest recommendation for
  166. // the last 300sec is used).
  167. // +optional
  168. optional HPAScalingRules scaleDown = 2;
  169. }
  170. // HorizontalPodAutoscalerCondition describes the state of
  171. // a HorizontalPodAutoscaler at a certain point.
  172. message HorizontalPodAutoscalerCondition {
  173. // type describes the current condition
  174. optional string type = 1;
  175. // status is the status of the condition (True, False, Unknown)
  176. optional string status = 2;
  177. // lastTransitionTime is the last time the condition transitioned from
  178. // one status to another
  179. // +optional
  180. optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
  181. // reason is the reason for the condition's last transition.
  182. // +optional
  183. optional string reason = 4;
  184. // message is a human-readable explanation containing details about
  185. // the transition
  186. // +optional
  187. optional string message = 5;
  188. }
  189. // HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects.
  190. message HorizontalPodAutoscalerList {
  191. // metadata is the standard list metadata.
  192. // +optional
  193. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  194. // items is the list of horizontal pod autoscaler objects.
  195. repeated HorizontalPodAutoscaler items = 2;
  196. }
  197. // HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.
  198. message HorizontalPodAutoscalerSpec {
  199. // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics
  200. // should be collected, as well as to actually change the replica count.
  201. optional CrossVersionObjectReference scaleTargetRef = 1;
  202. // minReplicas is the lower limit for the number of replicas to which the autoscaler
  203. // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
  204. // alpha feature gate HPAScaleToZero is enabled and at least one Object or External
  205. // metric is configured. Scaling is active as long as at least one metric value is
  206. // available.
  207. // +optional
  208. optional int32 minReplicas = 2;
  209. // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
  210. // It cannot be less that minReplicas.
  211. optional int32 maxReplicas = 3;
  212. // metrics contains the specifications for which to use to calculate the
  213. // desired replica count (the maximum replica count across all metrics will
  214. // be used). The desired replica count is calculated multiplying the
  215. // ratio between the target value and the current value by the current
  216. // number of pods. Ergo, metrics used must decrease as the pod count is
  217. // increased, and vice-versa. See the individual metric source types for
  218. // more information about how each type of metric must respond.
  219. // If not set, the default metric will be set to 80% average CPU utilization.
  220. // +listType=atomic
  221. // +optional
  222. repeated MetricSpec metrics = 4;
  223. // behavior configures the scaling behavior of the target
  224. // in both Up and Down directions (scaleUp and scaleDown fields respectively).
  225. // If not set, the default HPAScalingRules for scale up and scale down are used.
  226. // +optional
  227. optional HorizontalPodAutoscalerBehavior behavior = 5;
  228. }
  229. // HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
  230. message HorizontalPodAutoscalerStatus {
  231. // observedGeneration is the most recent generation observed by this autoscaler.
  232. // +optional
  233. optional int64 observedGeneration = 1;
  234. // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods,
  235. // used by the autoscaler to control how often the number of pods is changed.
  236. // +optional
  237. optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScaleTime = 2;
  238. // currentReplicas is current number of replicas of pods managed by this autoscaler,
  239. // as last seen by the autoscaler.
  240. // +optional
  241. optional int32 currentReplicas = 3;
  242. // desiredReplicas is the desired number of replicas of pods managed by this autoscaler,
  243. // as last calculated by the autoscaler.
  244. optional int32 desiredReplicas = 4;
  245. // currentMetrics is the last read state of the metrics used by this autoscaler.
  246. // +listType=atomic
  247. // +optional
  248. repeated MetricStatus currentMetrics = 5;
  249. // conditions is the set of conditions required for this autoscaler to scale its target,
  250. // and indicates whether or not those conditions are met.
  251. // +patchMergeKey=type
  252. // +patchStrategy=merge
  253. // +listType=map
  254. // +listMapKey=type
  255. // +optional
  256. repeated HorizontalPodAutoscalerCondition conditions = 6;
  257. }
  258. // MetricIdentifier defines the name and optionally selector for a metric
  259. message MetricIdentifier {
  260. // name is the name of the given metric
  261. optional string name = 1;
  262. // selector is the string-encoded form of a standard kubernetes label selector for the given metric
  263. // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
  264. // When unset, just the metricName will be used to gather metrics.
  265. // +optional
  266. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2;
  267. }
  268. // MetricSpec specifies how to scale based on a single metric
  269. // (only `type` and one other matching field should be set at once).
  270. message MetricSpec {
  271. // type is the type of metric source. It should be one of "ContainerResource", "External",
  272. // "Object", "Pods" or "Resource", each mapping to a matching field in the object.
  273. optional string type = 1;
  274. // object refers to a metric describing a single kubernetes object
  275. // (for example, hits-per-second on an Ingress object).
  276. // +optional
  277. optional ObjectMetricSource object = 2;
  278. // pods refers to a metric describing each pod in the current scale target
  279. // (for example, transactions-processed-per-second). The values will be
  280. // averaged together before being compared to the target value.
  281. // +optional
  282. optional PodsMetricSource pods = 3;
  283. // resource refers to a resource metric (such as those specified in
  284. // requests and limits) known to Kubernetes describing each pod in the
  285. // current scale target (e.g. CPU or memory). Such metrics are built in to
  286. // Kubernetes, and have special scaling options on top of those available
  287. // to normal per-pod metrics using the "pods" source.
  288. // +optional
  289. optional ResourceMetricSource resource = 4;
  290. // containerResource refers to a resource metric (such as those specified in
  291. // requests and limits) known to Kubernetes describing a single container in
  292. // each pod of the current scale target (e.g. CPU or memory). Such metrics are
  293. // built in to Kubernetes, and have special scaling options on top of those
  294. // available to normal per-pod metrics using the "pods" source.
  295. // +optional
  296. optional ContainerResourceMetricSource containerResource = 7;
  297. // external refers to a global metric that is not associated
  298. // with any Kubernetes object. It allows autoscaling based on information
  299. // coming from components running outside of cluster
  300. // (for example length of queue in cloud messaging service, or
  301. // QPS from loadbalancer running outside of cluster).
  302. // +optional
  303. optional ExternalMetricSource external = 5;
  304. }
  305. // MetricStatus describes the last-read state of a single metric.
  306. message MetricStatus {
  307. // type is the type of metric source. It will be one of "ContainerResource", "External",
  308. // "Object", "Pods" or "Resource", each corresponds to a matching field in the object.
  309. optional string type = 1;
  310. // object refers to a metric describing a single kubernetes object
  311. // (for example, hits-per-second on an Ingress object).
  312. // +optional
  313. optional ObjectMetricStatus object = 2;
  314. // pods refers to a metric describing each pod in the current scale target
  315. // (for example, transactions-processed-per-second). The values will be
  316. // averaged together before being compared to the target value.
  317. // +optional
  318. optional PodsMetricStatus pods = 3;
  319. // resource refers to a resource metric (such as those specified in
  320. // requests and limits) known to Kubernetes describing each pod in the
  321. // current scale target (e.g. CPU or memory). Such metrics are built in to
  322. // Kubernetes, and have special scaling options on top of those available
  323. // to normal per-pod metrics using the "pods" source.
  324. // +optional
  325. optional ResourceMetricStatus resource = 4;
  326. // container resource refers to a resource metric (such as those specified in
  327. // requests and limits) known to Kubernetes describing a single container in each pod in the
  328. // current scale target (e.g. CPU or memory). Such metrics are built in to
  329. // Kubernetes, and have special scaling options on top of those available
  330. // to normal per-pod metrics using the "pods" source.
  331. // +optional
  332. optional ContainerResourceMetricStatus containerResource = 7;
  333. // external refers to a global metric that is not associated
  334. // with any Kubernetes object. It allows autoscaling based on information
  335. // coming from components running outside of cluster
  336. // (for example length of queue in cloud messaging service, or
  337. // QPS from loadbalancer running outside of cluster).
  338. // +optional
  339. optional ExternalMetricStatus external = 5;
  340. }
  341. // MetricTarget defines the target value, average value, or average utilization of a specific metric
  342. message MetricTarget {
  343. // type represents whether the metric type is Utilization, Value, or AverageValue
  344. optional string type = 1;
  345. // value is the target value of the metric (as a quantity).
  346. // +optional
  347. optional .k8s.io.apimachinery.pkg.api.resource.Quantity value = 2;
  348. // averageValue is the target value of the average of the
  349. // metric across all relevant pods (as a quantity)
  350. // +optional
  351. optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 3;
  352. // averageUtilization is the target value of the average of the
  353. // resource metric across all relevant pods, represented as a percentage of
  354. // the requested value of the resource for the pods.
  355. // Currently only valid for Resource metric source type
  356. // +optional
  357. optional int32 averageUtilization = 4;
  358. }
  359. // MetricValueStatus holds the current value for a metric
  360. message MetricValueStatus {
  361. // value is the current value of the metric (as a quantity).
  362. // +optional
  363. optional .k8s.io.apimachinery.pkg.api.resource.Quantity value = 1;
  364. // averageValue is the current value of the average of the
  365. // metric across all relevant pods (as a quantity)
  366. // +optional
  367. optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2;
  368. // currentAverageUtilization is the current value of the average of the
  369. // resource metric across all relevant pods, represented as a percentage of
  370. // the requested value of the resource for the pods.
  371. // +optional
  372. optional int32 averageUtilization = 3;
  373. }
  374. // ObjectMetricSource indicates how to scale on a metric describing a
  375. // kubernetes object (for example, hits-per-second on an Ingress object).
  376. message ObjectMetricSource {
  377. // describedObject specifies the descriptions of a object,such as kind,name apiVersion
  378. optional CrossVersionObjectReference describedObject = 1;
  379. // target specifies the target value for the given metric
  380. optional MetricTarget target = 2;
  381. // metric identifies the target metric by name and selector
  382. optional MetricIdentifier metric = 3;
  383. }
  384. // ObjectMetricStatus indicates the current value of a metric describing a
  385. // kubernetes object (for example, hits-per-second on an Ingress object).
  386. message ObjectMetricStatus {
  387. // metric identifies the target metric by name and selector
  388. optional MetricIdentifier metric = 1;
  389. // current contains the current value for the given metric
  390. optional MetricValueStatus current = 2;
  391. // DescribedObject specifies the descriptions of a object,such as kind,name apiVersion
  392. optional CrossVersionObjectReference describedObject = 3;
  393. }
  394. // PodsMetricSource indicates how to scale on a metric describing each pod in
  395. // the current scale target (for example, transactions-processed-per-second).
  396. // The values will be averaged together before being compared to the target
  397. // value.
  398. message PodsMetricSource {
  399. // metric identifies the target metric by name and selector
  400. optional MetricIdentifier metric = 1;
  401. // target specifies the target value for the given metric
  402. optional MetricTarget target = 2;
  403. }
  404. // PodsMetricStatus indicates the current value of a metric describing each pod in
  405. // the current scale target (for example, transactions-processed-per-second).
  406. message PodsMetricStatus {
  407. // metric identifies the target metric by name and selector
  408. optional MetricIdentifier metric = 1;
  409. // current contains the current value for the given metric
  410. optional MetricValueStatus current = 2;
  411. }
  412. // ResourceMetricSource indicates how to scale on a resource metric known to
  413. // Kubernetes, as specified in requests and limits, describing each pod in the
  414. // current scale target (e.g. CPU or memory). The values will be averaged
  415. // together before being compared to the target. Such metrics are built in to
  416. // Kubernetes, and have special scaling options on top of those available to
  417. // normal per-pod metrics using the "pods" source. Only one "target" type
  418. // should be set.
  419. message ResourceMetricSource {
  420. // name is the name of the resource in question.
  421. optional string name = 1;
  422. // target specifies the target value for the given metric
  423. optional MetricTarget target = 2;
  424. }
  425. // ResourceMetricStatus indicates the current value of a resource metric known to
  426. // Kubernetes, as specified in requests and limits, describing each pod in the
  427. // current scale target (e.g. CPU or memory). Such metrics are built in to
  428. // Kubernetes, and have special scaling options on top of those available to
  429. // normal per-pod metrics using the "pods" source.
  430. message ResourceMetricStatus {
  431. // name is the name of the resource in question.
  432. optional string name = 1;
  433. // current contains the current value for the given metric
  434. optional MetricValueStatus current = 2;
  435. }