Merge pull request #2907 from ollypom/stack-deploy-swarm-jobs

Added Swarm Job support to Stack Deploy
This commit is contained in:
Sebastiaan van Stijn 2022-05-17 22:58:25 +02:00 committed by GitHub
commit b6aa28b6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -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: