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