Commit graph

214 commits

Author SHA1 Message Date
Alessandro Boch
a5aeffcb59 Fix when connecting/disconnecting to/from default gw network
- Restoring original behavior where on disconnect
  from overlay network (only connected network), it also
  disconnects from default gw network.
- On sandbox delete, the leave and delete of each
  endpoint is performed, regardless of whether the endpoint
  is the gw network endpoint. This endpoint is already
  automatically removed in endpoint.sbLeave()
- Also do not let internal network dictate container does
  not need external connectivity. Before this fix, if a container
  was connected to an overlay and an internal network, it may not
  get attached to the default gw network.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-06 09:29:41 -07:00
Madhu Venugopal
12f04e292f Revert "Do not leave/delete gw endpoint twice"
This reverts commit c957564753 introduced
via #1064.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-04-05 18:55:16 -07:00
Alessandro Boch
c957564753 Do not leave/delete gw endpoint twice
- On sandbox delete, the leave and delete of each
  endpoint is performed, regardless of whether the endpoint
  is the gw network endpoint. This endpoint is already
  automatically removed in endpoint.sbLeave() by
  sb.clearDefaultGW() when the sandbox is marked for
  deletion.
- Also restoring otiginal behavior where on disconnect
  from overlay network (only connected network), it also
  disconnects from default gw network.
- Also do not let internal network dictate container does
  not need external connectivity. Before this fix, if a container
  was connected to an overlay and an internal network, it may not
  get attached to the default gw network.
- needDefaultGw() takes now into account whether the sandbox
  is marked for deletion

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-05 11:32:49 -07:00
Santhosh Manohar
ca06f1ed80 On network disconnect clear the cached connections to external
nameservers

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-03-20 05:00:58 -07:00
Alessandro Boch
9c88ee206e Log stale resource cleanup
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-16 11:57:19 -07:00
Madhu Venugopal
4dde205544 Fixing a possible endpoint_cnt state inconsistency issue
During ungraceful shutdown, it is possible that the endpoint_cnt can be
inconsistent with the actual endpoints in a network. This fix will
resolve that inconsistency

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-03-15 21:07:42 -07:00
Alessandro Boch
8cf7270d06 Miscellaneous fixes
- Fix npe in sbJoin error path
- Fail again endpoint Join in case of failure
  in programming the external connectivity
- In bridge, look for parent and child container configs
  in the generic data
- iptables.Exists() might be called before any other call to
  iptables.raw(). We need to call checkInit() then.

Introduced by 1638fbdf27

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-08 15:49:47 -08:00
msabansal
679ee7a070 Fixed IP information not displayed properly in docker network inspect
Signed-off-by: msabansal <sabansal@microsoft.com>
2016-03-07 13:20:42 -08:00
Alessandro Boch
1638fbdf27 Move exposed ports from Endpoint to Sandbox
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-06 09:31:26 -08:00
Alexander Morozov
74cf622463 Fix some races in getNetworkFromStore
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-01-29 11:06:33 -08:00
Bryan Boreham
81c586e0e5 Stop referring to requested IP address as "preferred",
since it is an error if that address is unavailable.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2016-01-26 15:09:29 +00:00
Madhu Venugopal
1419d96a01 Reducing the complexity in default gateway service handling
By removing the need to clear the default gateway during sbJoin and
sbLeave to account for other bridge network, the default-gw endpoint
will stay with the container, it will also help retain the container
property.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-23 11:10:00 -08:00
aboch
3e6a42bcdb Merge pull request #880 from mavenugo/ddd
Force delete sandbox during sandboxCleanup
2016-01-19 13:57:53 -05:00
Madhu Venugopal
315004b575 Cache scope in network object
Its safe to cache the scope value in network object and can be reused
for cleanup operations. The current implementation assume the presence
of driver during cleanup operation. Since a remote driver may not be
present, we should not fail such cleanup operations. Hence make use of
the scope variable from network object.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-18 17:54:29 -08:00
Vincent Demeester
3d9c5a959c Fixes docker/docker#19404
incorrect error message if custom IP if the custom IP-address is not
within a subnet of the network.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-18 10:50:59 +01:00
Madhu Venugopal
a7c52918fd Force delete sandbox during sandboxCleanup
Stale sandbox and endpoints are cleaned up during controller init.
Since we reuse the exact same code-path, for sandbox and endpoint
delete, they try to load the plugin and it causes daemon startup
timeouts since the external plugin containers cant be loaded at that
time. Since the cleanup is actually performed for the libnetwork core
states, we can force delete sandbox and endpoint even if the driver is
not loaded.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-17 14:47:49 -08:00
Madhu Venugopal
69acfe6332 Merge pull request #863 from wenchma/typo_error
Fixes some typo errors
2016-01-16 12:23:52 -08:00
wenchma
0b07ad6202 Fixes some typo errors
Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
2016-01-13 12:59:24 +08:00
Madhu Venugopal
e88b95c13f Remove isNodeAlive check while force deleting endpoint
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-12 17:49:17 -08:00
Madhu Venugopal
8f4d7a1cf1 Merge pull request #861 from sanimej/bugs
EP lock shouldn't be held when trying for network lock
2016-01-12 11:08:09 -08:00
Madhu Venugopal
ec622bf158 Forced endpoint delete
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-12 18:50:28 +00:00
Santhosh Manohar
3e154b3cef EP lock shouldn't be held when trying network lock
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-01-08 19:25:53 -08:00
Madhu Venugopal
2db863e5d7 Global alias support
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-08 12:27:15 -08:00
Madhu Venugopal
63e20c2f3d Alias support
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-07 14:50:23 -08:00
Santhosh Manohar
cf7ed0a717 Embedded DNS server
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-01-07 00:25:26 -08:00
Alessandro Boch
2ecc6aa49e Add support for Endpoint's preferred IPv6 address
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-12-22 15:48:23 -08:00
Alessandro Boch
29299b73df Allow remote IPAM driver to express capability
- So that a DHCP based plugin can express it needs
  the endpoint MAC address when requested for an IP address.
