1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

2687 commits

Author SHA1 Message Date
Flavio Crisciani
204ce3e31d Create internal directory
Internal directory is designed to contain libraries
that are exclusively used by this project

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-16 17:34:20 -07:00
Flavio Crisciani
8698ad1af1 Merge pull request from fcrisciani/spelling
Spelling
2018-07-12 13:11:28 -07:00
Flavio Crisciani
8b6cb7d59a Merge pull request from trapier/support-inspect-stopped-containers
support.sh: also inspect stopped containers
2018-07-12 13:05:13 -07:00
Flavio Crisciani
6defa7c807 Make protobuf check silent
Avoid printing the if condition

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-12 12:54:59 -07:00
Josh Soref
a06f1b2c4e Spelling fixes
* addresses
* assigned
* at least
* attachments
* auxiliary
* available
* cleanup
* communicate
* communications
* configuration
* connection
* connectivity
* destination
* encountered
* endpoint
* example
* existing
* expansion
* expected
* external
* forwarded
* gateway
* implementations
* implemented
* initialize
* internally
* loses
* message
* network
* occurred
* operational
* origin
* overlapping
* reaper
* redirector
* release
* representation
* resolver
* retrieve
* returns
* sanbdox
* sequence
* succesful
* synchronizing
* update
* validates

Signed-off-by: Josh Soref <jsoref@gmail.com>
2018-07-12 12:54:44 -07:00
Trapier Marshall
b9223019c2 support.sh: also inspect stopped containers
Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
2018-07-12 15:22:42 -04:00
Flavio Crisciani
9db90d27ed Merge pull request from euanh/protobuf-check
Check that generated protocol buffer code is up to date
2018-07-11 15:12:54 -07:00
Flavio Crisciani
0f593ae92b Merge pull request from ctelfer/fix-overlay-vxlan-races
Fix overlay vxlan races
2018-07-11 10:41:46 -07:00
Chris Telfer
4e6580c4c1 Refactor locking for join/leave to avoid race
Instead of using "sync.Once" to determine whether to initialize a
network sandbox or subnet sandbox, we use a traditional mutex +
initialization boolean.  This is because the initialization state isn't
truly a once-and-done condition.  Rather, libnetwork destroys network
and subnet sandboxes when the last endpoint leaves them.  The use of
sync.Once in this kind of scenario requires, therefore, re-initializing
the Once which is impoissible.  So the approach that libnetwork
currently takes is to use a pointer to a Once and redirect that pointer
to a new Once on reset.  This leads to nasty race conditions.

In addition to refactoring the locking, this patch merges the functions
joinSandbox(), and joinSubnetSandbox(). This makes the code both cleaner
and it also holds the network and subnet locks through the series of
read-modify-writes avoiding further potential races.  This does reduce
the potential parallelism which could be applied should there be many
joins coming in on many different subnets in the same overlay network.
However, this should be an extremely minor performance hit for a very
obscure case.

