Skip to content

Commit

Permalink
Data Path Port configuration support
Browse files Browse the repository at this point in the history
This PR chnages allow user to configure data path
port number. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
Data path port can't be modified after swarm init.

Signed-off-by: selansen <elango.siva@docker.com>
  • Loading branch information
selansen committed Nov 24, 2018
1 parent 3a6f8b6 commit 821cde7
Show file tree
Hide file tree
Showing 18 changed files with 725 additions and 440 deletions.
4 changes: 4 additions & 0 deletions cli/command/swarm/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type initOptions struct {
availability string
defaultAddrPools []net.IPNet
DefaultAddrPoolMaskLength uint32
dataPathPort uint32
}

func newInitCommand(dockerCli command.Cli) *cobra.Command {
Expand Down Expand Up @@ -52,6 +53,8 @@ func newInitCommand(dockerCli command.Cli) *cobra.Command {
flags.SetAnnotation(flagDefaultAddrPool, "version", []string{"1.39"})
flags.Uint32Var(&opts.DefaultAddrPoolMaskLength, flagDefaultAddrPoolMaskLength, 24, "default address pool subnet mask length")
flags.SetAnnotation(flagDefaultAddrPoolMaskLength, "version", []string{"1.39"})
flags.Uint32Var(&opts.dataPathPort, flagDataPathPort, 4789, "Data Path port number")
flags.SetAnnotation(flagDataPathPort, "version", []string{"1.40"})
addSwarmFlags(flags, &opts.swarmOptions)
return cmd
}
Expand All @@ -74,6 +77,7 @@ func runInit(dockerCli command.Cli, flags *pflag.FlagSet, opts initOptions) erro
Spec: opts.swarmOptions.ToSpec(flags),
AutoLockManagers: opts.swarmOptions.autolock,
SubnetSize: opts.DefaultAddrPoolMaskLength,
DataPathPort: opts.dataPathPort,
}
if flags.Changed(flagAvailability) {
availability := swarm.NodeAvailability(strings.ToLower(opts.availability))
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 @@ -35,6 +35,7 @@ const (
flagAvailability = "availability"
flagCACert = "ca-cert"
flagCAKey = "ca-key"
flagDataPathPort = "data-path-port"
)

type swarmOptions struct {
Expand Down
1 change: 1 addition & 0 deletions cli/command/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func printSwarmInfo(dockerCli command.Cli, info types.Info) {
fmt.Fprintln(dockerCli.Out(), " Default Address Pool:", strAddrPool.String())
fmt.Fprintln(dockerCli.Out(), " SubnetSize:", info.Swarm.Cluster.SubnetSize)
}
fmt.Fprintln(dockerCli.Out(), " Data Path Port:", info.Swarm.Cluster.DataPathPort)
fmt.Fprintln(dockerCli.Out(), " Orchestration:")

taskHistoryRetentionLimit := int64(0)
Expand Down
1 change: 1 addition & 0 deletions cli/command/system/testdata/docker-info-with-swarm.golden
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Swarm: active
ClusterID: 9vs5ygs0gguyyec4iqf2314c0
Managers: 1
Nodes: 1
Data Path Port: 0
Orchestration:
Task History Retention Limit: 5
Raft:
Expand Down
4 changes: 2 additions & 2 deletions contrib/completion/bash/docker
Original file line number Diff line number Diff line change
Expand Up @@ -3698,7 +3698,7 @@ _docker_swarm_init() {
COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )
return
;;
--cert-expiry|--default-addr-pool|--default-addr-pool-mask-length|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit )
--cert-expiry|--data-path-port|--default-addr-pool|--default-addr-pool-mask-length|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit )
return
;;
--data-path-addr)
Expand All @@ -3718,7 +3718,7 @@ _docker_swarm_init() {

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --data-path-addr --default-addr-pool --default-addr-pool-mask-length --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 --data-path -port --default-addr-pool --default-addr-pool-mask-length --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit " -- "$cur" ) )
;;
esac
}
Expand Down
3 changes: 2 additions & 1 deletion contrib/completion/zsh/_docker
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,8 @@ __docker_swarm_subcommand() {
"($help)--listen-addr=[Listen address]:ip\:port: " \
"($help)--max-snapshots[Number of additional Raft snapshots to retain]" \
"($help)--snapshot-interval[Number of log entries between Raft snapshots]" \
"($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0
"($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 \
"($help)--data-path-port=[Data Path Port] "
;;
(join)
_arguments $(__docker_arguments) -A '-*' \
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 @@ -36,6 +36,7 @@ Options:
--max-snapshots uint Number of additional Raft snapshots to retain
--snapshot-interval uint Number of log entries between Raft snapshots (default 10000)
--task-history-limit int Task history retention limit (default 5)
--data-path-port uint Data path port number
```

## Description
Expand Down Expand Up @@ -142,6 +143,11 @@ Format example is `--default-addr-pool-mask-length 24`

This flag sets up task history retention limit.

### `--data-path-port`

This flag specifies data path port number.
Format example is `--data-path-port 4789`

### `--max-snapshots`

This flag sets the number of old Raft snapshots to retain in addition to the
Expand Down
4 changes: 2 additions & 2 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ github.com/cpuguy83/go-md2man v1.0.8
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 # v1.1.0
github.com/dgrijalva/jwt-go a2c85815a77d0f951e33ba4db5ae93629a1530af
github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5
github.com/docker/docker bd224b5fe564f343e22fa76ae8569ec949f35802
github.com/docker/docker 0b7cb16dde4a20d024c7be59801d63bcfd18611b
github.com/docker/docker-credential-helpers 5241b46610f2491efdf9d1c85f1ddf5b02f6d962
# the docker/go package contains a customized version of canonical/json
# and is used by Notary. The package is periodically rebased on current Go versions.
Expand All @@ -23,7 +23,7 @@ github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18
github.com/docker/go-units 47565b4f722fb6ceae66b95f853feed578a4a51c # v0.3.3
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
github.com/docker/licensing f2eae57157a06681b024f1690923d03e414179a0
github.com/docker/swarmkit 9f271c2963d18a7c60d2c4001fb418ca4037df19
github.com/docker/swarmkit 8af8c420f491f006ab1730e08d446a795b1667d7
github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff
github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 # v1.0.0
github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/docker/docker/api/types/swarm/swarm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions vendor/github.com/docker/docker/vendor.conf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 821cde7

Please sign in to comment.