Commit Graph

35 Commits

Author SHA1 Message Date
Jerzy Szczepkowski
f843aff083 More unittests for HPA.
Added more unittests for HPA. Fixed inconsistency in replica calculator when usageRatio == 1.0.
2016-11-10 17:30:23 +01:00
Solly Ross
2c66d47786 HPA: Consider unready pods and missing metrics
Currently, the HPA considers unready pods the same as ready pods when
looking at their CPU and custom metric usage.  However, pods frequently
use extra CPU during initialization, so we want to consider them
separately.

This commit causes the HPA to consider unready pods as having 0 CPU
usage when scaling up, and ignores them when scaling down.  If, when
scaling up, factoring the unready pods as having 0 CPU would cause a
downscale instead, we simply choose not to scale.  Otherwise, we simply
scale up at the reduced amount caculated by factoring the pods in at
zero CPU usage.

The effect is that unready pods cause the autoscaler to be a bit more
conservative -- large increases in CPU usage can still cause scales,
even with unready pods in the mix, but will not cause the scale factors
to be as large, in anticipation of the new pods later becoming ready and
handling load.

Similarly, if there are pods for which no metrics have been retrieved,
these pods are treated as having 100% of the requested metric when
scaling down, and 0% when scaling up.  As above, this cannot change the
direction of the scale.

