Commit Graph

52 Commits

Author SHA1 Message Date
Derek McGowan 43f00b74d7 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
Alessandro Boch 596122e05e Add ConnectivityScope capability for network drivers along with scope network option
- It specifies whether the network driver can
  provide containers connectivity across hosts.
- As of now, the data scope of the driver was
  being overloaded with this notion.
- The driver scope information is still valid
  and it defines whether the data allocation
  of the network resources can be done globally
  or only locally.
- With the scope network option, user can now
  force a network as swarm scoped
  regardless of the driver data scope.
- In case the network is configured as swarm scoped,
  and the network driver is multihost capable,
  a network DB instance will be launched for it.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-12 17:16:34 -07:00
Santhosh Manohar 4693eab00d swarm mode network inspect should provide cluser-wide task details
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2017-03-10 19:12:00 -08:00
Santhosh Manohar 4da563bb06 Merge pull request #1599 from mavenugo/v0.9
Make use of GetAllManagedPluginsForCap to avoid loading v1-plugins
2017-01-04 15:02:06 -08:00
Madhu Venugopal a4e5218e63 Make use of GetAllManagedPluginsForCap to avoid loading v1-plugins
Read this for more details : https://github.com/docker/docker/pull/29665

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2017-01-04 14:35:42 -08:00
Alessandro Boch 75756e4712 Merge pull request #1568 from likel/refactor
Remove unnecessary string formats
2016-12-29 12:18:06 -08:00
Madhu Venugopal fb8744be86 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
Madhu Venugopal 119c5ba3bc Handle the case of registering active plugins during remote init
With Plugin-V2, plugins can get activated before remote driver is
Initialized. Those plugins fails to get registered with drvRegistry.

This fix handles that scenario

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-12-16 08:38:55 -08:00
Ke Li a3aa25c794 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Daehyeok Mun b735bb2ada 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
Madhu Venugopal 6b6d230a19 Add support for NetworkAllocate and NetworkFree in remote driver
Also added an API to return list of builtin network drivers

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-10-05 18:20:02 -07:00
Anusha Ragunathan 7b26d7e300 Make libnetwork understand pluginv2.
As part of daemon init, network and ipam drivers are passed a
pluginstore object that implements the plugin/getter interface. Use this
interface methods in libnetwork to interact with network plugins. This
interface provides the new and improved pluginv2 functionality and falls
back to pluginv1 (legacy) if necessary.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-27 15:29:10 -07:00
Jana Radhakrishnan 734d626141 Move engine-api to docker/docker/api
Remove all dependencies to engine-api and start using docker/docker/api.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-09-07 14:38:45 -07:00
Jana Radhakrishnan b33b7c68a5 Merge pull request #1205 from allencloud/fix-typos
use grep to find a/an misuse
2016-08-01 09:49:31 -07:00
Alessandro Boch 863d3043e4 Do not error on non discovery type messages in remote driver
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-25 16:23:11 -07:00
allencloud 8acef98c5f use grep to find a/an misuse
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-03 16:35:33 +08:00
Jana Radhakrishnan ed939ef5c3 Add driver api enhancements for gossip
With the introduction of a driver generic gossip in libnetwork it is not
necessary for drivers to run their own gossip protocol (like what
overlay driver is doing currently) but instead rely on the gossip
instance run centrally in libnetwork. In order to achieve this, certain
enhancements to driver api are needed. This api aims to provide these
enhancements.

The new api provides a way for drivers to register interest on table
names of their choice by returning a list of table names of interest as
a response to CreateNetwork. By doing that they will get notified if a
CRUD operation happened on the tables of their interest, via the newly
added EventNotify call.

Drivers themselves can add entries to any table during a Join call by
invoking AddTableEntry method any number of times during the Join
call. These entries lifetime is the same as the endpoint itself. As soon
as the container leaves the endpoint, those entries added by driver
during that endpoint's Join call will be automatically removed by
libnetwork. This action may trigger notification of such deletion to all
driver instances in the cluster who have registered interest in that
table's notification.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-18 19:55:39 -07:00
Jana Radhakrishnan 3db103d28d Add overlay manager driver
Because overlay is a builtin driver and global allocation of overlay
resources is probably going to happen in a different node (a single
node) and the actual plumbing of the network is probably going to happen
in all nodes, it makes sense to split the functionality of allocation
into two different packages. The central component(this package) only
implements the NetworkAllocate/Free apis while the distributed
component(the existing overlay driver) implements the rest of the driver
api. This way we can reduce the memory footprint overall.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-14 10:37:42 -07:00
Jana Radhakrishnan c597100b0f Add NetworkAllocate/Free to driver api
Added NetworkAllocate and NetworkFree apis to the list of
driver apis. The intention of the api is to provide a
centralized way of allocating and freeing network resources
for a network which is cross-host.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-11 16:38:22 -07:00
Alessandro Boch d7fc7d711d Use newly introduce plugins method to validate plugin response
- for endpoints which are not expected to be implemented
  by all remote drivers.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-08 23:10:25 -07:00
