generated.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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.v2beta2;
  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/v2beta2";
  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.
  90. // These Rules are applied after calculating DesiredReplicas from metrics for the HPA.
  91. // They can limit the scaling velocity by specifying scaling policies.
  92. // They can prevent flapping by specifying the stabilization window, so that the
  93. // number of replicas is not set instantly, instead, the safest value from the stabilization
  94. // window is chosen.
  95. message HPAScalingRules {
  96. // stabilizationWindowSeconds is the number of seconds for which past recommendations should be
  97. // considered while scaling up or scaling down.
  98. // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).
  99. // If not set, use the default values:
  100. // - For scale up: 0 (i.e. no stabilization is done).
  101. // - For scale down: 300 (i.e. the stabilization window is 300 seconds long).
  102. // +optional
  103. optional int32 stabilizationWindowSeconds = 3;
  104. // selectPolicy is used to specify which policy should be used.
  105. // If not set, the default value MaxPolicySelect is used.
  106. // +optional
  107. optional string selectPolicy = 1;
  108. // policies is a list of potential scaling polices which can be used during scaling.
  109. // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid
  110. // +optional
  111. repeated HPAScalingPolicy policies = 2;
  112. }
  113. // HorizontalPodAutoscaler is the configuration for a horizontal pod
  114. // autoscaler, which automatically manages the replica count of any resource
  115. // implementing the scale subresource based on the metrics specified.
  116. message HorizontalPodAutoscaler {
  117. // metadata is the standard object metadata.
  118. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  119. // +optional
  120. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  121. // spec is the specification for the behaviour of the autoscaler.
  122. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
  123. // +optional
  124. optional HorizontalPodAutoscalerSpec spec = 2;
  125. // status is the current information about the autoscaler.
  126. // +optional
  127. optional HorizontalPodAutoscalerStatus status = 3;
  128. }
  129. // HorizontalPodAutoscalerBehavior configures the scaling behavior of the target
  130. // in both Up and Down directions (scaleUp and scaleDown fields respectively).
  131. message HorizontalPodAutoscalerBehavior {
  132. // scaleUp is scaling policy for scaling Up.
  133. // If not set, the default value is the higher of:
  134. // * increase no more than 4 pods per 60 seconds
  135. // * double the number of pods per 60 seconds
  136. // No stabilization is used.
  137. // +optional
  138. optional HPAScalingRules scaleUp = 1;
  139. // scaleDown is scaling policy for scaling Down.
  140. // If not set, the default value is to allow to scale down to minReplicas pods, with a
  141. // 300 second stabilization window (i.e., the highest recommendation for
  142. // the last 300sec is used).
  143. // +optional
  144. optional HPAScalingRules scaleDown = 2;
  145. }
  146. // HorizontalPodAutoscalerCondition describes the state of
  147. // a HorizontalPodAutoscaler at a certain point.
  148. message HorizontalPodAutoscalerCondition {
  149. // type describes the current condition
  150. optional string type = 1;
  151. // status is the status of the condition (True, False, Unknown)
  152. optional string status = 2;
  153. // lastTransitionTime is the last time the condition transitioned from
  154. // one status to another
  155. // +optional
  156. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
  157. // reason is the reason for the condition's last transition.
  158. // +optional
  159. optional string reason = 4;
  160. // message is a human-readable explanation containing details about
  161. // the transition
  162. // +optional
  163. optional string message = 5;
  164. }
  165. // HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects.
  166. message HorizontalPodAutoscalerList {
  167. // metadata is the standard list metadata.
  168. // +optional
  169. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  170. // items is the list of horizontal pod autoscaler objects.
  171. repeated HorizontalPodAutoscaler items = 2;
  172. }
  173. // HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.
  174. message HorizontalPodAutoscalerSpec {
  175. // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics
  176. // should be collected, as well as to actually change the replica count.
  177. optional CrossVersionObjectReference scaleTargetRef = 1;
  178. // minReplicas is the lower limit for the number of replicas to which the autoscaler
  179. // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
  180. // alpha feature gate HPAScaleToZero is enabled and at least one Object or External
  181. // metric is configured. Scaling is active as long as at least one metric value is
  182. // available.
  183. // +optional
  184. optional int32 minReplicas = 2;
  185. // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
  186. // It cannot be less that minReplicas.
  187. optional int32 maxReplicas = 3;
  188. // metrics contains the specifications for which to use to calculate the
  189. // desired replica count (the maximum replica count across all metrics will
  190. // be used). The desired replica count is calculated multiplying the
  191. // ratio between the target value and the current value by the current
  192. // number of pods. Ergo, metrics used must decrease as the pod count is
  193. // increased, and vice-versa. See the individual metric source types for
  194. // more information about how each type of metric must respond.
  195. // If not set, the default metric will be set to 80% average CPU utilization.
  196. // +optional
  197. repeated MetricSpec metrics = 4;
  198. // behavior configures the scaling behavior of the target
  199. // in both Up and Down directions (scaleUp and scaleDown fields respectively).
  200. // If not set, the default HPAScalingRules for scale up and scale down are used.
  201. // +optional
  202. optional HorizontalPodAutoscalerBehavior behavior = 5;
  203. }
  204. // HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
  205. message HorizontalPodAutoscalerStatus {
  206. // observedGeneration is the most recent generation observed by this autoscaler.
  207. // +optional
  208. optional int64 observedGeneration = 1;
  209. // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods,
  210. // used by the autoscaler to control how often the number of pods is changed.
  211. // +optional
  212. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScaleTime = 2;
  213. // currentReplicas is current number of replicas of pods managed by this autoscaler,
  214. // as last seen by the autoscaler.
  215. optional int32 currentReplicas = 3;
  216. // desiredReplicas is the desired number of replicas of pods managed by this autoscaler,
  217. // as last calculated by the autoscaler.
  218. optional int32 desiredReplicas = 4;
  219. // currentMetrics is the last read state of the metrics used by this autoscaler.
  220. // +optional
  221. repeated MetricStatus currentMetrics = 5;
  222. // conditions is the set of conditions required for this autoscaler to scale its target,
  223. // and indicates whether or not those conditions are met.
  224. // +optional
  225. repeated HorizontalPodAutoscalerCondition conditions = 6;
  226. }
  227. // MetricIdentifier defines the name and optionally selector for a metric
  228. message MetricIdentifier {
  229. // name is the name of the given metric
  230. optional string name = 1;
  231. // selector is the string-encoded form of a standard kubernetes label selector for the given metric
  232. // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
  233. // When unset, just the metricName will be used to gather metrics.
  234. // +optional
  235. optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2;
  236. }
  237. // MetricSpec specifies how to scale based on a single metric
  238. // (only `type` and one other matching field should be set at once).
  239. message MetricSpec {
  240. // type is the type of metric source. It should be one of "ContainerResource", "External",
  241. // "Object", "Pods" or "Resource", each mapping to a matching field in the object.
  242. // Note: "ContainerResource" type is available on when the feature-gate
  243. // HPAContainerMetrics is enabled
  244. optional string type = 1;
  245. // object refers to a metric describing a single kubernetes object
  246. // (for example, hits-per-second on an Ingress object).
  247. // +optional
  248. optional ObjectMetricSource object = 2;
  249. // pods refers to a metric describing each pod in the current scale target
  250. // (for example, transactions-processed-per-second). The values will be
  251. // averaged together before being compared to the target value.
  252. // +optional
  253. optional PodsMetricSource pods = 3;
  254. // resource refers to a resource metric (such as those specified in
  255. // requests and limits) known to Kubernetes describing each pod in the
  256. // current scale target (e.g. CPU or memory). Such metrics are built in to
  257. // Kubernetes, and have special scaling options on top of those available
  258. // to normal per-pod metrics using the "pods" source.
  259. // +optional
  260. optional ResourceMetricSource resource = 4;
  261. // container resource refers to a resource metric (such as those specified in
  262. // requests and limits) known to Kubernetes describing a single container in
  263. // each pod of the current scale target (e.g. CPU or memory). Such metrics are
  264. // built in to Kubernetes, and have special scaling options on top of those
  265. // available to normal per-pod metrics using the "pods" source.
  266. // This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
  267. // +optional
  268. optional ContainerResourceMetricSource containerResource = 7;
  269. // external refers to a global metric that is not associated
  270. // with any Kubernetes object. It allows autoscaling based on information
  271. // coming from components running outside of cluster
  272. // (for example length of queue in cloud messaging service, or
  273. // QPS from loadbalancer running outside of cluster).
  274. // +optional
  275. optional ExternalMetricSource external = 5;
  276. }
  277. // MetricStatus describes the last-read state of a single metric.
  278. message MetricStatus {
  279. // type is the type of metric source. It will be one of "ContainerResource", "External",
  280. // "Object", "Pods" or "Resource", each corresponds to a matching field in the object.
  281. // Note: "ContainerResource" type is available on when the feature-gate
  282. // HPAContainerMetrics is enabled
  283. optional string type = 1;
  284. // object refers to a metric describing a single kubernetes object
  285. // (for example, hits-per-second on an Ingress object).
  286. // +optional
  287. optional ObjectMetricStatus object = 2;
  288. // pods refers to a metric describing each pod in the current scale target
  289. // (for example, transactions-processed-per-second). The values will be
  290. // averaged together before being compared to the target value.
  291. // +optional
  292. optional PodsMetricStatus pods = 3;
  293. // resource refers to a resource metric (such as those specified in
  294. // requests and limits) known to Kubernetes describing each pod in the
  295. // current scale target (e.g. CPU or memory). Such metrics are built in to
  296. // Kubernetes, and have special scaling options on top of those available
  297. // to normal per-pod metrics using the "pods" source.
  298. // +optional
  299. optional ResourceMetricStatus resource = 4;
  300. // containerResource refers to a resource metric (such as those specified in
  301. // requests and limits) known to Kubernetes describing a single container in each pod in the
  302. // current scale target (e.g. CPU or memory). Such metrics are built in to
  303. // Kubernetes, and have special scaling options on top of those available
  304. // to normal per-pod metrics using the "pods" source.
  305. // +optional
  306. optional ContainerResourceMetricStatus containerResource = 7;
  307. // external refers to a global metric that is not associated
  308. // with any Kubernetes object. It allows autoscaling based on information
  309. // coming from components running outside of cluster
  310. // (for example length of queue in cloud messaging service, or
  311. // QPS from loadbalancer running outside of cluster).
  312. // +optional
  313. optional ExternalMetricStatus external = 5;
  314. }
  315. // MetricTarget defines the target value, average value, or average utilization of a specific metric
  316. message MetricTarget {
  317. // type represents whether the metric type is Utilization, Value, or AverageValue
  318. optional string type = 1;
  319. // value is the target value of the metric (as a quantity).
  320. // +optional
  321. optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 2;
  322. // averageValue is the target value of the average of the
  323. // metric across all relevant pods (as a quantity)
  324. // +optional
  325. optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 3;
  326. // averageUtilization is the target value of the average of the
  327. // resource metric across all relevant pods, represented as a percentage of
  328. // the requested value of the resource for the pods.
  329. // Currently only valid for Resource metric source type
  330. // +optional
  331. optional int32 averageUtilization = 4;
  332. }
  333. // MetricValueStatus holds the current value for a metric
  334. message MetricValueStatus {
  335. // value is the current value of the metric (as a quantity).
  336. // +optional
  337. optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 1;
  338. // averageValue is the current value of the average of the
  339. // metric across all relevant pods (as a quantity)
  340. // +optional
  341. optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2;
  342. // averageUtilization is the current value of the average of the
  343. // resource metric across all relevant pods, represented as a percentage of
  344. // the requested value of the resource for the pods.
  345. // +optional
  346. optional int32 averageUtilization = 3;
  347. }
  348. // ObjectMetricSource indicates how to scale on a metric describing a
  349. // kubernetes object (for example, hits-per-second on an Ingress object).
  350. message ObjectMetricSource {
  351. optional CrossVersionObjectReference describedObject = 1;
  352. // target specifies the target value for the given metric
  353. optional MetricTarget target = 2;
  354. // metric identifies the target metric by name and selector
  355. optional MetricIdentifier metric = 3;
  356. }
  357. // ObjectMetricStatus indicates the current value of a metric describing a
  358. // kubernetes object (for example, hits-per-second on an Ingress object).
  359. message ObjectMetricStatus {
  360. // metric identifies the target metric by name and selector
  361. optional MetricIdentifier metric = 1;
  362. // current contains the current value for the given metric
  363. optional MetricValueStatus current = 2;
  364. optional CrossVersionObjectReference describedObject = 3;
  365. }
  366. // PodsMetricSource indicates how to scale on a metric describing each pod in
  367. // the current scale target (for example, transactions-processed-per-second).
  368. // The values will be averaged together before being compared to the target
  369. // value.
  370. message PodsMetricSource {
  371. // metric identifies the target metric by name and selector
  372. optional MetricIdentifier metric = 1;
  373. // target specifies the target value for the given metric
  374. optional MetricTarget target = 2;
  375. }
  376. // PodsMetricStatus indicates the current value of a metric describing each pod in
  377. // the current scale target (for example, transactions-processed-per-second).
  378. message PodsMetricStatus {
  379. // metric identifies the target metric by name and selector
  380. optional MetricIdentifier metric = 1;
  381. // current contains the current value for the given metric
  382. optional MetricValueStatus current = 2;
  383. }
  384. // ResourceMetricSource indicates how to scale on a resource metric known to
  385. // Kubernetes, as specified in requests and limits, describing each pod in the
  386. // current scale target (e.g. CPU or memory). The values will be averaged
  387. // together before being compared to the target. Such metrics are built in to
  388. // Kubernetes, and have special scaling options on top of those available to
  389. // normal per-pod metrics using the "pods" source. Only one "target" type
  390. // should be set.
  391. message ResourceMetricSource {
  392. // name is the name of the resource in question.
  393. optional string name = 1;
  394. // target specifies the target value for the given metric
  395. optional MetricTarget target = 2;
  396. }
  397. // ResourceMetricStatus indicates the current value of a resource metric known to
  398. // Kubernetes, as specified in requests and limits, describing each pod in the
  399. // current scale target (e.g. CPU or memory). Such metrics are built in to
  400. // Kubernetes, and have special scaling options on top of those available to
  401. // normal per-pod metrics using the "pods" source.
  402. message ResourceMetricStatus {
  403. // name is the name of the resource in question.
  404. optional string name = 1;
  405. // current contains the current value for the given metric
  406. optional MetricValueStatus current = 2;
  407. }