Commit graph

91 commits

Author SHA1 Message Date
Shijiang Wei
d6685f61a7 make sure the interfaces is cleared on error
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-07-29 20:15:02 +08:00
Alessandro Boch
88c2c05ce9 Misc fixes to ip allocation in bridge driver
Two changes were missing:
- On allocation of bridge ip was not passing canonical subnet
- Canonical subnet has to be passed on ip release
  as well, otherwise ipallocator will attempt
  ip release from a non registered nw

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-24 16:59:27 -07:00
aboch
dbe595343e Merge pull request #412 from mrjana/bugs
Use sysfs to set hairpin mode
2015-07-24 12:03:53 -07:00
Jana Radhakrishnan
2d8377f615 Merge pull request #409 from alecbenson/iccfix
Fix ICC on Fedora systems with Firewalld
2015-07-24 10:46:03 -07:00
Jana Radhakrishnan
dc3bb60faa Merge pull request #288 from aboch/ag
Pass a canonical subnet to ipallocator
2015-07-24 10:45:20 -07:00
Jana Radhakrishnan
2dd9a6fa75 Use sysfs to set hairpin mode
Set the hairpin mode using the sysfs interface which
looks like it is working all the way to the oldest
of RHEL6.6 kernels.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-24 10:26:08 -07:00
Alec Benson
21b0927720 Fix ICC on Firewalld enabled fedora systems, add in missing firewalld functionality to re-apply configuration when reloaded
Signed-off-by: Alec Benson <albenson@redhat.com>
2015-07-24 13:20:48 -04:00
Alexander Morozov
55e7175f64 Remove dependency on libcontainer
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-16 13:26:26 -07:00
Madhu Venugopal
981686787b Fixed a bug in DeleteEndpoint to properly release v6 ip
When fixed-cidrv6 is used, the allocation and release must happen from
the appropriate network. Allocation is done properly in createendpoint,
but the DeleteEndpoint wasnt taking care of this case.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-07-09 20:46:36 -07:00
Alec Benson
90a410eb3d Refactor of docker PR #11405
Signed-off-by: Alec Benson <albenson@redhat.com>
2015-07-08 10:15:08 -04:00
Jana Radhakrishnan
10444cb448 Manually bring up the host side veth interface
In preparation for the new update of vishvananda/netlink package
we need to bringup the host veth interface manually.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 09:32:03 -07:00
Jana Radhakrishnan
15759edb38 Fix networking issues in RHEL/Centos 6.6
Some parts of the bridge driver code needs to use a different kernel
api or use the already existing apis in slightly different ways to
make the bridge driver work in RHEL/Centos 6.6. This PR provides
those fixes.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 09:31:13 -07:00
Madhu Venugopal
5344e75e4e Merge pull request #278 from LK4D4/firewalld_support
Resurrect firewalld support
2015-06-26 13:12:19 -07:00
aboch
b1f84e6f12 Merge pull request #304 from wulonghui/wulonghui-patch-1
Update modprobe bridge output
2015-06-25 16:51:30 -07:00
wulonghui
df56ce5f47 Update error return in bridge driver's getNetwork 2015-06-25 19:33:46 +08:00
Alexander Morozov
63514b2749 Resurrect firewalld support
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-21 16:42:01 -07:00
wulonghui
4d60688464 Update modprobe bridge output 2015-06-17 10:07:51 +00:00
Madhu Venugopal
f843e44805 Cleaning up iptables nat table on driver bootup
This is required to have consistent behaviour as in 1.6.2.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-16 09:26:23 -07:00
Alessandro Boch
3d805de246 Pass a canonical subnet to ipallocator
- Currently both network and host bits in the subnet are passed
  when requesting an address from ipallocator.
  The way ip allocator determines the first available
  IP is tainted when caller passes the subnet host bits.

- Verified this patch applied to libnetwork vendored in docker
  fixes the issue when starting the daemon.