Santhosh Manohar 080bedd58a Merge pull request #810 from aboch/se
Move exposed ports and port bindings from Endpoint to Sandbox
2016-03-06 16:25:57 -08:00
Alessandro Boch c0d12322c1 Move exposed ports from Endpoint to Sandbox
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-06 09:31:26 -08:00
Madhu Venugopal 77c1c58159 Merge pull request #803 from aboch/pm
Libnetwork to program container interface's MAC
2016-03-03 18:12:08 -08:00
Alessandro Boch 94e4e395c5 Introduce discoverapi.Discover interface
- Move DiscoverNew() and DiscoverDelete() methods into the new interface
- Add DatastoreUpdate notification
- Now this interface can be implemented by any drivers, not only network drivers

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-01-28 12:13:04 -08:00
Jana Radhakrishnan 9227b00fea Fix up Godeps and update docker/docker packages
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-12-23 15:07:33 -08:00
Alessandro Boch 48d1403d84 Libnetwork to set container interface's MAC
- Consistently with what it does for IP addresses, libnetwork
  will also program the container interface's MAC address with
  the value set by network driver in InterfaceInfo.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-12-04 16:56:46 -08:00
Chun Chen b1e94ca09a Add DisableGatewayService in JoinInfo to offering drivers the ability to disable default gateway
Signed-off-by: Chun Chen <ramichen@tencent.com>
2015-12-03 12:51:28 +08:00
Alessandro Boch 6315c9a4b6 libnetwork <-> ipam driver interaction
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-03 16:18:19 -07:00
Madhu Venugopal 8d03e80f21 Integration with Docker Discovery
* integrated hostdiscovery package with the new Docker Discovery
* Integrated hostdiscovery package with libnetwork core
* removed libnetwork_discovery tag
* Introduced driver apis for discovery events
* moved overlay driver to make use of the discovery events
* Using Docker Discovery service.
* Changed integration-tests to make use of the new discovery

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-01 12:32:55 -07:00
Madhu Venugopal add4bbdff9 Godeps update
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-30 08:16:58 -07:00
Chun Chen 1edba8531d Various refactor and fixes for the previous two commits including:
1. Don't save localscope endpoints to localstore for now.
2. Add common function updateToStore/deleteFromStore to store KVObjects.
3. Merge `getNetworksFromGlobalStore` and `getNetworksFromLocalStore`
4. Add `n.isGlobalScoped` before `n.watchEndpoints` in `addNetwork`
5. Fix integration-tests
6. Fix test failure in drivers/remote/driver_test.go
7. Restore network to store if deleteNework failed
2015-09-22 01:29:51 +08:00
Chun Chen b35d1735d4 Add local datastore to persist states of LocalScope network
Signed-off-by: Chun Chen <ramichen@tencent.com>
2015-09-21 17:58:51 +08:00
Madhu Venugopal b0e7a335fa Merge pull request #547 from mrjana/config
Push driver config during `Init`
2015-09-19 08:50:02 -07:00
Jana Radhakrishnan 900aca112b Push driver config during `Init`
Currently the driver configuration is pushed through a separate
api. This makes driver configuration possible at any arbitrary
time. This unncessarily complicates the driver implementation.
More importantly the driver does not get access to it's
configuration before it can do the handshake with libnetwork.
This make the internal drivers a little bit different to
external plugins which can get their configuration before the handshake
with libnetwork.

This PR attempts to fix that mismatch between internal drivers and
external plugins.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-09-19 08:43:34 -07:00
Jana Radhakrishnan a2f832fdb4 Introduce test remote plugin in dnet
There are multiple goals of introducing test driver plugin
  - Need a driver which can be configured to simulate
    different driver behaviors
  - For pure libnetwork multi-host integration testing
    a test driver configured for global scope can be used
    without trying to use a real driver like overlay
    which comes with it's own dependencies which can't
    be satisfied all enviroments(I am looking at you
    circleci)

This PR also makes all test cases that we have so far to be run
in circleci without any skipping needed.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-09-17 10:38:34 -07:00
Zhang Wei a20a1a4e2c Add negotiation process for driver scope
Add one capability negotiation interaction after plugin handshake, use
this to determine plugin's capability instead of default "global" scope.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-09-15 16:45:38 +08:00
Jana Radhakrishnan a3db98ec00 Remove multiple interface in an endpoint
Currently the endpoint data model consists of multiple
interfaces per-endpoint. This seems to be an overkill
since there is no real use case for it. Removing it
to remove unnecessary complexity from the code.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-09-11 09:19:01 -07:00
David Calavera 3afcd65d6e Move test specific functions to a testutils package.
This way we won't vendor test related functions in docker anymore.
It also moves netns related functions to a new ns package to be able to
call the ns init function in tests. I think this also helps with the
overall package isolation.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-07 13:33:28 -04:00
Alessandro Boch 9a47be244a Introduce Sandbox entity
- Maps 1 to 1 with container's networking stack
- It holds container's specific nw options which
  before were incorrectly owned by Endpoint.
- Sandbox creation no longer coupled with Endpoint Join,
  sandbox and endpoint have now separate lifecycle.
