Skip to content

Commit 9dba9e3

Browse files
author
Aaron Lehmann
committed
cluster: Refuse swarm spec not named "default"
If, using the API, a user submits an init request with a spec that has a name other than "default", the engine will rename the "default" cluster object. Some parts of swarmkit depend on having a cluster object named "default". Reject any specs that use other names. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
1 parent 60e72ea commit 9dba9e3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

daemon/cluster/cluster.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,12 @@ func validateAndSanitizeInitRequest(req *types.InitRequest) error {
18251825
return fmt.Errorf("invalid ListenAddr %q: %v", req.ListenAddr, err)
18261826
}
18271827

1828+
if req.Spec.Annotations.Name == "" {
1829+
req.Spec.Annotations.Name = "default"
1830+
} else if req.Spec.Annotations.Name != "default" {
1831+
return errors.New(`swarm spec must be named "default"`)
1832+
}
1833+
18281834
return nil
18291835
}
18301836

0 commit comments

Comments
 (0)