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 13, 2018
1 parent 3a6f8b6 commit f495be4
Show file tree
Hide file tree
Showing 17 changed files with 715 additions and 435 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.39"})
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
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 cde1092288dfaf9d48e019c7740fe8a0271a3b03 https://github.com/selansen/moby.git
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 14cfce8d7662b82fbc0e4d88ba9a8d28bfc43c07
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.

10 changes: 5 additions & 5 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 f495be4

Please sign in to comment.