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