jrasell / sherpa

Sherpa is a highly available, fast, and flexible horizontal job scaling for HashiCorp Nomad. It is capable of running in a number of different modes to suit different requirements, and can scale based on Nomad resource metrics or external sources.
Mozilla Public License 2.0
163 stars 8 forks source link

Scaling doesn't work when inicial number of task beyond the minimum and maximum values #130

Open alekskar opened 4 years ago

alekskar commented 4 years ago

Describe the bug When applying policy with interval [MinCount, MaxCount ] to existent job with count value lower than MinCount scaling out is not occurs.

To reproduce Steps to reproduce the behavior ideally with policy and job examples. Nomad job example

job "test1" {
    region = "us-west-2"
        datacenters = ["us-west-2"]
    type = "service"
    group "api" {
        count = 1 < -- -- -- -- -- -- -- -- -- -- --not in interval[2, 4]
        task "test" {
            driver = "docker"
            config {
                image = "nginx:latest"
                }
            resources {
                cpu = 300# MHz
                memory = 256# MB
                }
            }
        }
    }
policy {
Enabled: true,
Cooldown: 180,
MinCount: 2,
MaxCount: 4,
ScaleOutCount: 1,
ScaleInCount: 1
}

Expected behavior Desired number of tasks becomes scalled out to 2.

Environment:

iahim commented 4 years ago

This seems to be correct. If you want 2 counts by default (the minimum) why don't you start nomad job with count 2? OR why don't you start sherpa with min 1 and max 4 ? I think the way it is working at the moment is correct.

jrasell commented 4 years ago

@alekskar and @iahim thanks for the information and what you notice is correct. I have it in my backlog to fix this and relates to this tweet I sent to try and gain opinions: https://twitter.com/jrasell/status/1205786409736515584

alekskar commented 4 years ago

This seems to be correct. If you want 2 counts by default (the minimum) why don't you start nomad job with count 2? OR why don't you start sherpa with min 1 and max 4 ? I think the way it is working at the moment is correct.

@iahim This is just about desired state. As a user I would like to be ensure that after applying scale policy autoscaller automatically adjust number of tasks to desired count within upper and lower bounds.