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