Commit graph

100 commits

Author SHA1 Message Date
Eng Zer Jun
c55a4ac779
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Sebastiaan van Stijn
427ad30c05
libnetwork: remove unused "testutils" imports
Perhaps the testutils package in the past had an `init()` function to set up
specific things, but it no longer has. so these imports were doing nothing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-18 14:20:37 +02:00
Brian Goff
4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00
Brian Goff
72c4a7b496 Fix issues running libnetwork tests.
libnetwork does different stuff depending on if you are running the
tests in a container or not... without telling it we are in a container
a bunch of the tests actually fail.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 22:14:41 +00:00
Brian Goff
a0a473125b Fix libnetwork imports
After moving libnetwork to this repo, we need to update all the import
paths for libnetwork to point to docker/docker/libnetwork instead of
docker/libnetwork.
This change implements that.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 21:51:23 +00:00
Sebastiaan van Stijn
3e1e9e878c vendor: gotest.tools v3.0.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-12 03:22:18 +02:00
Yongxin Li
619e3d6706 typo fix about mismatch
Signed-off-by: Yongxin Li <yxli@alauda.io>
2018-09-27 20:43:13 +08:00
rongzhang
36375881f3 Fix some typos
Signed-off-by: rongzhang <rongzhang@alauda.io>
2018-09-08 09:33:24 +08:00
selansen
814f6c1f4b Add getter function for Default Address Pools
ipamutils has two default address pool. Instead of allowing them to
be accessed directly, adding get functions so that other packages
can use get APIs.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-16 15:48:42 -04:00
selansen
52e85b4b9a Global Default Address Pool support
This change brings global default address pool feature into
libnetwork. Idea is to reuse same code flow and functions that were
implemented for local scope default address pool.
Function InitNetworks carries most of the changes. local scope default
address pool init should always happen only once. But Global scope
default address pool can be initialized multiple times.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-16 11:28:24 -04: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
Vincent Demeester
06d471d186 Migrate to gotest.tools :)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-06 11:01:37 -07: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
f857b5b8f8 Merge pull request #2166 from idealhack/tests-benchmark
test: update tests to use sub-benchmarks
2018-07-03 14:06:58 -07:00
Abhinandan Prativadi
f5fa40f9aa Fixing the unit test for overlapping subnet
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-06-18 12:31:48 -07:00
Flavio Crisciani
828a6d788e Merge pull request #2177 from ctelfer/subnet-cursor
Avoid reusing subnets when allocating from pools
2018-06-18 11:23:11 -07:00
Flavio Crisciani
891fb82213 Merge pull request #2148 from abhi/ipam-check
Adding a check for subnet pool overlap
2018-06-18 11:19:41 -07:00
Chris Telfer
e31e906e4e Add pool reuse test to unit tests
Add a test to confirm that the pool allocator will iterate through all
the pools even if some earlier ones were freed before coming back to
previously allocated pools.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-08 19:26:10 -04:00
Chris Telfer
cc8b2cac28 Allocate subnets in order rather than restarting
This commit prevents subnets from being reused at least initially,
instead favoring to cycle through them as we do with addresses within a
subnet.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-08 19:26:04 -04:00
Yang Li
b0b5e14b77 test: update tests to use sub-benchmarks
Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Some tests are not using this feature.

Signed-off-by: Yang Li <idealhack@gmail.com>
2018-05-31 11:34:15 +08:00
Euan Harris
ebf0054912 ipam/allocator: Fix typos in error message
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-23 11:03:55 +01:00
Euan Harris
35a81f8173 ipam/allocator_test: Test pool double-release behavior
Releasing a pool which has already been released should fail; this
change increases coverage by a fraction by exercising this path.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-18 17:32:36 +01:00
Abhinandan Prativadi
2f2811dd14 Adding logs for ipam state
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-05-14 15:44:49 -07:00
Abhinandan Prativadi
dfa303e568 fixing test cases
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-05-10 14:47:52 -07:00
Abhinandan Prativadi
9fe5cc10b2 Add check for overlapping subnets
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-05-10 14:47:07 -07:00
Flavio Crisciani
606e28015a Add test for parallel request pool
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-04-25 16:09:27 -07:00
Sebastiaan van Stijn
a360943a48 Fix golang.org/x/sync canonical import path
The golang.org/x/sync package was vendored using the
github.com/golang/sync URL, but this is not the canonical
URL.

