Open chenshiwei-io opened 1 year ago
emm.. indeed. @mfanjie any idea?
In my opinion, if the tolerance is set and it is really needed, there is no requirement for the specific number of instances (22 or 24 is fine). So we don't need to change it, just doc it. In other scenarios, a precise number of instances is really needed, we can set specficReplicas based on cron rules. At this time, because a precise number of instances is required, the feature provided by cronHPA that can work together with cron rules and other indicators is no longer needed.
We can provide an option in cron to indicate whether we need to strictly follow cron rules. @qmhu
Describe the bug The Kubernetes Horizontal Pod Autoscaler (HPA) has a default tolerance of 0.1. In EHPA, the cron-based scaling may not scale up or down to the desired number of replicas. For example, if the scheduled scaling is set to 24 replicas but it only scales up to 22, the calculation becomes 24/22 = 1.09. Since 0.09 falls within the tolerance range, it stops further scaling.
cron about code: https://github.com/gocrane/crane/blob/2a3f5ede0af001f54fb127c736dad650839b90e9/pkg/controller/ehpa/hpa.go#L307
globally-configurable tolerance: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
Reproduce steps
Expected behavior
Screenshots
Environment (please complete the following information):