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