Commit Graph

51 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 d9e80627a4 Do not reset network scope during store read
- Unless it is needed

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-15 12:05:56 -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
Alessandro Boch 16406c8dbd Support configuration networks
- They are configuration-only networks which
  can be used to supply the configuration
  when creating regular networks.
- They do not get allocated and do net get plumbed.
  Drivers do not get to know about them.
- They can be removed, once no other network is
  using them.
- When user creates a network specifying a
  configuration network for the config, no
  other network specific configuration field
  is are accepted. User can only specify
  network operator fields (attachable, internal,...)
- They do not need to have a driver field, that
  field gets actually reset upon creation.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-11 11:37:18 -07:00
Akihiro Suda c5f51123b8 improve error for getStore()
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-04-05 05:37:58 +00:00
Madhu Venugopal 5e7857a1f8 replace individual endpoint_cnt read from store with 1 bulk read
getNetworksFromStore reads networks and endpoint_cnt from the kvstores.
endpoint_cnt especially is read in a for-loop for each network and that
causes a lot of stress in poorly performing KV-Stores.
This fix eases the load on the kvstore by fetching all the endpoint_cnt
in a single read and the operation is performed on it.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2017-02-02 14:45:38 -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
Jana Radhakrishnan deec490224 Avoid k/v store endpoint update in swarm mode
Avoid the whole store endpoint update logic when running in swarm mode
and the endpoint is part of a global scope network. Currently there is
no store update that is happening for global scope networks in swarm
mode, but this code path will delete the svcRecords database when the
last endpoint on the network is removed which is something that is not
required.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-08-23 14:14:11 -07:00
Alessandro Boch 340476b9fb Refresh special drivers networks if present in store
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-14 21:50:58 -07:00
Alessandro Boch 704ad46be8 Do not allow network creation if datastore is missing
- Earlier this was guaranteed by ipam driver intialization
  which was not creating a global address space if the
  global datastore was missing. Now that ipam address spaces
  can be initialized with no backing datastore, insert an
  explicit check in libnetwork, which should have been there
  regardless.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 16:36:54 -07:00
Jana Radhakrishnan 09d7547711 Add service support
Add a notion of service in libnetwork so that a group of endpoints
which form a service can be treated as such so that service level
features can be added on top. Initially as part of this PR the support
to assign a name to the said service is added which results in DNS
queries to the service name to return all the IPs of the backing
endpoints so that DNS RR behavior on the service name can be achieved.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-05-05 16:47:05 -07:00
Jana Radhakrishnan b6b3642560 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
Madhu Venugopal 926562b957 Reload config should initialize only the appropriate datastore
With the current implementation, a config relaod event causes all the
datastores to reinitialize and that impacts objects with Persist=false
such as none and host network.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-03-25 01:10:03 -07:00
Alessandro Boch 67e0ed78f5 Avoid network/endpoint count inconsistences
- ... on ungraceful shutdown during network create
- Allow forceful deletion of network
- On network delete, first mark the network for deletion
- On controller creation, first forcely remove any network
  that is marked for deletion.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-15 09:09:13 -07:00
