blob: f90f93f9f4026df034cde1996c96c89bc541a663 [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.v2beta1;
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 = "v2beta1";
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).
49// Exactly one "target" type should be set.
50message ExternalMetricSource {
51 // metricName is the name of the metric in question.
52 optional string metricName = 1;
53
54 // metricSelector is used to identify a specific time series
55 // within a given metric.
56 // +optional
57 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector metricSelector = 2;
58
59 // targetValue is the target value of the metric (as a quantity).
60 // Mutually exclusive with TargetAverageValue.
61 // +optional
62 optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3;
63
64 // targetAverageValue is the target per-pod value of global metric (as a quantity).
65 // Mutually exclusive with TargetValue.
66 // +optional
67 optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 4;
68}
69
70// ExternalMetricStatus indicates the current value of a global metric
71// not associated with any Kubernetes object.
72message ExternalMetricStatus {
73 // metricName is the name of a metric used for autoscaling in
74 // metric system.
75 optional string metricName = 1;
76
77 // metricSelector is used to identify a specific time series
78 // within a given metric.
79 // +optional
80 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector metricSelector = 2;
81
82 // currentValue is the current value of the metric (as a quantity)
83 optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3;
84
85 // currentAverageValue is the current value of metric averaged over autoscaled pods.
86 // +optional
87 optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 4;
88}
89
90// HorizontalPodAutoscaler is the configuration for a horizontal pod
91// autoscaler, which automatically manages the replica count of any resource
92// implementing the scale subresource based on the metrics specified.
93message HorizontalPodAutoscaler {
94 // metadata is the standard object metadata.
95 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
96 // +optional
97 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
98
99 // spec is the specification for the behaviour of the autoscaler.
100 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
101 // +optional
102 optional HorizontalPodAutoscalerSpec spec = 2;
103
104 // status is the current information about the autoscaler.
105 // +optional
106 optional HorizontalPodAutoscalerStatus status = 3;
107}
108
109// HorizontalPodAutoscalerCondition describes the state of
110// a HorizontalPodAutoscaler at a certain point.
111message HorizontalPodAutoscalerCondition {
112 // type describes the current condition
113 optional string type = 1;
114
115 // status is the status of the condition (True, False, Unknown)
116 optional string status = 2;
117
118 // lastTransitionTime is the last time the condition transitioned from
119 // one status to another
120 // +optional
121 optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
122
123 // reason is the reason for the condition's last transition.
124 // +optional
125 optional string reason = 4;
126
127 // message is a human-readable explanation containing details about
128 // the transition
129 // +optional
130 optional string message = 5;
131}
132
133// HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects.
134message HorizontalPodAutoscalerList {
135 // metadata is the standard list metadata.
136 // +optional
137 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
138
139 // items is the list of horizontal pod autoscaler objects.
140 repeated HorizontalPodAutoscaler items = 2;
141}
142
143// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.
144message HorizontalPodAutoscalerSpec {
145 // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics
146 // should be collected, as well as to actually change the replica count.
147 optional CrossVersionObjectReference scaleTargetRef = 1;
148
149 // minReplicas is the lower limit for the number of replicas to which the autoscaler
150 // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
151 // alpha feature gate HPAScaleToZero is enabled and at least one Object or External
152 // metric is configured. Scaling is active as long as at least one metric value is
153 // available.
154 // +optional
155 optional int32 minReplicas = 2;
156
157 // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
158 // It cannot be less that minReplicas.
159 optional int32 maxReplicas = 3;
160
161 // metrics contains the specifications for which to use to calculate the
162 // desired replica count (the maximum replica count across all metrics will
163 // be used). The desired replica count is calculated multiplying the
164 // ratio between the target value and the current value by the current
165 // number of pods. Ergo, metrics used must decrease as the pod count is
166 // increased, and vice-versa. See the individual metric source types for
167 // more information about how each type of metric must respond.
168 // +optional
169 repeated MetricSpec metrics = 4;
170}
171
172// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
173message HorizontalPodAutoscalerStatus {
174 // observedGeneration is the most recent generation observed by this autoscaler.
175 // +optional
176 optional int64 observedGeneration = 1;
177
178 // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods,
179 // used by the autoscaler to control how often the number of pods is changed.
180 // +optional
181 optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScaleTime = 2;
182
183 // currentReplicas is current number of replicas of pods managed by this autoscaler,
184 // as last seen by the autoscaler.
185 optional int32 currentReplicas = 3;
186
187 // desiredReplicas is the desired number of replicas of pods managed by this autoscaler,
188 // as last calculated by the autoscaler.
189 optional int32 desiredReplicas = 4;
190
191 // currentMetrics is the last read state of the metrics used by this autoscaler.
192 // +optional
193 repeated MetricStatus currentMetrics = 5;
194
195 // conditions is the set of conditions required for this autoscaler to scale its target,
196 // and indicates whether or not those conditions are met.
197 repeated HorizontalPodAutoscalerCondition conditions = 6;
198}
199
200// MetricSpec specifies how to scale based on a single metric
201// (only `type` and one other matching field should be set at once).
202message MetricSpec {
203 // type is the type of metric source. It should be one of "Object",
204 // "Pods" or "Resource", each mapping to a matching field in the object.
205 optional string type = 1;
206
207 // object refers to a metric describing a single kubernetes object
208 // (for example, hits-per-second on an Ingress object).
209 // +optional
210 optional ObjectMetricSource object = 2;
211
212 // pods refers to a metric describing each pod in the current scale target
213 // (for example, transactions-processed-per-second). The values will be
214 // averaged together before being compared to the target value.
215 // +optional
216 optional PodsMetricSource pods = 3;
217
218 // resource refers to a resource metric (such as those specified in
219 // requests and limits) known to Kubernetes describing each pod in the
220 // current scale target (e.g. CPU or memory). Such metrics are built in to
221 // Kubernetes, and have special scaling options on top of those available
222 // to normal per-pod metrics using the "pods" source.
223 // +optional
224 optional ResourceMetricSource resource = 4;
225
226 // external refers to a global metric that is not associated
227 // with any Kubernetes object. It allows autoscaling based on information
228 // coming from components running outside of cluster
229 // (for example length of queue in cloud messaging service, or
230 // QPS from loadbalancer running outside of cluster).
231 // +optional
232 optional ExternalMetricSource external = 5;
233}
234
235// MetricStatus describes the last-read state of a single metric.
236message MetricStatus {
237 // type is the type of metric source. It will be one of "Object",
238 // "Pods" or "Resource", each corresponds to a matching field in the object.
239 optional string type = 1;
240
241 // object refers to a metric describing a single kubernetes object
242 // (for example, hits-per-second on an Ingress object).
243 // +optional
244 optional ObjectMetricStatus object = 2;
245
246 // pods refers to a metric describing each pod in the current scale target
247 // (for example, transactions-processed-per-second). The values will be
248 // averaged together before being compared to the target value.
249 // +optional
250 optional PodsMetricStatus pods = 3;
251
252 // resource refers to a resource metric (such as those specified in
253 // requests and limits) known to Kubernetes describing each pod in the
254 // current scale target (e.g. CPU or memory). Such metrics are built in to
255 // Kubernetes, and have special scaling options on top of those available
256 // to normal per-pod metrics using the "pods" source.
257 // +optional
258 optional ResourceMetricStatus resource = 4;
259
260 // external refers to a global metric that is not associated
261 // with any Kubernetes object. It allows autoscaling based on information
262 // coming from components running outside of cluster
263 // (for example length of queue in cloud messaging service, or
264 // QPS from loadbalancer running outside of cluster).
265 // +optional
266 optional ExternalMetricStatus external = 5;
267}
268
269// ObjectMetricSource indicates how to scale on a metric describing a
270// kubernetes object (for example, hits-per-second on an Ingress object).
271message ObjectMetricSource {
272 // target is the described Kubernetes object.
273 optional CrossVersionObjectReference target = 1;
274
275 // metricName is the name of the metric in question.
276 optional string metricName = 2;
277
278 // targetValue is the target value of the metric (as a quantity).
279 optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3;
280
281 // selector is the string-encoded form of a standard kubernetes label selector for the given metric
282 // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping
283 // When unset, just the metricName will be used to gather metrics.
284 // +optional
285 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 4;
286
287 // averageValue is the target value of the average of the
288 // metric across all relevant pods (as a quantity)
289 // +optional
290 optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5;
291}
292
293// ObjectMetricStatus indicates the current value of a metric describing a
294// kubernetes object (for example, hits-per-second on an Ingress object).
295message ObjectMetricStatus {
296 // target is the described Kubernetes object.
297 optional CrossVersionObjectReference target = 1;
298
299 // metricName is the name of the metric in question.
300 optional string metricName = 2;
301
302 // currentValue is the current value of the metric (as a quantity).
303 optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3;
304
305 // selector is the string-encoded form of a standard kubernetes label selector for the given metric
306 // When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
307 // When unset, just the metricName will be used to gather metrics.
308 // +optional
309 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 4;
310
311 // averageValue is the current value of the average of the
312 // metric across all relevant pods (as a quantity)
313 // +optional
314 optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5;
315}
316
317// PodsMetricSource indicates how to scale on a metric describing each pod in
318// the current scale target (for example, transactions-processed-per-second).
319// The values will be averaged together before being compared to the target
320// value.
321message PodsMetricSource {
322 // metricName is the name of the metric in question
323 optional string metricName = 1;
324
325 // targetAverageValue is the target value of the average of the
326 // metric across all relevant pods (as a quantity)
327 optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2;
328
329 // selector is the string-encoded form of a standard kubernetes label selector for the given metric
330 // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping
331 // When unset, just the metricName will be used to gather metrics.
332 // +optional
333 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3;
334}
335
336// PodsMetricStatus indicates the current value of a metric describing each pod in
337// the current scale target (for example, transactions-processed-per-second).
338message PodsMetricStatus {
339 // metricName is the name of the metric in question
340 optional string metricName = 1;
341
342 // currentAverageValue is the current value of the average of the
343 // metric across all relevant pods (as a quantity)
344 optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2;
345
346 // selector is the string-encoded form of a standard kubernetes label selector for the given metric
347 // When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping.
348 // When unset, just the metricName will be used to gather metrics.
349 // +optional
350 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3;
351}
352
353// ResourceMetricSource indicates how to scale on a resource metric known to
354// Kubernetes, as specified in requests and limits, describing each pod in the
355// current scale target (e.g. CPU or memory). The values will be averaged
356// together before being compared to the target. Such metrics are built in to
357// Kubernetes, and have special scaling options on top of those available to
358// normal per-pod metrics using the "pods" source. Only one "target" type
359// should be set.
360message ResourceMetricSource {
361 // name is the name of the resource in question.
362 optional string name = 1;
363
364 // targetAverageUtilization is the target value of the average of the
365 // resource metric across all relevant pods, represented as a percentage of
366 // the requested value of the resource for the pods.
367 // +optional
368 optional int32 targetAverageUtilization = 2;
369
370 // targetAverageValue is the target value of the average of the
371 // resource metric across all relevant pods, as a raw value (instead of as
372 // a percentage of the request), similar to the "pods" metric source type.
373 // +optional
374 optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 3;
375}
376
377// ResourceMetricStatus indicates the current value of a resource metric known to
378// Kubernetes, as specified in requests and limits, describing each pod in the
379// current scale target (e.g. CPU or memory). Such metrics are built in to
380// Kubernetes, and have special scaling options on top of those available to
381// normal per-pod metrics using the "pods" source.
382message ResourceMetricStatus {
383 // name is the name of the resource in question.
384 optional string name = 1;
385
386 // currentAverageUtilization is the current value of the average of the
387 // resource metric across all relevant pods, represented as a percentage of
388 // the requested value of the resource for the pods. It will only be
389 // present if `targetAverageValue` was set in the corresponding metric
390 // specification.
391 // +optional
392 optional int32 currentAverageUtilization = 2;
393
394 // currentAverageValue is the current value of the average of the
395 // resource metric across all relevant pods, as a raw value (instead of as
396 // a percentage of the request), similar to the "pods" metric source type.
397 // It will always be set, regardless of the corresponding metric specification.
398 optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 3;
399}
400