Allow swarm init with --availability=drain

This fix adds a new flag `--availability` to `swarm join`.

Related documentation has been updated.

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 0f30c644441b3b4150252af1b41db99d4b6e697a
Component: engine
This commit is contained in:
Yong Tang
2017-01-10 16:31:51 -08:00
parent 9a5d4b9c8d
commit acaf4ba63f
5 changed files with 35 additions and 0 deletions
@@ -1619,3 +1619,14 @@ func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Drain")
}
func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *check.C) {
d := s.AddDaemon(c, false, false)
out, err := d.Cmd("swarm", "init", "--availability", "drain")
c.Assert(err, checker.IsNil, check.Commentf("out: %v", out))
out, err = d.Cmd("node", "ls")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Drain")
}