Commit Graph

25 Commits

Author SHA1 Message Date
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 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
Ke Li 23ac56fdd0 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Jana Radhakrishnan 7d7b9f2405 Add support to accepting arbitrary network ID
Currently the libnetwork function `NewNetwork` does not allow
caller to pass a network ID and it is always generated internally.
This is sufficient for engine use. But it doesn't satisfy the needs
of libnetwork being used as an independent library in programs other
than the engine. This enhancement is one of the many needed to
facilitate a generic libnetwork.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-15 12:34:21 -07:00
David Bellotti 921be8b633 Fix up example code
- runs to completion without error
- demonstrates info available when using bridge network driver

Closes #837

Signed-off-by: Gabe Rosenhouse <grosenhouse@pivotal.io>
2015-12-23 11:47:14 -08:00
Jana Radhakrishnan d565a4df48 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
Alessandro Boch fd43ee1323 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
Alex Chan 2e64ce637b Minor spelling fixes in documentation and code comments 2015-06-26 11:02:54 +01:00
Madhu Venugopal 9f3d1ce3ff Moved the TOML based Configuration to dnet
The configuration format for docker runtime is based on daemon flags and
hence adjusting the libnetwork configuration to accomodate it by moving
the TOML based configuration to the dnet tool.

Also changed the controller configuration via options

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-12 12:46:12 -07:00
Jana Radhakrishnan 800029abb6 Remove container data return value from Join
Now that Endpoint interface has the Info method there is no
need to return container data as a return value in the Join
method. Removed the return value and fixed all the callers.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-29 20:11:02 +00:00
Madhu Venugopal 481568035f TOML based Configuration support for libnetwork
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-25 16:29:40 -07:00
Jana Radhakrishnan a9fa764cbb Move network types to types package
This is need to decouple types from netutils which has linux
dependencies. This way the client code which needs network types
can just pull in types package which makes client code platform
agnostic.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-20 20:28:46 +00:00
Jana Radhakrishnan b323d571b5 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
Alessandro Boch f16db2c3ad Remove pkg directory
- As recommended by Docker committers.
- Will introduce internal directory when go supports it

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-16 16:12:13 -07:00
Michael Bridgen 614d82390c 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
Jana Radhakrishnan c9b54861e7 - Moved label definitions to a new package
- Added a network scope well-defined label
  to enable ipv6

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-06 17:21:19 +00:00
Alessandro Boch 56741e7d60 Provide API to retrieve Endpoint operational data
- from the driver

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-04 14:54:48 -07:00
Madhu Venugopal cc4f27f6af Minor API modifications
* Modified NB API with self referential var-aarg for future proofing the APIs
* Modified Driver API's option parameter to be a Map of interface{}

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-01 10:49:25 -07:00
Jana Radhakrishnan e2d8531a40 - Added support for Join/Leave methods to Endpoint.
- Removed sandbox key argument for CreateEndpoint.
- Refactored bridge driver code to remove sandbox key.
- Fixed bridge driver code for gaps in ipv6 behavior
  observed during docker integration.
- Updated test code, readme code, README.md according
  api change.
- Fixed some sandbox issues while testing docker ipv6
  integration.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-29 14:49:32 +00:00
Alessandro Boch 1fae5573d2 Refactor NetworkController interface
- To reflect work flow. NewDriver() => ConfigureDriver()
  and no NetworkDriver returned.
  libnetwork clients would refer to a driver/network type, then
  internally controller will retrieve the correspondent driver
  instance, but this is not a concern of the clients.
- Remove NetworkDriver interface
- Removed stale blank dependency on bridge in libnetwork_test.go

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-04-23 18:46:01 -07:00
Madhu Venugopal 914ad10ea4 Merge pull request #84 from aboch/mao
Libnetwork bridge to handle --mac-address option
2015-04-23 16:40:07 -07:00
Alessandro Boch 69437b1009 Libnetwork bridge to handle --mac-address option
- This addresses one requirement from Issue #79
- Defined EndpointConfiguration struct for bridge driver
  which contains the user's preferred mac address for the
  sanbox interface

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-04-23 13:03:34 -07:00
Dave Tucker f4fd5dacbf Rename simplebridge to bridge
Fixes #81

Signed-off-by: Dave Tucker <dt@docker.com>
2015-04-23 10:49:57 -07:00
Alessandro Boch 95958d7610 Enhance Endpoint interface
- Added new getter methods
- Modified signature of Network.CreateEndpoint()

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-04-20 03:21:01 -07:00
Jana Radhakrishnan ec7d417a37 Added a test binary to test README.md code
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-16 05:04:31 +00:00