1 /* 2 Copyright 2016 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v2beta1 18 19 import ( 20 v1 "k8s.io/api/core/v1" 21 "k8s.io/apimachinery/pkg/api/resource" 22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 ) 24 25 // CrossVersionObjectReference contains enough information to let you identify the referred resource. 26 type CrossVersionObjectReference struct { 27 // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 28 Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` 29 // Name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 30 Name string `json:"name" protobuf:"bytes,2,opt,name=name"` 31 // API version of the referent 32 // +optional 33 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"` 34 } 35 36 // HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. 37 type HorizontalPodAutoscalerSpec struct { 38 // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics 39 // should be collected, as well as to actually change the replica count. 40 ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef" protobuf:"bytes,1,opt,name=scaleTargetRef"` 41 // minReplicas is the lower limit for the number of replicas to which the autoscaler 42 // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the 43 // alpha feature gate HPAScaleToZero is enabled and at least one Object or External 44 // metric is configured. Scaling is active as long as at least one metric value is 45 // available. 46 // +optional 47 MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` 48 // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. 49 // It cannot be less that minReplicas. 50 MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` 51 // metrics contains the specifications for which to use to calculate the 52 // desired replica count (the maximum replica count across all metrics will 53 // be used). The desired replica count is calculated multiplying the 54 // ratio between the target value and the current value by the current 55 // number of pods. Ergo, metrics used must decrease as the pod count is 56 // increased, and vice-versa. See the individual metric source types for 57 // more information about how each type of metric must respond. 58 // +optional 59 // +listType=atomic 60 Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` 61 } 62 63 // MetricSourceType indicates the type of metric. 64 type MetricSourceType string 65 66 const ( 67 // ObjectMetricSourceType is a metric describing a kubernetes object 68 // (for example, hits-per-second on an Ingress object). 69 ObjectMetricSourceType MetricSourceType = "Object" 70 // PodsMetricSourceType is a metric describing each pod in the current scale 71 // target (for example, transactions-processed-per-second). The values 72 // will be averaged together before being compared to the target value. 73 PodsMetricSourceType MetricSourceType = "Pods" 74 // ResourceMetricSourceType is a resource metric known to Kubernetes, as 75 // specified in requests and limits, describing each pod in the current 76 // scale target (e.g. CPU or memory). Such metrics are built in to 77 // Kubernetes, and have special scaling options on top of those available 78 // to normal per-pod metrics (the "pods" source). 79 ResourceMetricSourceType MetricSourceType = "Resource" 80 // ContainerResourceMetricSourceType is a resource metric known to Kubernetes, as 81 // specified in requests and limits, describing a single container in each pod in the current 82 // scale target (e.g. CPU or memory). Such metrics are built in to 83 // Kubernetes, and have special scaling options on top of those available 84 // to normal per-pod metrics (the "pods" source). 85 ContainerResourceMetricSourceType MetricSourceType = "ContainerResource" 86 // ExternalMetricSourceType is a global metric that is not associated 87 // with any Kubernetes object. It allows autoscaling based on information 88 // coming from components running outside of cluster 89 // (for example length of queue in cloud messaging service, or 90 // QPS from loadbalancer running outside of cluster). 91 ExternalMetricSourceType MetricSourceType = "External" 92 ) 93 94 // MetricSpec specifies how to scale based on a single metric 95 // (only `type` and one other matching field should be set at once). 96 type MetricSpec struct { 97 // type is the type of metric source. It should be one of "ContainerResource", 98 // "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. 99 // Note: "ContainerResource" type is available on when the feature-gate 100 // HPAContainerMetrics is enabled 101 Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` 102 103 // object refers to a metric describing a single kubernetes object 104 // (for example, hits-per-second on an Ingress object). 105 // +optional 106 Object *ObjectMetricSource `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` 107 // pods refers to a metric describing each pod in the current scale target 108 // (for example, transactions-processed-per-second). The values will be 109 // averaged together before being compared to the target value. 110 // +optional 111 Pods *PodsMetricSource `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` 112 // resource refers to a resource metric (such as those specified in 113 // requests and limits) known to Kubernetes describing each pod in the 114 // current scale target (e.g. CPU or memory). Such metrics are built in to 115 // Kubernetes, and have special scaling options on top of those available 116 // to normal per-pod metrics using the "pods" source. 117 // +optional 118 Resource *ResourceMetricSource `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` 119 // container resource refers to a resource metric (such as those specified in 120 // requests and limits) known to Kubernetes describing a single container in 121 // each pod of the current scale target (e.g. CPU or memory). Such metrics are 122 // built in to Kubernetes, and have special scaling options on top of those 123 // available to normal per-pod metrics using the "pods" source. 124 // This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. 125 // +optional 126 ContainerResource *ContainerResourceMetricSource `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` 127 // external refers to a global metric that is not associated 128 // with any Kubernetes object. It allows autoscaling based on information 129 // coming from components running outside of cluster 130 // (for example length of queue in cloud messaging service, or 131 // QPS from loadbalancer running outside of cluster). 132 // +optional 133 External *ExternalMetricSource `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` 134 } 135 136 // ObjectMetricSource indicates how to scale on a metric describing a 137 // kubernetes object (for example, hits-per-second on an Ingress object). 138 type ObjectMetricSource struct { 139 // target is the described Kubernetes object. 140 Target CrossVersionObjectReference `json:"target" protobuf:"bytes,1,name=target"` 141 142 // metricName is the name of the metric in question. 143 MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"` 144 // targetValue is the target value of the metric (as a quantity). 145 TargetValue resource.Quantity `json:"targetValue" protobuf:"bytes,3,name=targetValue"` 146 147 // selector is the string-encoded form of a standard kubernetes label selector for the given metric 148 // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping 149 // When unset, just the metricName will be used to gather metrics. 150 // +optional 151 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,name=selector"` 152 // averageValue is the target value of the average of the 153 // metric across all relevant pods (as a quantity) 154 // +optional 155 AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,5,name=averageValue"` 156 } 157 158 // PodsMetricSource indicates how to scale on a metric describing each pod in 159 // the current scale target (for example, transactions-processed-per-second). 160 // The values will be averaged together before being compared to the target 161 // value. 162 type PodsMetricSource struct { 163 // metricName is the name of the metric in question 164 MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` 165 // targetAverageValue is the target value of the average of the 166 // metric across all relevant pods (as a quantity) 167 TargetAverageValue resource.Quantity `json:"targetAverageValue" protobuf:"bytes,2,name=targetAverageValue"` 168 169 // selector is the string-encoded form of a standard kubernetes label selector for the given metric 170 // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping 171 // When unset, just the metricName will be used to gather metrics. 172 // +optional 173 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,name=selector"` 174 } 175 176 // ResourceMetricSource indicates how to scale on a resource metric known to 177 // Kubernetes, as specified in requests and limits, describing each pod in the 178 // current scale target (e.g. CPU or memory). The values will be averaged 179 // together before being compared to the target. Such metrics are built in to 180 // Kubernetes, and have special scaling options on top of those available to 181 // normal per-pod metrics using the "pods" source. Only one "target" type 182 // should be set. 183 type ResourceMetricSource struct { 184 // name is the name of the resource in question. 185 Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` 186 // targetAverageUtilization is the target value of the average of the 187 // resource metric across all relevant pods, represented as a percentage of 188 // the requested value of the resource for the pods. 189 // +optional 190 TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty" protobuf:"varint,2,opt,name=targetAverageUtilization"` 191 // targetAverageValue is the target value of the average of the 192 // resource metric across all relevant pods, as a raw value (instead of as 193 // a percentage of the request), similar to the "pods" metric source type. 194 // +optional 195 TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"` 196 } 197 198 // ContainerResourceMetricSource indicates how to scale on a resource metric known to 199 // Kubernetes, as specified in requests and limits, describing each pod in the 200 // current scale target (e.g. CPU or memory). The values will be averaged 201 // together before being compared to the target. Such metrics are built in to 202 // Kubernetes, and have special scaling options on top of those available to 203 // normal per-pod metrics using the "pods" source. Only one "target" type 204 // should be set. 205 type ContainerResourceMetricSource struct { 206 // name is the name of the resource in question. 207 Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` 208 // targetAverageUtilization is the target value of the average of the 209 // resource metric across all relevant pods, represented as a percentage of 210 // the requested value of the resource for the pods. 211 // +optional 212 TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty" protobuf:"varint,2,opt,name=targetAverageUtilization"` 213 // targetAverageValue is the target value of the average of the 214 // resource metric across all relevant pods, as a raw value (instead of as 215 // a percentage of the request), similar to the "pods" metric source type. 216 // +optional 217 TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"` 218 // container is the name of the container in the pods of the scaling target 219 Container string `json:"container" protobuf:"bytes,4,opt,name=container"` 220 } 221 222 // ExternalMetricSource indicates how to scale on a metric not associated with 223 // any Kubernetes object (for example length of queue in cloud 224 // messaging service, or QPS from loadbalancer running outside of cluster). 225 // Exactly one "target" type should be set. 226 type ExternalMetricSource struct { 227 // metricName is the name of the metric in question. 228 MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` 229 // metricSelector is used to identify a specific time series 230 // within a given metric. 231 // +optional 232 MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"` 233 // targetValue is the target value of the metric (as a quantity). 234 // Mutually exclusive with TargetAverageValue. 235 // +optional 236 TargetValue *resource.Quantity `json:"targetValue,omitempty" protobuf:"bytes,3,opt,name=targetValue"` 237 // targetAverageValue is the target per-pod value of global metric (as a quantity). 238 // Mutually exclusive with TargetValue. 239 // +optional 240 TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,4,opt,name=targetAverageValue"` 241 } 242 243 // HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. 244 type HorizontalPodAutoscalerStatus struct { 245 // observedGeneration is the most recent generation observed by this autoscaler. 246 // +optional 247 ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` 248 249 // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, 250 // used by the autoscaler to control how often the number of pods is changed. 251 // +optional 252 LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty" protobuf:"bytes,2,opt,name=lastScaleTime"` 253 254 // currentReplicas is current number of replicas of pods managed by this autoscaler, 255 // as last seen by the autoscaler. 256 CurrentReplicas int32 `json:"currentReplicas" protobuf:"varint,3,opt,name=currentReplicas"` 257 258 // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, 259 // as last calculated by the autoscaler. 260 DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"` 261 262 // currentMetrics is the last read state of the metrics used by this autoscaler. 263 // +optional 264 // +listType=atomic 265 CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` 266 267 // conditions is the set of conditions required for this autoscaler to scale its target, 268 // and indicates whether or not those conditions are met. 269 // +optional 270 // +listType=atomic 271 Conditions []HorizontalPodAutoscalerCondition `json:"conditions" protobuf:"bytes,6,rep,name=conditions"` 272 } 273 274 // HorizontalPodAutoscalerConditionType are the valid conditions of 275 // a HorizontalPodAutoscaler. 276 type HorizontalPodAutoscalerConditionType string 277 278 const ( 279 // ScalingActive indicates that the HPA controller is able to scale if necessary: 280 // it's correctly configured, can fetch the desired metrics, and isn't disabled. 281 ScalingActive HorizontalPodAutoscalerConditionType = "ScalingActive" 282 // AbleToScale indicates a lack of transient issues which prevent scaling from occurring, 283 // such as being in a backoff window, or being unable to access/update the target scale. 284 AbleToScale HorizontalPodAutoscalerConditionType = "AbleToScale" 285 // ScalingLimited indicates that the calculated scale based on metrics would be above or 286 // below the range for the HPA, and has thus been capped. 287 ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" 288 ) 289 290 // HorizontalPodAutoscalerCondition describes the state of 291 // a HorizontalPodAutoscaler at a certain point. 292 type HorizontalPodAutoscalerCondition struct { 293 // type describes the current condition 294 Type HorizontalPodAutoscalerConditionType `json:"type" protobuf:"bytes,1,name=type"` 295 // status is the status of the condition (True, False, Unknown) 296 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,name=status"` 297 // lastTransitionTime is the last time the condition transitioned from 298 // one status to another 299 // +optional 300 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 301 // reason is the reason for the condition's last transition. 302 // +optional 303 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 304 // message is a human-readable explanation containing details about 305 // the transition 306 // +optional 307 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 308 } 309 310 // MetricStatus describes the last-read state of a single metric. 311 type MetricStatus struct { 312 // type is the type of metric source. It will be one of "ContainerResource", 313 // "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. 314 // Note: "ContainerResource" type is available on when the feature-gate 315 // HPAContainerMetrics is enabled 316 Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` 317 318 // object refers to a metric describing a single kubernetes object 319 // (for example, hits-per-second on an Ingress object). 320 // +optional 321 Object *ObjectMetricStatus `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` 322 // pods refers to a metric describing each pod in the current scale target 323 // (for example, transactions-processed-per-second). The values will be 324 // averaged together before being compared to the target value. 325 // +optional 326 Pods *PodsMetricStatus `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` 327 // resource refers to a resource metric (such as those specified in 328 // requests and limits) known to Kubernetes describing each pod in the 329 // current scale target (e.g. CPU or memory). Such metrics are built in to 330 // Kubernetes, and have special scaling options on top of those available 331 // to normal per-pod metrics using the "pods" source. 332 // +optional 333 Resource *ResourceMetricStatus `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` 334 // container resource refers to a resource metric (such as those specified in 335 // requests and limits) known to Kubernetes describing a single container in each pod in the 336 // current scale target (e.g. CPU or memory). Such metrics are built in to 337 // Kubernetes, and have special scaling options on top of those available 338 // to normal per-pod metrics using the "pods" source. 339 // +optional 340 ContainerResource *ContainerResourceMetricStatus `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` 341 // external refers to a global metric that is not associated 342 // with any Kubernetes object. It allows autoscaling based on information 343 // coming from components running outside of cluster 344 // (for example length of queue in cloud messaging service, or 345 // QPS from loadbalancer running outside of cluster). 346 // +optional 347 External *ExternalMetricStatus `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` 348 } 349 350 // ObjectMetricStatus indicates the current value of a metric describing a 351 // kubernetes object (for example, hits-per-second on an Ingress object). 352 type ObjectMetricStatus struct { 353 // target is the described Kubernetes object. 354 Target CrossVersionObjectReference `json:"target" protobuf:"bytes,1,name=target"` 355 356 // metricName is the name of the metric in question. 357 MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"` 358 // currentValue is the current value of the metric (as a quantity). 359 CurrentValue resource.Quantity `json:"currentValue" protobuf:"bytes,3,name=currentValue"` 360 361 // selector is the string-encoded form of a standard kubernetes label selector for the given metric 362 // When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. 363 // When unset, just the metricName will be used to gather metrics. 364 // +optional 365 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,name=selector"` 366 // averageValue is the current value of the average of the 367 // metric across all relevant pods (as a quantity) 368 // +optional 369 AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,5,name=averageValue"` 370 } 371 372 // PodsMetricStatus indicates the current value of a metric describing each pod in 373 // the current scale target (for example, transactions-processed-per-second). 374 type PodsMetricStatus struct { 375 // metricName is the name of the metric in question 376 MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` 377 // currentAverageValue is the current value of the average of the 378 // metric across all relevant pods (as a quantity) 379 CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,2,name=currentAverageValue"` 380 381 // selector is the string-encoded form of a standard kubernetes label selector for the given metric 382 // When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. 383 // When unset, just the metricName will be used to gather metrics. 384 // +optional 385 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,name=selector"` 386 } 387 388 // ResourceMetricStatus indicates the current value of a resource metric known to 389 // Kubernetes, as specified in requests and limits, describing each pod in the 390 // current scale target (e.g. CPU or memory). Such metrics are built in to 391 // Kubernetes, and have special scaling options on top of those available to 392 // normal per-pod metrics using the "pods" source. 393 type ResourceMetricStatus struct { 394 // name is the name of the resource in question. 395 Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` 396 // currentAverageUtilization is the current value of the average of the 397 // resource metric across all relevant pods, represented as a percentage of 398 // the requested value of the resource for the pods. It will only be 399 // present if `targetAverageValue` was set in the corresponding metric 400 // specification. 401 // +optional 402 CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty" protobuf:"bytes,2,opt,name=currentAverageUtilization"` 403 // currentAverageValue is the current value of the average of the 404 // resource metric across all relevant pods, as a raw value (instead of as 405 // a percentage of the request), similar to the "pods" metric source type. 406 // It will always be set, regardless of the corresponding metric specification. 407 CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"` 408 } 409 410 // ContainerResourceMetricStatus indicates the current value of a resource metric known to 411 // Kubernetes, as specified in requests and limits, describing a single container in each pod in the 412 // current scale target (e.g. CPU or memory). Such metrics are built in to 413 // Kubernetes, and have special scaling options on top of those available to 414 // normal per-pod metrics using the "pods" source. 415 type ContainerResourceMetricStatus struct { 416 // name is the name of the resource in question. 417 Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` 418 // currentAverageUtilization 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. It will only be 421 // present if `targetAverageValue` was set in the corresponding metric 422 // specification. 423 // +optional 424 CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty" protobuf:"bytes,2,opt,name=currentAverageUtilization"` 425 // currentAverageValue is the current value of the average of the 426 // resource metric across all relevant pods, as a raw value (instead of as 427 // a percentage of the request), similar to the "pods" metric source type. 428 // It will always be set, regardless of the corresponding metric specification. 429 CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"` 430 // container is the name of the container in the pods of the scaling target 431 Container string `json:"container" protobuf:"bytes,4,opt,name=container"` 432 } 433 434 // ExternalMetricStatus indicates the current value of a global metric 435 // not associated with any Kubernetes object. 436 type ExternalMetricStatus struct { 437 // metricName is the name of a metric used for autoscaling in 438 // metric system. 439 MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` 440 // metricSelector is used to identify a specific time series 441 // within a given metric. 442 // +optional 443 MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"` 444 // currentValue is the current value of the metric (as a quantity) 445 CurrentValue resource.Quantity `json:"currentValue" protobuf:"bytes,3,name=currentValue"` 446 // currentAverageValue is the current value of metric averaged over autoscaled pods. 447 // +optional 448 CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty" protobuf:"bytes,4,opt,name=currentAverageValue"` 449 } 450 451 // +genclient 452 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 453 // +k8s:prerelease-lifecycle-gen:introduced=1.8 454 // +k8s:prerelease-lifecycle-gen:deprecated=1.22 455 // +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2,HorizontalPodAutoscaler 456 457 // HorizontalPodAutoscaler is the configuration for a horizontal pod 458 // autoscaler, which automatically manages the replica count of any resource 459 // implementing the scale subresource based on the metrics specified. 460 type HorizontalPodAutoscaler struct { 461 metav1.TypeMeta `json:",inline"` 462 // metadata is the standard object metadata. 463 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 464 // +optional 465 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 466 467 // spec is the specification for the behaviour of the autoscaler. 468 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. 469 // +optional 470 Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 471 472 // status is the current information about the autoscaler. 473 // +optional 474 Status HorizontalPodAutoscalerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 475 } 476 477 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 478 // +k8s:prerelease-lifecycle-gen:introduced=1.8 479 // +k8s:prerelease-lifecycle-gen:deprecated=1.22 480 // +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2beta2,HorizontalPodAutoscalerList 481 482 // HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects. 483 type HorizontalPodAutoscalerList struct { 484 metav1.TypeMeta `json:",inline"` 485 // metadata is the standard list metadata. 486 // +optional 487 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 488 489 // items is the list of horizontal pod autoscaler objects. 490 Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"` 491 } 492