Because of this, vendoring failed in Moby, as it detects
these to be a duplicate import:

    vndr github.com/golang/sync
    2018/03/14 11:54:37 Collecting initial packages
    2018/03/14 11:55:00 Download dependencies
    2018/03/14 11:55:00 Failed to parse config: invalid config format: // FIXME this should be golang.org/x/sync, which is already vendored above

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-14 13:11:08 +01:00
Flavio Crisciani
4c8d751400 IPAM tests
Added tests for swarm mode and also some new parallel tests

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-03-09 11:07:36 -08:00
Abhinandan Prativadi
a0085a47fd IPAM and Bitseq test cases
This commit contains test cases to verify the changes and to
solidify the library.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-03-09 09:24:10 -08:00
Abhinandan Prativadi
fe629b6eba Fixing concurrent map access
This commit fixes panic due to concurrent map access

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-03-08 11:19:45 -08:00
selansen
4484ea17c3 Allow user to specify default address pools for docker networks
This is new feature that allows  user to specify which subnetwork
 Docker contrainer should choose from when it creates bridge network.

 This libnetwork commit is to address moby PR 36054
Signed-off-by: selansen <elango.siva@docker.com>
2018-02-22 12:14:59 -05:00
Abhinandan Prativadi
3d44975995 Adding a unit case to verify rollover
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-10-03 12:15:34 -07:00
Abhinandan Prativadi
813a24a51c Minor unit test change
Since bit allocation is no longer first available from
the start some verfications are removed/modified to
the change allocation model

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-09-29 11:33:26 -07:00
Flavio Crisciani
38382fb29b Merge pull request #1752 from aaronlehmann/sprintfs
all: Avoid trivial uses of Sprintf
2017-08-23 15:49:46 -07:00
Derek McGowan
710e0664c4 Update logrus to v1.0.1
Fix case sensitivity issue
Update docker and runc vendors

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-07 11:20:47 -07:00
Flavio Crisciani
65860255c6 Fixed code issues
Fixed issues highlighted by the new checks

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-06-12 11:31:35 -07:00
Aaron Lehmann
cc0b7e6aad all: Avoid trivial uses of Sprintf
Use the string concatenation operator instead of using Sprintf for
simple string concatenation. This is usually easier to read, and allows
the compiler to detect problems with the type or number of operands,
which would be runtime errors with Sprintf.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-09 16:07:09 -07:00
Alessandro Boch
595246bdfb Merge pull request #1568 from likel/refactor
Remove unnecessary string formats
2016-12-29 12:18:06 -08:00
Madhu Venugopal
1b28c5e01d Internal interface to differentiate built-in drivers from remote
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-12-19 05:17:42 -08:00
Ke Li
23ac56fdd0 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Alessandro Boch
83dd2c193a Respect auto allocation for --ipv6
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-11-08 19:05:51 -08:00
Daehyeok Mun
7f473c779a Refactoring logrus import and formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.
Also fix import name to use original project name 'logrus' instead of
'log'

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2016-11-08 12:42:41 -07:00
Alessandro Boch
5889b279fb Separate pool parsing from pool auto-allocation
- In default ipam driver. Also improve error message
  in case no good pool is found

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-25 15:02:44 -07:00
Alessandro Boch
a9c9765b33 IPAM allocator to not accept a datastore update if already present
- Restoring the above behavior which got recently broken

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 16:43:51 -07:00
Alessandro Boch
04f5343139 Make o/p of ipam DumpDatabase() consistent
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-15 17:34:48 -07:00
Jana Radhakrishnan
716af1c1ee Need boltdb Register only in tests
Fixing an earlier commit which needlessly registered
boltdb in allocator.go while it is needed only for tests.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-15 16:34:09 -07:00
Alessandro Boch
216def1e1b Merge pull request #1120 from mrjana/store
Remove kvstore backend deps from datastore package
2016-04-15 15:50:46 -07:00
Jana Radhakrishnan
89e72d8888 Remove kvstore deps from datastore package
Currently datastore has dependencies on various kv backends.
This is undesirable if datastore had to be used as a backend
agnostic store management package with it's cache layer. This
PR aims to achieve that.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-15 15:36:44 -07:00
Jana Radhakrishnan
4289ea637a Make IPAM work even without a backing store
In general the core IPAM and bitseq implementation has
very little assumptions about the presence of a backing
store. But there are a few places where this assumption exists
and this makes it not useful as a simple in-memory allocator.
This PR removes those false assumptions.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-15 14:02:30 -07:00