Merge pull request #29152 from aaronlehmann/cluster-object-1.12.x
[1.12.x] cluster: Refuse swarm spec not named "default"
This commit is contained in:
commit
cce6065906
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@ package cluster
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
stdliberrors "errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
|
@ -1322,6 +1323,8 @@ func validateAndSanitizeInitRequest(req *types.InitRequest) error {
|
|||
// provide sane defaults instead of erroring
|
||||
if spec.Name == "" {
|
||||
spec.Name = "default"
|
||||
} else if spec.Name != "default" {
|
||||
return stdliberrors.New(`swarm spec must be named "default"`)
|
||||
}
|
||||
if spec.Raft.SnapshotInterval == 0 {
|
||||
spec.Raft.SnapshotInterval = defaultSpec.Raft.SnapshotInterval
|
||||
|
|
Loading…
Reference in a new issue