mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
hpa: Prevent scaling below MinReplicas if desiredReplicas is zero
This commit is contained in:
@@ -994,6 +994,25 @@ func TestMinReplicas(t *testing.T) {
|
||||
tc.runTest(t)
|
||||
}
|
||||
|
||||
func TestMinReplicasDesiredZero(t *testing.T) {
|
||||
tc := testCase{
|
||||
minReplicas: 2,
|
||||
maxReplicas: 5,
|
||||
initialReplicas: 3,
|
||||
desiredReplicas: 2,
|
||||
CPUTarget: 90,
|
||||
reportedLevels: []uint64{0, 0, 0},
|
||||
reportedCPURequests: []resource.Quantity{resource.MustParse("0.9"), resource.MustParse("1.0"), resource.MustParse("1.1")},
|
||||
useMetricsApi: true,
|
||||
expectedConditions: statusOkWithOverrides(autoscalingv2.HorizontalPodAutoscalerCondition{
|
||||
Type: autoscalingv2.ScalingLimited,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: "TooFewReplicas",
|
||||
}),
|
||||
}
|
||||
tc.runTest(t)
|
||||
}
|
||||
|
||||
func TestZeroReplicas(t *testing.T) {
|
||||
tc := testCase{
|
||||
minReplicas: 3,
|
||||
|
||||
Reference in New Issue
Block a user