Skip to content

Commit

Permalink
Global Default Address Pool feature support
Browse files Browse the repository at this point in the history
This feature brings new attribute/option for swarm init command.
default-addr-pool will take string input which can be in below format.
"CIDR,CIDR,CIDR...:SUBNET-SIZE".
Signed-off-by: selansen <elango.siva@docker.com>
  • Loading branch information
selansen committed Jul 30, 2018
1 parent edfd623 commit 95bd1e3
Show file tree
Hide file tree
Showing 10 changed files with 386 additions and 52 deletions.
3 changes: 3 additions & 0 deletions cli/command/swarm/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type initOptions struct {
dataPathAddr string
forceNewCluster bool
availability string
defaultAddrPool string
}

func newInitCommand(dockerCli command.Cli) *cobra.Command {
Expand All @@ -44,6 +45,7 @@ func newInitCommand(dockerCli command.Cli) *cobra.Command {
flags.BoolVar(&opts.forceNewCluster, "force-new-cluster", false, "Force create a new cluster from current state")
flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable manager autolocking (requiring an unlock key to start a stopped manager)")
flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active"|"pause"|"drain")`)
flags.StringVar(&opts.defaultAddrPool, flagDefaultAddrPool, "", "List of default subnet addresses followed by subnet size (format: <subnet,subnet,..:subnet-size)")
addSwarmFlags(flags, &opts.swarmOptions)
return cmd
}
Expand All @@ -56,6 +58,7 @@ func runInit(dockerCli command.Cli, flags *pflag.FlagSet, opts initOptions) erro
ListenAddr: opts.listenAddr.String(),
AdvertiseAddr: opts.advertiseAddr,
DataPathAddr: opts.dataPathAddr,
DefaultAddrPool: opts.defaultAddrPool,
ForceNewCluster: opts.forceNewCluster,
Spec: opts.swarmOptions.ToSpec(flags),
AutoLockManagers: opts.swarmOptions.autolock,
Expand Down
1 change: 1 addition & 0 deletions cli/command/swarm/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
flagListenAddr = "listen-addr"
flagAdvertiseAddr = "advertise-addr"
flagDataPathAddr = "data-path-addr"
flagDefaultAddrPool = "default-addr-pool"
flagQuiet = "quiet"
flagRotate = "rotate"
flagToken = "token"
Expand Down
4 changes: 2 additions & 2 deletions contrib/completion/bash/docker
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,7 @@ _docker_swarm_init() {
COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )
return
;;
--cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit)
--cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit | --default-addr-pool )
return
;;
--data-path-addr)
Expand All @@ -3681,7 +3681,7 @@ _docker_swarm_init() {

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --data-path-addr --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --data-path-addr --default-addr-pool --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) )
;;
esac
}
Expand Down
1 change: 1 addition & 0 deletions contrib/completion/zsh/_docker
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,7 @@ __docker_swarm_subcommand() {
$opts_help \
"($help)--advertise-addr=[Advertised address]:ip\:port: " \
"($help)--data-path-addr=[Data path IP or interface]:ip " \
"($help)--default-addr-pool=[default subnet addresses]:subnet-size " \
"($help)--autolock[Enable manager autolocking]" \
"($help)--availability=[Availability of the node]:availability:(active drain pause)" \
"($help)--cert-expiry=[Validity period for node certificates]:duration: " \
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/commandline/swarm_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Options:
--availability string Availability of the node ("active"|"pause"|"drain") (default "active")
--cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)
--data-path-addr string Address or interface to use for data path traffic (format: <ip|interface>)
--default-addr-pool string List of default subnet addresses followed by subnet size (format: <subnet,subnet,..:subnet-size)
--dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)
--external-ca external-ca Specifications of one or more certificate signing endpoints
--force-new-cluster Force create a new cluster from current state
Expand Down Expand Up @@ -128,6 +129,11 @@ management traffic of the cluster.
If unspecified, Docker will use the same IP address or interface that is used for the
advertise address.

### `--default-addr-pool`
This flag specifies default subnet pools for global scope networks. If subnet size is not
specified then default value 24 will be used.
If unspecified, Docker will use the predefined subnets as it works on older releases.

### `--task-history-limit`

This flag sets up task history retention limit.
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ github.com/docker/go-connections 7beb39f0b969b075d1325fecb092faf27fd357b6
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18
github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
github.com/docker/swarmkit edd5641391926a50bc5f7040e20b7efc05003c26
github.com/docker/swarmkit c543cc7f6aa805f249e4d0b1b28069c6415e0b41 https://github.com/selansen/swarmkit.git
github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46
github.com/emicklei/go-restful-swagger12 dcef7f55730566d41eae5db10e7d6981829720f6
github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff
Expand Down
Loading

0 comments on commit 95bd1e3

Please sign in to comment.