gocrane / crane

Crane is a FinOps Platform for Cloud Resource Analytics and Economics in Kubernetes clusters. The goal is not only to help users to manage cloud cost easier but also ensure the quality of applications.
https://gocrane.io
Apache License 2.0
1.85k stars 378 forks source link

EHPA cron can't scale to specified replicas,because hpa within a globally-configurable tolerance, 0.1 by default #836

Open chenshiwei-io opened 1 year ago

chenshiwei-io commented 1 year ago

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.

Reproduce steps

Expected behavior

Screenshots

Environment (please complete the following information):

qmhu commented 1 year ago

emm.. indeed. @mfanjie any idea?

whitebear009 commented 8 months ago

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