One important pattern in this commit is that it is crucial to avoid
sending peerDB messages while holding a driver or network lock.  The
changes herein defer such (asynchronous) notifications until after
release of such locks.  This prevents deadlocks where the peerDB
blocks acquiring said locks while the network method blocks trying
to send to the peerDB's channel.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-10 12:13:39 -04:00
Euan Harris
56c4a6dd3f Makefile: Add check for out of date protocol buffer code
'make check' will now fail if the files produced by re-running protoc
differ from those which are checked into the repository.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
2b602bf3d0 Makefile: Add protobuf-local target, runnable within build container
Outside the build container, run: make protobuf
Inside the build container, run: make protobuf-local

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
3bebfbc34e Makefile: Document and organize into sections
Add documentation and move protobuf target into Build section

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
348ed0a1a8 circleci: Rename 'lint' to 'check' to match build target
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Flavio Crisciani
e353363bab Merge pull request from euanh/use-init
Makefile: Run containers with --init for proper signal handling
2018-07-10 08:09:09 -07:00
Santhosh Manohar
5fdfa8c52c Cleanup interfaces properly when vxlan plumbling fails
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-10 10:33:46 -04:00
Euan Harris
c699a1215e Makefile: Run containers with --init for proper signal handling
This makes it possible to Ctrl-C tests and builds again.   Zombie
processes will also be reaped correctly.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 10:20:44 +01:00
Flavio Crisciani
38ec34e0e7 Merge pull request from quadespresso/esc-509
Changed loglevel from error to warning
2018-07-06 16:28:11 -07:00
Flavio Crisciani
968b269ec8 Merge pull request from vdemeester/to-gotest.tools
Migrate to gotest.tools :)
2018-07-06 16:15:13 -07:00
Jim Carroll
9da8e04c70 Updated handling of disable_ipv6 file
Signed-off-by: Jim Carroll <jim.carroll@docker.com>
2018-07-06 16:42:29 -05:00
Flavio Crisciani
e0c5c1b5d3 Merge pull request from fcrisciani/e2e-test
Create tag for master code
2018-07-06 13:36:29 -07:00
Vincent Demeester
06d471d186 Migrate to gotest.tools :)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-06 11:01:37 -07:00
Vincent Demeester
6c0f597a82 Remove unused deps from vendor.conf
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-06 10:40:22 -07:00
Flavio Crisciani
ffe33f932e Create tag for master code
In order to support different branches
create master tag

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-06 10:15:00 -07:00
Flavio Crisciani
b0a0059237 Merge pull request from fcrisciani/netdb-qlen-issue
NetworkDB qlen optimization
2018-07-05 15:02:58 -07:00
Flavio Crisciani
85862008e9 Merge pull request from ctelfer/use-fmt-string-precision
Use fmt precision to limit string length
2018-07-05 14:52:49 -07:00
Chris Telfer
06922d2d81 Use fmt precision to limit string length
The previous code used string slices to limit the length of certain
fields like endpoint or sandbox IDs.  This assumes that these strings
are at least as long as the slice length.  Unfortunately, some sandbox
IDs can be smaller than 7 characters.   This fix addresses this issue
by systematically converting format string calls that were taking
fixed-slice arguments to use a precision specifier in the string format
itself.  From the golang fmt package documentation:

    For strings, byte slices and byte arrays, however, precision limits
    the length of the input to be formatted (not the size of the output),
    truncating if necessary. Normally it is measured in runes, but for
    these types when formatted with the %x or %X format it is measured
    in bytes.

This nicely fits the desired behavior: it will limit the number of
runes considered for string interpolation to the precision value.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-05 17:44:04 -04:00
Flavio Crisciani
00611a5255 Merge pull request from hzue/master
Fix error handling about bridgeSetup
2018-07-05 14:34:41 -07:00
Abhinandan Prativadi
8e9bb2a618 Merge pull request from euanh/ipam-check
Test overlapping pool allocation
2018-07-05 09:37:26 -07:00
hzue
5ef4c59574 Fix error handling about bridgeSetup
Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function.

Signed-off-by: Terry Chu <jubosh.tw@gmail.com>
2018-07-05 16:46:56 +08:00
Euan Harris
1383aadf59 ipam: Test rejection of overlapping pool requests
TestOverlappingRequests checks that pool requests which are supersets or
subsets of existing allocations, and those which overlap with existing
allocations at the beginning or the end.

Multiple allocation is now tested by TestOverlappingRequests, so
TestDoublePoolRelease only needs to test double releasing.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-04 09:50:53 +01:00
Euan Harris
6fd25eea33 ipam, types: Expand documentation
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-04 09:50:31 +01:00
Flavio Crisciani
a3d24cf4b4 Merge pull request from fcrisciani/base-image
CircleCI use latest image
2018-07-03 17:45:12 -07:00
Flavio Crisciani
4cbba0da48 CircleCI use latest image
Avoid confusion with the golang versioning

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-03 14:40:57 -07:00
Flavio Crisciani
3788e7949d Merge pull request from fcrisciani/ipvs-sysctl
Add knobs on LB sandbox
2018-07-03 14:15:46 -07:00
Flavio Crisciani
f857b5b8f8 Merge pull request from idealhack/tests-benchmark
test: update tests to use sub-benchmarks
2018-07-03 14:06:58 -07:00
Flavio Crisciani
5f670981d9 Merge pull request from thaJeztah/update_testify
Update stretchr/testify to v1.2.2
2018-07-03 13:25:10 -07:00
Flavio Crisciani
55e4cc7262 Optimize networkDB queue
Added some optimizations to reduce the messages in the queue:
1) on join network the node execute a tcp sync with all the nodes that
it is aware part of the specific network. During this time before the
node was redistributing all the entries. This meant that if the network
had 10K entries the queue of the joining node will jump to 10K. The fix
adds a flag on the network that would avoid to insert any entry in the
queue till the sync happens. Note that right now the flag is set in
a best effort way, there is no real check if at least one of the nodes
succeed.
2) limit the number of messages to redistribute coming from a TCP sync.
Introduced a threshold that limit the number of messages that are
propagated, this will disable this optimization in case of heavy load.

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-02 16:59:45 -07:00
Flavio Crisciani
b09cb39fa5 Enhance testing infra
Allow to write and delete X number of entries
Allow to query the queue length

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-02 16:47:34 -07:00
Flavio Crisciani
abc4c5c5d8 Merge pull request from thaJeztah/fix_duplicate_ndots
Fix duplicate ndots:0, and improve validation
2018-06-29 10:28:22 -07:00
Sebastiaan van Stijn
9295e124bb Update stretchr/testify to v1.2.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:48:39 +02:00
Sebastiaan van Stijn
341845b5f2 ndots: produce error on negative numbers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:22:17 +02:00
Sebastiaan van Stijn
b306706062 improve error message for invalid ndots number
instead of printing the whole option, print the _number_ only,
because that's what the error-message is pointing at;