- LeaveAll naturally replaced by Sandbox.Delete
- some pkg and file renaming in order to have clear
  mapping between structure name and entity ("sandbox")
- Revisited hosts and resolv.conf handling
- Removed from JoinInfo interface capability of setting hosts and resolv.conf paths
- Changed etchosts.Build() to first write the search domains and then the nameservers

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-27 11:19:02 -07:00
Erik Hollensbe 100f13fff5 Expose the remote driver API structs publicly. 2015-07-16 06:11:50 +00:00
Madhu Venugopal 2e40befd82 Replacing isReservedNetwork with Driver capability
Currently store makes use of a static isReservedNetwork check to decide
if a network needs to be stored in the distributed store or not. But it
is better if the check is not static, but be determined based on the
capability of the driver that backs the network.

Hence introducing a new capability mechanism to the driver which it can
express its capability during registration. Making use of first such
capability : Scope. This can be expanded in the future for more such cases.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-10 23:59:38 -07:00
aboch 5455132c59 Merge pull request #240 from Metaswitch/remote-driver-static-routes
Add static routes to the remote driver.
2015-06-03 16:51:56 -07:00
Tom Denham 54fe285107 Add static routes to the remote driver.
Signed-off-by: Tom Denham <tom.denham@metaswitch.com>
2015-06-03 16:31:21 -07:00
Tom Denham 3613483222 Update remote driver to use destiantion prefix.
Required since #193

Signedeoff-by: Tom Denham <tom.denham@metaswitch.com>
2015-06-01 15:35:57 -07:00
Tom Denham b646784859 Allow drivers to supply static routes for interfaces
Signed-off-by: Tom Denham <tom.denham@metaswitch.com>
2015-05-25 19:25:30 -07:00
Michael Bridgen b18eff4940 Remote driver implementation
In essense, this just involves marshalling structs back and forth to a
remote process, via the plugin client. There are a couple of types
that don't JSONify well, notably `net.IPNet`, so there is some
translation to be done.

To conform to the driverapi interface, we must give the list of
endpoint interfaces to the remote process, and let it puzzle out what
it's supposed to do; including the possibility of returning an error.

The constraints on EndpointInfo are enforced by the remote driver
implementation; namely:

 * It can't be nil

 * If it's got non-empty Interfaces(), the remote process can't put
   more in

In the latter case, or if we fail to add an interface for some
(future) reason, we try to roll the endpoint creation back. Likewise
for join -- if we fail to set the fields of the JoinInfo, we roll the
join back by leaving.

Signed-off-by: Michael Bridgen <mikeb@squaremobius.net>
2015-05-21 19:32:41 +01:00
Alessandro Boch 50964c9948 Provide interface to categorize errors
- Package types to define the interfaces libnetwork errors
  may implement, so that caller can categorize them.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-20 22:29:29 -07:00
Jana Radhakrishnan d8ba1e2310 Driver api refactor
Refactored the driver api so that is aligns well with the design
of endpoint lifecycle becoming decoupled from the container lifecycle.
Introduced go interfaces to obtain address information during CreateEndpoint.
Go interfaces are also used to get data from driver during join.
This sort of deisgn hides the libnetwork specific type details from drivers.

Another adjustment is to provide a list of interfaces during CreateEndpoint. The
goal of this is many-fold:
     * To indicate to the driver that IP address has been assigned by some other
       entity (like a user wanting to use their own static IP for an endpoint/container)
       and asking the driver to honor this. Driver may reject this configuration
       and return an error but it may not try to allocate an IP address and override
       the passed one.
     * To indicate to the driver that IP address has already been allocated once
       for this endpoint by an instance of the same driver in some docker host
       in the cluster and this is merely a notification about that endpoint and the
       allocated resources.
     * In case the list of interfaces is empty the driver is required to allocate and
       assign IP addresses for this endpoint.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-18 22:36:00 +00:00
Madhu Venugopal c756c47613 Remote Driver integration with Plugin Framework
This commit brings in Remote driver integrated with the newly introduced
Plugin framework as a Docker Package.

The Plugin framework is designed as a Package and has no runtime
dependancy on Docker platform. It stands on its own and is a good
candidate for getting the remote drivers hooked to libnetwork

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-18 13:42:19 -07:00
Michael Bridgen c6e78965a9 Make driver packages register themselves via DriverCallback
In the present code, each driver package provides a `New()` method
which constructs a driver of its type, which is then registered with
the controller.

However, this is not suitable for the `drivers/remote` package, since
it does not provide a (singleton) driver, but a mechanism for drivers
to be added dynamically. As a result, the implementation is oddly
dual-purpose, and a spurious `"remote"` driver is added to the
controller's list of available drivers.

Instead, it is better to provide the registration callback to each
package and let it register its own driver or drivers. That way, the
singleton driver packages can construct one and register it, and the
remote package can hook the callback up with whatever the dynamic
driver mechanism turns out to be.

NB there are some method signature changes; in particular to
controller.New, which can return an error if the built-in driver
packages fail to initialise.

Signed-off-by: Michael Bridgen <mikeb@squaremobius.net>
2015-05-11 19:00:06 +01:00