ECS service controls: Don't allow scale down below 1

as currently this would make it disappear (#2085).
See also https://github.com/weaveworks/scope/pull/2197#discussion_r100424800
This commit is contained in:
Mike Lang
2017-02-17 13:31:54 -08:00
parent 5a477171d3
commit a49f1c9559
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -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,
+6 -1
View File
@@ -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))