sablierapp / sablier

Start your containers on demand, shut them down automatically when there's no activity. Docker, Docker Swarm Mode and Kubernetes compatible.
https://sablierapp.dev/
GNU Affero General Public License v3.0
1.48k stars 50 forks source link

Always scales back up to 1 replica on Kubernetes #258

Open dimber-cais opened 9 months ago

dimber-cais commented 9 months ago

Describe the issue When Sablier scales up a previously scaled down deployment, it always scales it to 1 pod, and does not return the deployment back to the value of replicas specified in the original YAML.

Context

Expected behavior It should be possible to scale back up to multiple replicas when scaling back up from zero. This could either be by capturing the original spec.replicas for the deployment and using that, or introducing a new sablier.replicas label.

Additional context This would allow Sablier to be used in scenarios where workloads should both scale to zero when not in use and scale to a highly available multi-instance deployment when in use.

I could try to contribute this as a PR if you are open for this......

dimber-cais commented 9 months ago

I think this is the applicable code.

acouvreur commented 5 months ago

Hello @dimber-cais,

Do you know how I can retrieve the original replicas ?

What happens if the original replicas is 0 ?

I can add this fairly easily with groups, however the API using names query param would not support it properly, or it would scale all mentioned workloads to this specific replicas.