You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ignore high replica number for the first 30 min (#382)
* ignore VerticalScalingBasedOnPreferredMaxReplicas when a replica number is smaller than minreplicas
* ignore high replica number for the first 30 min
// It's the first time to notice that the current replica number is bigger than the preferred max replica number.
119
+
// First 30min, we don't use VerticalScalingBasedOnPreferredMaxReplicas because this replica increase might be very temporal.
120
+
// So, here we just change the condition to True, but doesn't trigger scaledUpBasedOnPreferredMaxReplicas.
121
+
tortoise=utils.ChangeTortoiseCondition(tortoise, v1beta3.TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas, v1.ConditionTrue, "ScaledUpBasedOnPreferredMaxReplicas", "the current number of replicas is bigger than the preferred max replica number", now)
122
+
} else {
123
+
// We keep increasing the size until we hit the maxResourceSize.
124
+
tortoise=utils.ChangeTortoiseCondition(tortoise, v1beta3.TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas, v1.ConditionTrue, "ScaledUpBasedOnPreferredMaxReplicas", "the current number of replicas is bigger than the preferred max replica number", now)
125
+
scaledUpBasedOnPreferredMaxReplicas=true
126
+
}
127
+
}
128
+
ifreplicaNum<s.preferredMaxReplicas {
129
+
// Change TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas to False.
130
+
tortoise=utils.ChangeTortoiseCondition(tortoise, v1beta3.TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas, v1.ConditionFalse, "ScaledUpBasedOnPreferredMaxReplicas", "the current number of replicas is not bigger than the preferred max replica number", now)
returnjastified, fmt.Sprintf("change %v request (%v) (%v → %v) based on VPA suggestion", k, containerName, resourceRequest.MilliValue(), jastified), tortoise, nil
255
+
returnjastified, fmt.Sprintf("change %v request (%v) (%v → %v) based on VPA suggestion", k, containerName, resourceRequest.MilliValue(), jastified), nil
226
256
}
227
257
228
258
// p == v1beta3.AutoscalingTypeHorizontal
@@ -231,22 +261,12 @@ func (s *Service) calculateBestNewSize(
231
261
// make the container size bigger (just multiple by 1.3) so that the replica number will be descreased.
232
262
//
233
263
// Here also covers the scenario where the current replica num hits MaximumMaxReplicas.
234
-
ifreplicaNum>=s.preferredMaxReplicas&&
235
-
// If the current replica number is equal to the maximumMaxReplica, increasing the resource request would not change the situation that the replica number is higher than preferredMaxReplicas.
tortoise=utils.ChangeTortoiseCondition(tortoise, v1beta3.TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas, v1.ConditionTrue, "ScaledUpBasedOnPreferredMaxReplicas", "the current number of replicas is bigger than the preferred max replica number", now)
243
-
msg:=fmt.Sprintf("the current number of replicas is bigger than the preferred max replica number in this cluster (%v), so make %v request (%s) bigger (%v → %v)", s.preferredMaxReplicas, k, containerName, resourceRequest.MilliValue(), jastifiedNewSize)
244
-
returnjastifiedNewSize, msg, tortoise, nil
245
-
}
246
-
247
-
ifreplicaNum<s.preferredMaxReplicas {
248
-
// Change TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas to False.
249
-
tortoise=utils.ChangeTortoiseCondition(tortoise, v1beta3.TortoiseConditionTypeScaledUpBasedOnPreferredMaxReplicas, v1.ConditionFalse, "ScaledUpBasedOnPreferredMaxReplicas", "the current number of replicas is not bigger than the preferred max replica number", now)
268
+
msg:=fmt.Sprintf("the current number of replicas (%v) is bigger than the preferred max replica number in this cluster (%v), so make %v request (%s) bigger (%v → %v)", replicaNum, s.preferredMaxReplicas, k, containerName, resourceRequest.MilliValue(), jastifiedNewSize)
269
+
returnjastifiedNewSize, msg, nil
250
270
}
251
271
252
272
ifreplicaNum<=s.minimumMinReplicas {
@@ -263,7 +283,7 @@ func (s *Service) calculateBestNewSize(
returnjastified, fmt.Sprintf("the current number of replicas is equal or smaller than the minimum min replica number in this cluster (%v), so make %v request (%v) smaller (%v → %v) based on VPA suggestion", s.minimumMinReplicas, k, containerName, resourceRequest.MilliValue(), jastified), tortoise, nil
286
+
returnjastified, fmt.Sprintf("the current number of replicas is equal or smaller than the minimum min replica number in this cluster (%v), so make %v request (%v) smaller (%v → %v) based on VPA suggestion", s.minimumMinReplicas, k, containerName, resourceRequest.MilliValue(), jastified), nil
267
287
}
268
288
269
289
// The replica number is OK based on minimumMinReplicas and preferredMaxReplicas.
@@ -273,12 +293,12 @@ func (s *Service) calculateBestNewSize(
273
293
// Also, if the current replica number is equal to the minReplicas,
274
294
// we don't change the resource request based on the current resource utilization
275
295
// because even if the resource utilization is low, it's due to the minReplicas.
276
-
returns.justifyNewSize(resourceRequest.MilliValue(), resourceRequest.MilliValue(), k, minAllocatedResources, containerName), "nothing to do", tortoise, nil
296
+
returns.justifyNewSize(resourceRequest.MilliValue(), resourceRequest.MilliValue(), k, minAllocatedResources, containerName), "nothing to do", nil
returnjastified, fmt.Sprintf("the current resource usage (%v, %v%%) is too small and it's due to unbalanced container size, so make %v request (%v) smaller (%v → %v) based on VPA's recommendation and HPA target utilization %v%%", recommendedResourceRequest.MilliValue(), int(upperUtilization), k, containerName, resourceRequest.MilliValue(), jastified, targetUtilizationValue), tortoise, nil
316
+
returnjastified, fmt.Sprintf("the current resource usage (%v, %v%%) is too small and it's due to unbalanced container size, so make %v request (%v) smaller (%v → %v) based on VPA's recommendation and HPA target utilization %v%%", recommendedResourceRequest.MilliValue(), int(upperUtilization), k, containerName, resourceRequest.MilliValue(), jastified, targetUtilizationValue), nil
297
317
}
298
318
299
319
// Just keep the current resource request.
300
320
// Only do justification.
301
-
returns.justifyNewSize(resourceRequest.MilliValue(), resourceRequest.MilliValue(), k, minAllocatedResources, containerName), "nothing to do", tortoise, nil
321
+
returns.justifyNewSize(resourceRequest.MilliValue(), resourceRequest.MilliValue(), k, minAllocatedResources, containerName), "nothing to do", nil
name: "all horizontal: the temporal replica count being above preferredMaxReplicas doesn't trigger the resource increase of VerticalScalingBasedOnPreferredMaxReplicas",
0 commit comments