- Fixes #287

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-12 00:20:43 -07:00
Madhu Venugopal
903fcbd154 enable hairpin mode on the bridge port & fix iptables rule
* When userland-proxy is disabled, enable hairpin mode on the host-side of the veth
* When userland-proxy is enabled, fix the iptable rules appropriately

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-11 19:23:02 -07:00
Jana Radhakrishnan
fb06bd5a1a Merge pull request #264 from mavenugo/mh-ln
datastore support for endpoint, GetObject, DeleteObject and swarm store API upgrade
2015-06-11 15:28:19 -07:00
Madhu Venugopal
9e8974cc64 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
Madhu Venugopal
f88824fb8a Reworked endpoint store operation to address a few cases
* Removed network from being marshalled (it is part of the key anyways)
* Reworked the watch function to handle container-id on endpoints
* Included ContainerInfo to be marshalled which needs to be synchronized
* Resolved multiple race issues by introducing data locks

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-10 23:59:29 -07:00
Jana Radhakrishnan
fcca4484cb Generate container mac address based on IP
Currently we craete container mac address completely
randomly. But we probably need to generate based on
IP so that the mac address stays the same for a given
IP.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-10 20:12:43 -07:00
Alessandro Boch
8d7e5cbb68 Minor changes in bridge.go
- lock network struct before accessing config in NetworkCreate
- reorganize locks so that we lock only what needed and when needed
- conflict method really belongs to networkConfig not bridgeNetwork

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-09 16:44:43 -07:00
Alessandro Boch
e27586de4e Provide isolation b/w bridge networks
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-08 17:15:57 -07:00
Jana Radhakrishnan
f5c1c78179 Refactor sandbox code to use interfaces
Currently sandbox code exposes bare structs
externally to the package. It is untenable
to continue this way and it becomes too
inflexible to use it to store internal state.
Changed all of them to use interfaces.
Also cleaned up a lot of boiler plate code
which needs to set into namespace.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-08 10:17:56 -07:00
Jana Radhakrishnan
6d6aeff780 Make GenerateIfaceName generic
Currently GenerateIfaceName is defined in bridge.go
and it specifically tries to only generate an interface
name only with `veth` prefix. Make it generic so that it
can accept a prefix and length of random bytes. Also
move it to netutils since it is useful to generate various
kinds of interface names using it.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-08 09:49:17 -07:00
Alessandro Boch
8ac0d7709f Add restrictions for default drivers/bridge name
- modified tests accordingly
- added extra tests for creating a couple of bridge nw and query them

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-08 08:32:08 -07:00
Madhu Venugopal
e67f9f4f79 Copy default configs from default Bridge to new bridge if not user configured
Also fixed a minor bug in client to choose bridge as the default driver.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-04 11:48:31 -07:00
Madhu Venugopal
cad0f33910 Merge pull request #239 from aboch/pmc
One port mapper per bridge network
2015-06-04 05:24:00 -07:00
Alessandro Boch
3be66461ba Change in bridge EndpointOperInfo()
- To also return the configured exposed ports, besides the
  port bindings; as now libnetwork/endpoint.go endpoint setters
  separate the exposed ports and port binding configs.
  Docker daemon will take care of aggregating the two sources
  for presentation.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-03 20:28:15 -07:00
Madhu Venugopal
0ae84dad55 Fixes https://github.com/docker/docker/issues/13426
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-02 15:50:38 -07:00
Jana Radhakrishnan
61993ec6c2 Modprobe bridge driver r specific kernel modules
Try too modprobe bridge driverer specic modulein case
they are not loaded into the kernel.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-02 15:49:45 -07:00
Alessandro Boch
cfc28a900a One port mapper per bridge network
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-01 13:14:29 -07:00
Alessandro Boch
e244043eb3 In bridge, network config to be validated last
- Currently validation is run before the processing
  of well-known labels is completed.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-24 12:01:55 -07:00
Alessandro Boch
35fab0aa6f Bridge driver to support multiple networks
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-24 07:59:34 -07:00
Alessandro Boch
5d9c59e523 Support network options in rest api
- Also unexporting configuration structures in bridge
- Changes in dnet/network.go to set bridge name = network name

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-23 20:12:29 -07:00
Jana Radhakrishnan
89045ca381 Modify driver Join api to only allow dst prefix
Currently the driver api allows the driver to specify the
full interface name for the interface inside the container.
This is not appropriate since the driver does not have the full
view of the sandbox to correcly allocate an unambiguous interface
name. Instead with this PR the driver will be allowed to specify
a prefix for the name and libnetwork and sandbox layers will
disambiguate it with an appropriate suffix.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-21 20:17:44 +00:00
Alessandro Boch
c70cfcb150 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
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
Alessandro Boch
902e8746d3 Optional Userland Proxy
- Port https://github.com/docker/docker/pull/12165 to libnetwork
- More tests will be added later

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-18 18:13:39 -07: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
bin liu
e1003fb078 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-05-07 09:22:06 +00:00
Madhu Venugopal
904a313396 Remote Driver Registration
This commits brings in a functionality for remote drivers to register
with LibNetwork. The Built-In remote driver is responsible for the
actual "remote" plugin to be made available.

Having such a mechanism makes libnetwork core not dependent on any
external plugin mechanism and also the Libnetwork NB apis are free of
Driver interface.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-06 21:45:30 -07:00
Jana Radhakrishnan
3919b126a9 Added support for network specific enable ipv6 label
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-06 17:43:34 +00:00
Jana Radhakrishnan
94a9f12280 Moved most of the driver configuration to network configuration.
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-06 17:43:24 +00: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