Commit Graph

10 Commits

Author SHA1 Message Date
Brian Goff ebcb7d6b40 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-15 16:01:11 -04:00
Flavio Crisciani 8dc8cd4719
Inroduce SWARM --data-path-addr flag
This new flag will allow the configuration of an interface that
can be used for data path traffic to be isolated from control
plane traffic. This flag is simply percolated down to libnetwork
and will be used by all the global scope drivers (today overlay)

Negative test added for invalid flag arguments

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-04-26 15:33:15 -07:00
Vincent Demeester 3c5932086a
Remove daemon.VXSubnets duplicate code
Refactor daemon.V4Subnets and daemon.V6Subnets to limit duplication

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-28 10:51:40 +01:00
Josh Hawn eeac871946 Reject unspecified advertise addr on swarm init
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2016-11-28 15:44:06 -08:00
Alessandro Boch c8d0cb9e71 Add local address autodetection on swarm init
- when advertise-addr is not local and listen-addr is
  not specified

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-11-10 13:45:32 -08:00
Alessandro Boch c0b24c600e Add fallback to resolveSystemAddr() in linux
- So that swarm init will still work w/o specifying the advertise
  address when the daemon is running inside a container

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-09-09 13:27:57 -07:00
Alessandro Boch 8f7d3a4380 Only consider "device" interfaces in address autodetection on Linux
- This automatically rules out bridges and other non system
  created interfaces

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-08-02 10:54:43 -07:00
Yong Tang 59db01049a Better error messages when IP address autodetection fails
This fix tries to improve error messages when IP address
autodetection fails, as is specified in 25141.

Previously, error messages only indicate that multiple IPs
exist when autodetection fails. In this fix, if one
interface consists of multiple addresses or multiple
interfaces consist of addresses, the error messages output
the address names and interface names so that end user could
take notice.

This fix is verified manually.
When multiple addresses exist on multiple interfaces:
```
$ sudo docker swarm init
Error response from daemon: could not choose an IP address
to advertise since this system has multiple addresses on different
interfaces (192.168.186.128 on ens33 and 192.168.100.199 on eth10)
 - specify one with --advertise-addr
```
When multiple addresses exist on single interface:
```
$ sudo docker swarm init
Error response from daemon: could not choose an IP address
to advertise since this system has multiple addresses
on interface ens33 (192.168.186.128 and 192.168.55.199)
- specify one with --advertise-addr
```

This fix fixes 25141.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-07-31 20:03:30 -07:00
Aaron Lehmann fca0b18dcb Require listen address and advertise address to be an IP address or an interface name
Hostnames are not supported for now because libnetwork can't use them
for overlay networking yet.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-07-24 09:23:38 -07:00
Aaron Lehmann a0ccd0d42f Split advertised address from listen address
There are currently problems with "swarm init" and "swarm join" when an
explicit --listen-addr flag is not provided. swarmkit defaults to
finding the IP address associated with the default route, and in cloud
setups this is often the wrong choice.

Introduce a notion of "advertised address", with the client flag
--advertise-addr, and the daemon flag --swarm-default-advertise-addr to
provide a default. The default listening address is now 0.0.0.0, but a
valid advertised address must be detected or specified.

If no explicit advertised address is specified, error out if there is
more than one usable candidate IP address on the system. This requires a
user to explicitly choose instead of letting swarmkit make the wrong
choice. For the purposes of this autodetection, we ignore certain
interfaces that are unlikely to be relevant (currently docker*).

The user is also required to choose a listen address on swarm init if
they specify an explicit advertise address that is a hostname or an IP
address that's not local to the system. This is a requirement for
overlay networking.

Also support specifying interface names to --listen-addr,
--advertise-addr, and the daemon flag --swarm-default-advertise-addr.
This will fail if the interface has multiple IP addresses (unless it has
a single IPv4 address and a single IPv6 address - then we resolve the
tie in favor of IPv4).

This change also exposes the node's externally-reachable address in
docker info, as requested by #24017.

Make corresponding API and CLI docs changes.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-07-24 09:23:07 -07:00