1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

22 commits

Author SHA1 Message Date
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
Chris Telfer
06922d2d81 Use fmt precision to limit string length
The previous code used string slices to limit the length of certain
fields like endpoint or sandbox IDs.  This assumes that these strings
are at least as long as the slice length.  Unfortunately, some sandbox
IDs can be smaller than 7 characters.   This fix addresses this issue
by systematically converting format string calls that were taking
fixed-slice arguments to use a precision specifier in the string format
itself.  From the golang fmt package documentation:

    For strings, byte slices and byte arrays, however, precision limits
    the length of the input to be formatted (not the size of the output),
    truncating if necessary. Normally it is measured in runes, but for
    these types when formatted with the %x or %X format it is measured
    in bytes.

This nicely fits the desired behavior: it will limit the number of
runes considered for string interpolation to the precision value.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-05 17:44:04 -04:00
Christoph Ziebuhr
40923e7353 Use ordered array instead of heap for sb.endpoints
Signed-off-by: Christoph Ziebuhr <chris@codefrickler.de>
2018-03-21 10:31:56 +01:00
Derek McGowan
710e0664c4 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
Flavio Crisciani
af5e370627 Add gosimple check
Add the gosimple tool check in the Makefile
Fix all the issues identified

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-07-06 09:42:38 -07:00
Santhosh Manohar
6f507f53e3 Fix the data model inconsistency that breaks daemon upgrade to 1.14-dev
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2017-01-19 14:25:26 -08:00
Santhosh Manohar
bf832ec2a7 Add embedded DNS server support for host loopback resolver
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-12-22 14:34:13 -08:00
Daehyeok Mun
7f473c779a 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
849712f35d Better error handling in restoring sandbox states
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-07-27 00:55:46 -07:00
Jana Radhakrishnan
d5ce149555 Do not add loadbalancer to unpopulated sandboxes
When adding a loadbalancer to a sandbox, the sandbox may have a valid
namespace but it might not have populated all the dependent network
resources yet. In that case do not populate that endpoint's loadbalancer
into that sandbox yet. The loadbalancer will be populated into the
sandbox when it is done populating all the dependent network resources.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-06-15 19:58:33 -07:00
Santhosh Manohar
96cc604cf1 Setup external DNS servers after daemon restart with live-restore
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-06-09 20:30:01 -07:00
Lei Jitang
055c5dd496 Add network restore to support docker live restore container
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-06-13 23:48:00 -07:00
Madhu Venugopal
f2c5ff41de Set persist flag on the dummy network object during cleanup
During sandboxcleanup operation, a dummy object is created if the
kv-store is inaccessible during the daemon bootup. The dummy object is
used for local processing of sandbox/endpoint cleanup operation. But
unfortunately, since the persist flag was not set, the Skip()
functionality kicked-in when sandbox was written back to the store and
global endpoint was skipped to be tracked.  During a subsequent cleanup
operation, sandbox was removed and the global endpoint was left stale in
the kv-store.

The fix is to set the persist flag in the dummy object and that handles
the sandbox and endpoint states appropriately and endpoint object is
properly cleaned up when the KVStore becomes available.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-05-06 18:38:56 -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
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
Jana Radhakrishnan
d9ad8c961c Skip non-persistent endpoints in sandbox store
If the endpoint and the corresponding network is
not persistent then skip adding it into sandbox
store.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-11-02 08:09:49 -08:00
Jana Radhakrishnan
670302e66b Fix stale sandbox from store problem
At times, when checkpointed sandbox from store cannot be
cleaned up properly we still retain the sandbox in both
the store and in memory. But this sandbox store may not
contain important configuration information from docker.
So when docker requests a new sandbox, instead of using
it as is, reconcile the sandbox state from store with the
the configuration information provided by docker. To do this
mark the sandbox from store as stub and never reveal it to
external searches. When docker requests a new sandbox, update
the stub sandbox and clear the stub flag.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-11-02 00:38:33 -08:00
Madhu Venugopal
e636d8398b set cntlr sandbox before cleaning endpoints in ungraceful restart case
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-30 14:40:17 -07:00
Madhu Venugopal
c8a66f5e72 Fixes a case of ungraceful daemon restart + unreachable store
For ungraceful daemon restarts, libnetwork has sandbox cleanup logic to
remove any stale & dangling resources. But, if the store is down during
the daemon restart, then the cleanup logic would not be able to perform
complete cleanup. During such cases, the sandbox has been removed. With
this fix, we retain the sandbox if the store is down and the endpoint
couldnt be cleaned. When the container is later restarted in docker
daemon, we will perform a sandbox cleanup and that will complete the
cleanup round.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-29 17:16:52 -07:00
Jana Radhakrishnan
96d819cb06 Make sandbox cleanup robust for ungraceful exits
When the daemon has a lot of containers and even when
the daemon tries to give 15 second to stop all containers
it is not enough. So the daemon forces a shut down at the end
of 15 seconds. And hence in a situation with a lot of
containers even gracefully bringing down the daemon will result
in a lot of containers fully not brought down.

In addition to this the daemon force killing itself can happen
in any arbitrary point in time which will result in inconsistent
checkpointed state for the sandbox. This makes the cleanup really
fail when we come back up and in many cases because of this
inability to cleanup properly on restart will result in daemon not
able to restart because we are not able to delete the default network.

This commit ensures that the sandbox state stored in the disk is
never inconsistent so that when we come back up we will always be
able to cleanup the sandbox state.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-19 13:30:47 -07:00
Alessandro Boch
c2064dc18d Reduce logging verbosity in allocator
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-10 05:42:31 -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