diff --git a/probe/awsecs/client.go b/probe/awsecs/client.go index e57a7358d..d1ad70890 100644 --- a/probe/awsecs/client.go +++ b/probe/awsecs/client.go @@ -396,8 +396,8 @@ func (c ecsClientImpl) ScaleService(serviceName string, amount int) error { } newCount := service.DesiredCount + int64(amount) - if newCount < 0 { - return fmt.Errorf("Cannot reduce count below zero") + if newCount < 1 { + return fmt.Errorf("Cannot reduce count below one") } _, err := c.client.UpdateService(&ecs.UpdateServiceInput{ Cluster: &c.cluster, diff --git a/probe/awsecs/reporter.go b/probe/awsecs/reporter.go index bddcac81c..5e4849ce0 100644 --- a/probe/awsecs/reporter.go +++ b/probe/awsecs/reporter.go @@ -153,7 +153,12 @@ func (r Reporter) Tag(rpt report.Report) (report.Report, error) { ServiceDesiredCount: fmt.Sprintf("%d", service.DesiredCount), ServiceRunningCount: fmt.Sprintf("%d", service.RunningCount), report.ControlProbeID: r.probeID, - }).WithLatestActiveControls(ScaleUp, ScaleDown)) + }).WithLatestControls(map[string]report.NodeControlData{ + ScaleUp: {Dead: false}, + // We've decided for now to disable ScaleDown when only 1 task is desired, + // since scaling down to 0 would cause the service to disappear (#2085) + ScaleDown: {Dead: service.DesiredCount <= 1}, + })) } log.Debugf("Created %v ECS service nodes", len(ecsInfo.Services))