Before this change:

    invalid number for ndots option ndots:foobar

After this change:

    invalid number for ndots option: foobar

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:19:34 +02:00
Flavio Crisciani
7fc1795cdf Allows to set generic knobs on the Sandbox
Refactor the ostweaks file to allows a more easy reuse
Add a method on the osl.Sandbox interface to allow setting
knobs on the sandbox

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-28 16:14:08 -07:00
Flavio Crisciani
ef457321a9 Merge pull request from fcrisciani/networkdb-retry
Adjust corner case for reconnect logic
2018-06-28 16:00:00 -07:00
Sebastiaan van Stijn
6e260332e8 do not ignore user-provided "ndots:0" option
`ndots:0` is a valid DNS option; previously, `ndots:0` was
ignored, leading to the default (`ndots:0`) also being applied;

Before this change:

    docker network create foo
    docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf
    nameserver 127.0.0.11
    options ndots:0 ndots:0

After this change:

    docker network create foo
    docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf
    nameserver 127.0.0.11
    options ndots:0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 00:58:36 +02:00
Sebastiaan van Stijn
6e6ac3d2ac Remove redundant and faulty assert messages
The "message" argument in assert.Equal expects a format
string; the current string was not that, resulting in an
incorrect message being printed;

    --- FAIL: TestDNSOptions (1.28s)
            Location:       service_common_test.go:92
    	Error:  	Not equal: "ndots:5" (expected)
    			        != "ndots:0" (actual)
    	Messages:	The option must be ndots:5 instead:%!(EXTRA string=ndots:0)

This patch removes the message altogether, because assert.Equal
already prints enough information to catch the error;

    --- FAIL: TestDNSOptions (1.28s)
            Location:       service_common_test.go:92
    	Error:  	Not equal: "ndots:5" (expected)
    			        != "ndots:0" (actual)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 00:52:16 +02:00
Flavio Crisciani
a5e7cfe3d7 Merge pull request from ctelfer/scalable-lb
Improve load balancing scalability in swarm mode
2018-06-28 15:49:55 -07:00
Chris Telfer
ac0aa6485b Adjust warnings for transient LB endpoint conds
Add debug and error logs to notify when a load balancing sandbox
is not found.  This can occur in normal operation during removal.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
0b14b45f0c Prevent race between add-binding and net-delete
Lock the network ID in the controller during an addServiceBinding to
prevent racing with network.delete().  This would cause the binding to
be silently ignored in the system.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
ea2fa20859 Add endpoint load-balancing mode
This is the heart of the scalability change for services in libnetwork.
The present routing mesh adds load-balancing rules for a network to
every container connected to the network.  This newer approach creates a
load-balancing endpoint per network per node.  For every service on a
network, libnetwork assigns the VIP of the service to the endpoint's
interface as an alias.  This endpoint must have a unique IP address in
order to route return traffic to it.  Traffic destined for a service's
VIP arrives at the load-balancing endpoint on the VIP and from there,
Linux load balances it among backend destinations while SNATing said
traffic to the endpoint's unique IP address.

The net result of this scheme is that each node in a swarm need only
have one set of load balancing state per service instead of one per
container on the node.  This scheme is very similar to how services
currently operate on Windows nodes in libnetwork.  It (as with Windows
nodes) costs the use of extra IP addresses in a network (one per node)
and an extra network hop in the stack, although, always in the stack
local to the container.

In order to prevent existing deployments from suddenly failing if they
failed to allocate sufficient address space to include per-node
load-balancing endpoint IP addresses, this patch preserves the existing
functionality and activates the new functionality on a per-network
basis depending on whether the network has a load-balancing endpoint.
Eventually, moby should always set this option when creating new
networks and should only omit it for networks created as part of a swarm
that are not marked to use endpoint load balancing.

This patch also normalizes the code to treat "load" and "balancer"
as two separate words from the perspectives of variable/function naming.
This means that the 'b' in "balancer" must be capitalized.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00