mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-23 22:36:24 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user