Skip to content

Commit

Permalink
Fix scaling on autoscale enabled service
Browse files Browse the repository at this point in the history
  • Loading branch information
nightfury1204 committed Jul 3, 2024
1 parent 6c77500 commit c173ed1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion provider/aws/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (p *Provider) ReleasePromote(app, id string, opts structs.ReleasePromoteOpt
}

autoscale := false
if stackAutoscale == "Yes" && s.Scale.Count.Min < s.Scale.Count.Max {
if stackAutoscale == "Yes" {
autoscale = true
}

Expand Down
18 changes: 18 additions & 0 deletions provider/aws/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,23 @@ func (p *Provider) ServiceUpdate(app, name string, opts structs.ServiceUpdateOpt
return err
}

if opts.Count != nil {
sarn, err := p.serviceArn(app, name)
if err != nil {
return err
}

if sarn != "" {
_, err := p.ecs().UpdateService(&ecs.UpdateServiceInput{
Cluster: aws.String(p.Cluster),
Service: aws.String(sarn),
DesiredCount: aws.Int64(int64(*opts.Count)),
})
if err != nil {
return err
}
}
}

return nil
}

0 comments on commit c173ed1

Please sign in to comment.