Skip to content

Commit

Permalink
Merge pull request #2907 from ollypom/stack-deploy-swarm-jobs
Browse files Browse the repository at this point in the history
Added Swarm Job support to Stack Deploy
  • Loading branch information
thaJeztah authored May 17, 2022
2 parents 7f073ab + 3997f34 commit b6aa28b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/compose/convert/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,21 @@ func convertDeployMode(mode string, replicas *uint64) (swarm.ServiceMode, error)
serviceMode := swarm.ServiceMode{}

switch mode {
case "global-job":
if replicas != nil {
return serviceMode, errors.Errorf("replicas can only be used with replicated or replicated-job mode")
}
serviceMode.GlobalJob = &swarm.GlobalJob{}
case "global":
if replicas != nil {
return serviceMode, errors.Errorf("replicas can only be used with replicated mode")
return serviceMode, errors.Errorf("replicas can only be used with replicated or replicated-job mode")
}
serviceMode.Global = &swarm.GlobalService{}
case "replicated-job":
serviceMode.ReplicatedJob = &swarm.ReplicatedJob{
MaxConcurrent: replicas,
TotalCompletions: replicas,
}
case "replicated", "":
serviceMode.Replicated = &swarm.ReplicatedService{Replicas: replicas}
default:
Expand Down

0 comments on commit b6aa28b

Please sign in to comment.