This commit also changes the HPA to ignore superfluous metrics -- as
long as metrics for all ready pods are present, the HPA we make scaling
decisions.  Currently, this only works for CPU.  For custom metrics, we
cannot identify which metrics go to which pods if we get superfluous
metrics, so we abort the scale.
2016-11-08 00:59:23 -05:00
Jerzy Szczepkowski
f495e7322c HPA: fixed wrong count for target replicas calculations.
HPA: fixed wrong count for target replicas calculations (#34821).
2016-10-18 10:20:27 +02:00
Jerzy Szczepkowski
0f0a9b6d61 Fixes in HPA: consider only running pods; proper denominator in avg calculations.
Fixes in HPA: consider only running pods; proper denominator in avg calculations.
2016-09-29 11:20:53 +02:00
mksalawa
2833119a15 Use List objects for metrics in kubectl top and HPA 2016-08-19 17:26:50 +02:00
Marcin Wielgus
75b91ff972 Extra debug information in HPA events 2016-07-19 17:00:45 +02:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Piotr Szczesniak
26ad827893 Use Metrics API in HPA 2016-05-20 19:50:56 +02:00
Clayton Coleman
5e4308f91d
Update use of Quantity in other classes 2016-05-19 08:41:43 -04:00
Marcin Wielgus
8e90cded97 Update Heapster api types location in Godeps 2016-05-04 16:27:12 +02:00
Madhusudan.C.S
fe26381c90 Support for both map-based and set-based selectors in extensions/v1beta1.Scale
Here are a list of changes along with an explanation of how they work:
1. Add a new string field called TargetSelector to the external version of
   extensions Scale type (extensions/v1beta1.Scale). This is a serialized
   version of either the map-based selector (in case of ReplicationControllers)
   or the unversioned.LabelSelector struct (in case of Deployments and
   ReplicaSets).
2. Change the selector field in the internal Scale type (extensions.Scale) to
   unversioned.LabelSelector.
3. Add conversion functions to convert from two external selector fields to a
   single internal selector field. The rules for conversion are as follows:
   i.   If the target resource that this scale targets supports LabelSelector
        (Deployments and ReplicaSets), then serialize the LabelSelector and
        store the string in the TargetSelector field in the external version
        and leave the map-based Selector field as nil.
   ii.  If the target resource only supports a map-based selector
        (ReplicationControllers), then still serialize that selector and
	store the serialized string in the TargetSelector field. Also,
	set the the Selector map field in the external Scale type.
   iii. When converting from external to internal version, parse the
        TargetSelector string into LabelSelector struct if the string isn't
	empty. If it is empty, then check if the Selector map is set and just
	assign that map to the MatchLabels component of the LabelSelector.
   iv.  When converting from internal to external version, serialize the
        LabelSelector and store it in the TargetSelector field. If only
	the MatchLabel component is set, then also copy that value to
	the Selector map field in the external version.
4. HPA now just converts the LabelSelector field to a Selector interface
   type to list the pods.
5. Scale Get and Update etcd methods for Deployments and ReplicaSets now
   return extensions.Scale instead of autoscaling.Scale.
6. Consequently, SubresourceGroupVersion override and is "autoscaling"
   enabled check is now removed from pkg/master/master.go
7. Other small changes to labels package, fuzzer and LabelSelector
   helpers to piece this all together.
8. Add unit tests to HPA targeting Deployments and ReplicaSets.
9. Add an e2e test to HPA targeting ReplicaSets.
2016-03-09 17:54:17 -08:00
Marcin Wielgus
24b12b9191 In HPA metric client make average from samples from the last 1 minute 2016-03-02 15:06:27 +01:00
Marcin Wielgus
34f7105871 Don't include pending pods in metrics calculations 2016-02-19 17:00:38 +01:00
Marcin Wielgus
41cf0cd78f Change custom metrics prefix in HPA metrics client 2016-02-15 20:28:37 +01:00
Marcin Wielgus
67e9db4377 Set verbosity for debug logs 2016-02-08 17:07:05 +01:00
Chao Xu
184440f8ef rename release_1_2 to internalclientset 2016-02-05 14:02:28 -08:00
Chao Xu
1b047f8e67 rename legacy to core 2016-02-04 14:26:56 -08:00
Chao Xu
f9f5736b01 grep sed 2016-02-03 13:06:07 -08:00
Chao Xu
fe7887f1ec replace the client with clientset in controllers 2016-02-02 20:28:45 -08:00
Marcin Wielgus
a3972947cc CustomMetrics in HPA MetricsClient 2016-01-29 18:20:57 +01:00
Wojciech Tyczynski
960808bf08 Switch to versioned ListOptions in client. 2015-12-14 14:26:09 +01:00
Wojciech Tyczynski
6dcb689d4e Simplify List() signature in clients. 2015-12-03 09:54:07 +01:00
Marek Grabowski
f633aa67b1 Merge pull request #18065 from jszczepkowski/hpa-fix
Fixed forbidden window enforcement in horizontal pod autoscaler.
2015-12-03 08:36:10 +01:00
Jerzy Szczepkowski
8cdda36b1e Fixed forbidden window enforcement in horizontal pod autoscaler.
Fixed forbidden window enforcement in horizontal pod autoscaler: time of the oldest report instead of now is taken into account. Fixes #17992.
2015-12-03 08:29:24 +01:00
Wojciech Tyczynski
8343c8ce6c Pass ListOptions to List() methods. 2015-12-01 15:00:36 +01:00
Jordan Liggitt
165d7d5030 Enable specifying scheme/port for metrics client 2015-11-16 13:18:40 -05:00
Solly Ross
f262560cac Customize HPA Heapster service namespace/name
This commit makes the HPA metrics client configurable in where
it looks for heapster instead of hard coding it to
"kube-system/heapster".  The values of "kube-system/heapster"
are still recorded as constants in the metrics client package
for use as default values.
2015-11-02 11:14:08 -05:00
Jerzy Szczepkowski
df732f061a HorizontalPodAutoscaler API: removal of ResourceConsumption target, introduction of CPU request utilization & other cleanups. 2015-10-16 07:15:50 +02:00
Chao Xu
7c9f4cc42f experimental. -> extensions. 2015-10-09 15:49:10 -07:00
Chao Xu
67f316dd19 apis/experimental->apis/extensions 2015-10-09 15:04:41 -07:00
Jerzy Szczepkowski
c8238c079a E2E tests for horizontal pod autoscaler.
Fixes & tuning in horiontal pod autoscaler and its e2e tests; two of the tests added to "Autoscaling suite".
2015-09-24 14:14:35 +02:00
Ewa Socala
1c74b33042 Unit tests for metrics_client.go 2015-09-23 17:36:18 +02:00
Daniel Smith
ccd9e3e247 Run all automated tools 2015-09-11 16:11:08 -07:00
Daniel Smith
4c2adabf42 move; sed replace 2015-09-11 16:03:22 -07:00
Jerzy Szczepkowski
65d43a40e5 Changed nameing in controller for HorizontalPodAutosclaer.
Changed nameing in controller for HorizontalPodAutosclaer to make it consistent with coding conventions.
2015-09-10 15:10:07 +02:00