postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

HPA integration

Open AnisTigrini opened this issue 3 years ago • 4 comments

This is the Horizontal Pod Autoscaler feature Including the rebase.

AnisTigrini avatar Mar 28 '22 18:03 AnisTigrini

Hi there, I decided to delete the previous PR related to the HPA integration since it was based on an old version of Zalando and created this PR instead which is much cleaner.

So the goal of the Project was to have an Horizontal Pod Autoscaled which would be controlled directly by the Postgres Operator. With this PR, you should be able to create/update/delete a Horizontal Pod Autoscaler directly from the Custom Resource Definition file you submit to create PostgreSQL pods.

When it comes to the HPA, I split them in HPAV1 and HPAV2 since the APIs are a bit different. This may seem a bit ugly at first, but I am open to changing my code if you guys see more generic ways of doing things.

I tried as much as possible to stay generic and avoid hard coding things. But the HPA should be used to target the StatefulSet created by Zalando's CRD.

** There is still a little issue. that might be solved in K8s v1.23+ : When scaling StatefulSets down, pods will be eliminated but not the Persistent Volumes associated to these pods. So when we scale back up, new pods will be associated to these older Persistent Volumes. Feature is explained here : https://kubernetes.io/blog/2021/12/16/kubernetes-1-23-statefulset-pvc-auto-deletion/

AnisTigrini avatar Mar 28 '22 18:03 AnisTigrini

Hello guys hope you are well, just following up on this. @FxKu Let me know if you can give me feedback on this since I have time to adjust the PR if needed :).

AnisTigrini avatar Apr 03 '22 14:04 AnisTigrini

Hi guys, I just wanted to let you know that we're also interested by this feature and are looking forward to using it !

gesanderson avatar Apr 05 '22 13:04 gesanderson

Hey, I'm very interested by this feature as well. It could be very helpful to manage the number of pods used for our replicas

paretl avatar Apr 19 '24 12:04 paretl