Coder Social home page Coder Social logo

Comments (5)

jthomperoo avatar jthomperoo commented on June 15, 2024

Ah OK, thanks for the feedback, helpful to hear a use case. So the way the current code works is if the current replica count is 0 scaling is disabled on the resource, so a resource can be scaled down to 0 replicas, but it cannot be scaled again after it has been set to 0. In your use case you need to be able to scale down to 0 and then afterwards scale upwards from 0 - is that right?

It seems reasonable to me, I think the way to do this would be to have a boolean configuration option allowScaleFromZero, if this is true you can scale upwards from 0, if it is false you can't scale upwards from 0 - would that be suitable for you? If so I'll add in that flag and get it in a new release (v0.12.0), thanks for finding that!

from custom-pod-autoscaler.

jjhuff avatar jjhuff commented on June 15, 2024

Yup, that's exactly right. I'm curious about the use case of 0 being disabled? Seems like a label on the deployment might be cleaner to mark it as 'autoscale disabled' might be cleaner?

from custom-pod-autoscaler.

jthomperoo avatar jthomperoo commented on June 15, 2024

Hmm that's a good point, I'm not sure if there actually is a use case for disabling autoscaling, I was basing it off the Horizontal Pod Autoscaler's behaviour:

https://github.com/kubernetes/kubernetes/blob/57108f6c3ea285284ef693be6d86d4bbd1d8a143/pkg/controller/podautoscaler/horizontal.go#L602-L607

But I think I implemented this incorrectly, autoscaling here is only disabled if minReplicas is > 0 so behaviour should be the same as you have laid out, if minReplicas is set to 0 scaling down to and up from 0 should be allowed - I think this is better.

from custom-pod-autoscaler.

jjhuff avatar jjhuff commented on June 15, 2024

I think the HPA behavior might have changed when they added the ability to scale to zero.
Thanks!

from custom-pod-autoscaler.

jthomperoo avatar jthomperoo commented on June 15, 2024

This is now available in version v0.12.0, there's an example here and some documentation here.

Hope that helps with your use case!

from custom-pod-autoscaler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.