Santhosh Manohar c4197ed3f0 Merge pull request #908 from aboch/dds
Allow pass global datastore config after boot
2016-02-17 15:19:39 -08:00
Alessandro Boch 71496efb52 Allow to pass global datastore config
- After boot via ReloadConfiguration() method

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-02-17 13:13:58 -08:00
Madhu Venugopal 6efd95cfb0 getNetworksFromStore should not fail on inconsistent network state
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-02-11 03:54:12 -08:00
Madhu Venugopal 047f2fa8ff getNetworksFromStore should return all valid networks
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-02-09 17:12:29 -08:00
Alexander Morozov ec0e60e3b0 Fix some races in getNetworkFromStore
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-01-29 11:06:33 -08:00
Madhu Venugopal b86ee48805 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
Alexander Morozov 7e288c8c34 Fix race in setting ctrlr for network
Race is with network.getController() method.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-01-08 13:32:36 -08:00
Alexander Morozov a768fe4d1b Remove redundant assignment to ep.network
Race detector was angry about that assignment

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-11-12 10:38:41 -08:00
Santhosh Manohar 02aa79f547 Fix an issue in overlay network peer EP list maintenance
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-10-24 07:10:03 -07:00
Santhosh Manohar 11512ea277 Handling container rename in libnetwork
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-10-23 05:31:53 -07:00
Jana Radhakrishnan 974e48cb94 Cleanup service db for the network
Cleanup the service db for the network when the last
container on the network leaves on the host. This is
because we stop watching the network after the last
container leaves and so if we keep the service db
around it might be kept uptodate with containers
joining and leaving in other hosts. The service
db will populated properly when a container joins
this network at a later point in time.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-24 17:41:58 -07:00
Jana Radhakrishnan 7ed91cd242 Purge remote endpoints from watch if it is local
A local endpoint is known to the watch database only
during Join. But the same endpoint can be known to the
watch database as remote endpoint well before the Join
because a CreateEndpoint updates the endpoint to the store.
So on Join when you come to know that this is indeed a
local endpoint remove it from remote endpoint list and add it
to local endpoint list.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-21 21:20:12 -07:00
Madhu Venugopal d59d61ae02 Dont fail the Get functions if there is an error in one of the stores
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-20 16:57:12 -07:00
Jana Radhakrishnan 174e3ac302 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 cd49ffd80b 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
Jana Radhakrishnan 73935333f6 Network ep count increment/decrement needs retry
Today we try to increment/decrement endpoint count
only once even if it is a key modified error. In case
of key modified error we should retry it to allow it to
succeed.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-09 19:37:25 -07:00
Jana Radhakrishnan 25f496f771 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
Alessandro Boch ec95763dee IPAM driver
- Add IPAM cotract and remote IPAM hooks
 - Add ipam registration in controller
 - Have default IPAM follow ipamapi contract

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-03 16:18:19 -07:00
Jana Radhakrishnan 4b7359ccf2 Merge pull request #556 from mavenugo/bdb-to
libnetwork to make use of boltdb ConnectionTimeout to avoid deadlock
2015-09-22 19:20:04 -07:00
Madhu Venugopal d6288cfa9d libnetwork to make use of boltdb ConnectionTimeout to avoid deadlock
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-22 13:23:23 -07:00
Madhu Venugopal 2bf6bc8278 Providing KVObject option to skip persisting object in kvstore
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-22 08:35:38 -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
Chun Chen d35f6502f6 Fix for zookeeper backend
Signed-off-by: Chun Chen <ramichen@tencent.com>
2015-09-17 10:16:34 +08: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
aboch ece45cbf53 Merge pull request #333 from calavera/extra_conditional
Remove extra conditional.
2015-06-25 14:59:19 -07:00
Spike Curtis e2a63dff5a Datastore handles creating objects atomically.
In that commit, AtomicPutCreate takes previous = nil to Atomically create keys
that don't exist.  We need a create operation that is atomic to prevent races
between multiple libnetworks creating the same object.

Previously, we just created new KVs with an index of 0 and wrote them to the
datastore.  Consul accepts this behaviour and interprets index of 0 as
non-existing, but other data backends do no.

 - Add Exists() to the KV interface.  SetIndex() should also modify a KV so
   that it exists.
 - Call SetIndex() from within the GetObject() method on DataStore interface.
   - This ensures objects have the updated values for exists and index.
 - Add SetValue() to the KV interface.  This allows implementers to define
   their own method to marshall and unmarshall (as bitseq and allocator have).
 - Update existing users of the DataStore (endpoint, network, bitseq,
   allocator, ov_network) to new interfaces.
 - Fix UTs.
2015-06-25 10:53:48 -07:00
David Calavera 6885ea8036 Remove extra conditional.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-25 09:58:16 -07:00
Madhu Venugopal fe42c32355 Ignoring locally scoped endpoints/networks from distributed delete
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-19 13:34:16 -07:00
Madhu Venugopal aeae6b501d Reading the top level element (network) from datastore on init
Currently we rely on watch to catchup after the init. But there could be
a small time window on which, we might end up in a race condition on
network creates. By reading and populating networks during init, we
avoid any such conditions, especially for default network handling.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-18 08:35:46 -07:00
Madhu Venugopal 288e689b51 Distributed delete processing
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-17 17:11:20 -07:00
Madhu Venugopal f8eb4da90c 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
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
Madhu Venugopal 9c3695fae8 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
Madhu Venugopal 2f07bc64a0 datastore delete support for network and endpoints
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-10 21:19:31 -07:00
Madhu Venugopal c653f03fe8 GetObject support
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-10 21:17:56 -07:00