kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.57k stars 1.08k forks source link

fix: optimize all checkRepliacas code and fix the problem does not take effect #6344

Open ctccxxd opened 1 week ago

ctccxxd commented 1 week ago

fix and optimize all checkReplicas code, originally 1, Webhook for replicas check does not take effect. 2, No check for negative value. 3, Variable max or min is same with build-in function name, not graceful 4, Have no defaultMaxReplicas for hpa. 5, Code has redundency.

Checklist

related issue https://github.com/kedacore/keda/issues/6356

ctccxxd commented 5 days ago

Friendly ping @zroubalik @wozniakjan @SpiritZhou @psi @wonko @fivesheep @JorTurFer hope you to review and discuss, much thanks.

ctccxxd commented 2 days ago

I think that I'm missing something. Can't we just include the negative check message in the current GetHPAMin/MaxReplicas funcs and it'd do almost the same, wouldn't?

Much thanks for your comments. Originally. it has much logic in GetHPAMin/MaxReplicas funcs including default replicas logic. I hink it is not very explicit for user to read. I want to make the logic more clean. Besides, I have more purposes,

1, Webhook for replicas check does not take effect. 2, No check for negative value. 3, Variable max or min is same with build-in function name, not graceful 4, Have no defaultMaxReplicas for hpa. 5, Code has redundency. Hope for your reply.