mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Introduce HPA v2 API Objects
This commit introduces the autoscaling/v2alpha1 API group, which currently contains the first alpha of the new HorizontalPodAutoscaler object.
This commit is contained in:
@@ -546,8 +546,36 @@ func autoscalingFuncs(t apitesting.TestingCommon) []interface{} {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
minReplicas := int32(c.Rand.Int31())
|
||||
s.MinReplicas = &minReplicas
|
||||
targetCpu := int32(c.RandUint64())
|
||||
s.TargetCPUUtilizationPercentage = &targetCpu
|
||||
|
||||
// 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
|
||||
targetUtilization := int32(c.RandUint64())
|
||||
s.Metrics = []autoscaling.MetricSpec{
|
||||
{
|
||||
Type: autoscaling.ResourceMetricSourceType,
|
||||
Resource: &autoscaling.ResourceMetricSource{
|
||||
Name: api.ResourceCPU,
|
||||
TargetAverageUtilization: &targetUtilization,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
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
|
||||
currentUtilization := int32(c.RandUint64())
|
||||
s.CurrentMetrics = []autoscaling.MetricStatus{
|
||||
{
|
||||
Type: autoscaling.ResourceMetricSourceType,
|
||||
Resource: &autoscaling.ResourceMetricStatus{
|
||||
Name: api.ResourceCPU,
|
||||
CurrentAverageUtilization: ¤tUtilization,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user