- In such case libnetwork will allocate one if not already
  provided by user

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-12-17 15:41:47 -08:00
Alessandro Boch
158b2852b9 Skip defaultGw check if sandbox is being deleted
- On Sandbox deletion, during Leave of each
  connected endpoint, avoid the default gw
  check, which may create an unnecessary
  connection to the default gateway network.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-12-04 15:09:59 -08:00
Ryan Belgrave
44f532f16e When assigning an address for an endpoint set preferred address and
options.

When requesting a gateway address send a gateway label in the options.

Signed-off-by: Ryan Belgrave <rmb1993@gmail.com>
2015-12-04 00:00:03 -05:00
Jana Radhakrishnan
84abbcefa8 Fix a couple of edge cases in service discovery
The first issue is an ordering problem where sandbox
attached version of endpoint object should be pushed
to the watch database first so that any other create endpoint
which is in progress can make use of it immediately to update
the container hosts file. And only after that the current
container should try to retrieve the service records from the
service data base and upate it's hosts file. With the previous
order there is a small time window, when another endpoint create
will find this endpoint but it doesn't have the sandbox context
while the svc record population from svc db has already happened
so that container will totally miss to populate the service record
of the newly created endpoint.

The second issue is trying to rebuild the /etc/hosts file from scratch
during endpoint join and this may sometimes happen after the service
record add for another endpoint  has happened on the container
file. Obviously this rebuilding will wipe out that service record which
was just added. Removed the rebuilding of /etc/hosts file during
endpoint join. The initial population of /etc/hosts file should only
happen during sandbox creation time. In the endpoint join just added
the backward-compatible self ip -> hostname entry as just another
record.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-11-25 15:25:56 -08:00
Madhu Venugopal
1aa88fa870 Allow endpoint delete if sandbox identifier is stale
There are cases as seen in https://github.com/docker/docker/issues/17984
the sandbox could be stale in endpoint structure, when the actual
sandbox is removed during the cleanup phase. Hence instead of just
validating for sandboxID, make sure if it is actually present in the
sandboxes DB managed by the controller.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-11-17 21:00:46 -08:00
Alessandro Boch
af7bc494f9 Allow IPv6 allocation post endpoint create
- Controlled by network option

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-11-10 14:53:19 -08:00
Alessandro Boch
7b4b56169b Some functions' logic cleanup
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-27 11:08:42 -07:00
Santhosh Manohar
3da8471681 Handling container rename in libnetwork
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-10-23 05:31:53 -07:00
Alessandro Boch
4cc65d01a6 Clean hosts entries on endpoint leave
- Currently when a sandbox disconnect from a network
  the network's services are not removed from the
  sandbox's /etc/hosts file

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-24 13:31:01 -07:00
Madhu Venugopal
e550f1b840 Merge pull request #702 from mrjana/bugs
Avoid duplicate entries in /etc/hosts
2015-10-24 03:00:44 +02:00
Jana Radhakrishnan
4850c5f1e6 Avoid duplicate entries in /etc/hosts
Currently the local containers of a global scope
network will get it's service records updated
from both a local update and global update. There
is no way to check if this is a local endpoint when
a remote update comes in via watch because we add
the endpoint to local endpoint list during join, while
the remote update happens during createendpoint.

