Merge pull request #41272 from DirectXMan12/feature/hpa-v2-controller
Automatic merge from submit-queue Convert HPA controller to support HPA v2 mechanics This PR converts the HPA controller to support the mechanics from HPA v2. The HPA controller continues to make use of the HPA v1 client, but utilizes the conversion logic to work with autoscaling/v2alpha1 objects internally. It is the follow-up PR to #36033 and part of kubernetes/features#117. **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -547,11 +547,23 @@ func autoscalingFuncs(t apitesting.TestingCommon) []interface{} {
|
||||
minReplicas := int32(c.Rand.Int31())
|
||||
s.MinReplicas = &minReplicas
|
||||
|
||||
// NB: since this is used for round-tripping, we can only fuzz
|
||||
// fields that round-trip successfully, so only the resource source
|
||||
// type is usable here
|
||||
randomQuantity := func() resource.Quantity {
|
||||
var q resource.Quantity
|
||||
c.Fuzz(&q)
|
||||
// precalc the string for benchmarking purposes
|
||||
_ = q.String()
|
||||
return q
|
||||
}
|
||||
|
||||
targetUtilization := int32(c.RandUint64())
|
||||
s.Metrics = []autoscaling.MetricSpec{
|
||||
{
|
||||
Type: autoscaling.PodsMetricSourceType,
|
||||
Pods: &autoscaling.PodsMetricSource{
|
||||
MetricName: c.RandString(),
|
||||
TargetAverageValue: randomQuantity(),
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: autoscaling.ResourceMetricSourceType,
|
||||
Resource: &autoscaling.ResourceMetricSource{
|
||||
@@ -563,11 +575,22 @@ func autoscalingFuncs(t apitesting.TestingCommon) []interface{} {
|
||||
},
|
||||
func(s *autoscaling.HorizontalPodAutoscalerStatus, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
// NB: since this is used for round-tripping, we can only fuzz
|
||||
// fields that round-trip successfully, so only the resource status
|
||||
// type is usable here
|
||||
randomQuantity := func() resource.Quantity {
|
||||
var q resource.Quantity
|
||||
c.Fuzz(&q)
|
||||
// precalc the string for benchmarking purposes
|
||||
_ = q.String()
|
||||
return q
|
||||
}
|
||||
currentUtilization := int32(c.RandUint64())
|
||||
s.CurrentMetrics = []autoscaling.MetricStatus{
|
||||
{
|
||||
Type: autoscaling.PodsMetricSourceType,
|
||||
Pods: &autoscaling.PodsMetricStatus{
|
||||
MetricName: c.RandString(),
|
||||
CurrentAverageValue: randomQuantity(),
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: autoscaling.ResourceMetricSourceType,
|
||||
Resource: &autoscaling.ResourceMetricStatus{
|
||||
|
Reference in New Issue
Block a user