The right thing to do is update the local endpoint list
and start watching during createndpoint and remove the watch
during delete endpoint. But this might result in the container
getting it's own record in it's /etc/hosts. So added a filtering
logic to filter out self records when updating the container's
/etc/hosts

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-23 16:39:40 -07:00
Santhosh Manohar
133ee32980 Fix Endpoint Unmarshal to retrieve the fields correctly
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-10-22 08:41:52 -07:00
Alessandro Boch
e41a9cf59d Allow anonymous endpoint
- Allow to create an endpoint as anonymous.
  An anonymous endpoint does not get added
  to the network service records.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-20 14:05:46 -07:00
Jana Radhakrishnan
d686fbb9c4 Handle maskable error during endpoint delete
Do not log unncessary warning messages when you get
maskable error from driver during an endpoint delete.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-19 15:56:25 -07:00
Jana Radhakrishnan
33d336ac72 Cleanup dangling local endpoints
When we bootup cleanup all dangling local
endpoints since they are not needed anymore.
The only reason it can happen is when the process
went down ungracefully after an endpoint is
created but before join is successfull.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-19 14:44:27 -07:00
Jana Radhakrishnan
afd6162240 Bridge driver should return maskable error
Bridge driver should return maskable error during Leave
or DeleteEndpoint since this can be an expected sceanrio
when libnetwork tries to leave and delete default bridge
endpoints and bridge driver does not persist with the default
bridge. This is only expected during an ungraceful exit of
the daemon but will cause confusion to the user if it shows
up as failures on a deamon restart after an ungraceful exit.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-16 16:11:55 -07:00
Jana Radhakrishnan
ab8dfb54fe Separate endpoint count data from network object
Currently endpoint count is maintained as part of
network object and the endpoint count gets updated
frequently while the rest of network is quite stable.
Because of the frequent updates to endpoint count the
network object is getting marshalled and unmarshalled
ferquently. This is causing a lot of churn and transient
memory usage. Fix this by creating a deparate object of
endpoint count so that only that gets updated.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-11 23:17:06 -07:00
Madhu Venugopal
3d3bd9331f Fixed a couple of error messages to address UX related comments
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-09 01:45:24 -07:00
Alessandro Boch
af3eb25d44 Phase-2 bridge driver changes to support IPAM
- Set bridge ipv4 address when bridge is present
- IPv6 changes for bridge
- Convert unit tests to the new model

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-08 16:22:03 -07:00
Madhu Venugopal
f2f536032b Phase-1 bridge driver changes to support IPAM
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-08 14:26:58 -07:00
Madhu Venugopal
831e3401f3 Merge pull request #606 from mrjana/model
Cleanup dangling sandboxes on boot up
2015-10-08 01:03:32 -07:00
Jana Radhakrishnan
e41b4765bd Cleanup dangling sandboxes on boot up
Currently when docker exits ungracefully it may leave
dangling sandboxes which may hold onto precious network
resources. Added checkpoint state for sandboxes which
on boot up will be used to clean up the sandboxes and
network resources.

On bootup the remaining dangling state in the checkpoint
are read and cleaned up before accepting any new
network allocation requests.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-07 20:08:47 -07:00
Alessandro Boch
b9596c89d6 libnetwork to handle allocation of ipv6
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-07 13:57:28 -07:00
Jana Radhakrishnan
71e14dd52a Remove always-on watch for networks and endpoints
Always on watching of networks and endpoints can
affect scalability of the cluster beyond a few nodes.
Remove pro active watching and watch only the objects
you are interested in.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-06 14:15:49 -07:00