Commit Graph

168 Commits

Author SHA1 Message Date
Dong Chen 87a03b9157 Close TCP connections at disconnect.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-03-01 13:48:58 -08:00
Doug Davis 4dc645bb8a Add missing 'defer'
as it stands now the lock at this spot in the code is pretty useless.
All it does it block us but since we release the lock before we check
e.state its a roadblock with no real purpose.
One could argue that a lock isn't needed at all but I think having it
there for consistency with the other funcs would be good.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-02-29 13:51:10 -08:00
Yongqiao Wang ddce40187c Find some typos when browse the code, fix them in this patch.
Signed-off-by: Yongqiao Wang <yqwyq@cn.ibm.com>
2016-02-26 20:16:39 +08:00
Sun Hongliang aa6ff494e4 Fix #1873
force to validate whether engine's label is like format "key=value"

Signed-off-by: Sun Hongliang <allen.sun@daocloud.io>
2016-02-25 12:58:25 +08:00
Victor Vieux 854cad3c14 don't erase hostconfig on refresh
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-18 10:01:26 -08:00
Victor Vieux c42142e408 Revert "Passing HostConfig for /start endpoint"
This reverts commit 6ff0d29c9d.

Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-17 15:46:37 -08:00
Nishant Totla 6ff0d29c9d Passing HostConfig for /start endpoint
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2016-02-17 11:06:51 -08:00
Dong Chen bfc556613b Lock engine to prevent simultaneous change on `containers` map.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-02-12 15:34:15 -08:00
Chanwit Kaewkasi fce3620235 Merge pull request #1794 from dongluochen/refreshBackoffOnFailure
Implement engine refresh backoff strategy for failing nodes
2016-02-12 19:58:08 +07:00
Alexandre Beslic 3c044d045c Merge pull request #1777 from vieux/remove_refresh_networks
remove refresh networks from cluster to improve perfs
2016-02-11 15:47:44 -08:00
Dong Chen b03bf75557 Implement engine refresh backoff strategy for failing nodes. Use a backoff factor so the backoff speed is relative to user setting.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-02-11 15:37:17 -08:00
Victor Vieux 64b9c50b69 use same HTTP client as dockerengine
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-11 15:03:38 -08:00
Victor Vieux 3747ec9b9f change refresh logic with new events
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-10 00:48:31 -08:00
Victor Vieux 5492f4ab82 remove refresh networks
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-09 20:14:58 -08:00
Victor Vieux f7f7f7a99b fix missing event on rescheduling
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-09 14:57:20 -08:00
Dong Chen 388b8fd50f Only record connection failure error in error message.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-02-01 22:30:36 -08:00
Dong Chen 3a99c4ca85 Ignore 404 error. Remove trailing white spaces from error, including new lines.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-02-01 20:44:36 -08:00
Victor Vieux 1be46e7e58 retry monitor events on EOF
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-01-29 09:32:29 -08:00
Isabel Jimenez c809e6a643 Fix double start
Signed-off-by: Isabel Jimenez <contact@isabeljimenez.com>
2016-01-31 19:08:48 -05:00
Victor Vieux 188b3fd00d change rlock to lock
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-01-28 08:25:13 -08:00
Dong Chen abffebf09e Provide error when engine version is unsupported.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-25 15:58:48 -08:00
Victor Vieux 1225eddc79 allow engine/name support in volumes
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-01-16 17:40:53 -08:00
Dong Chen 46a33f70ff Use exponential backoff strategy to validate pending engine.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-21 14:02:34 -08:00
Dong Chen 14bfc52d36 Enforce minimum backoff to avoid simultaneous validation on one engine.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-20 17:49:40 -08:00
Dong Chen 15c9dbaee0 Support TCP_USER_TIMEOUT for Linux and its equivalent in Mac
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-18 15:46:27 -08:00
Victor Vieux 04fb48d27a support 1.10 events
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-01-15 19:35:04 -08:00
Alexandre Beslic d21748699d Merge pull request #1565 from jimmyxian/fresh-image-when-commit
fresh image when receive commit event
2016-01-13 12:01:09 -08:00
Dong Chen 8f384b1d40 Address review comments.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-11 16:08:51 -08:00
Dong Chen cf664141b6 Scheduler prefers nodes without connection failures.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-11 11:42:58 -08:00
Xian Chaobo 1fef59f738 fresh image when receive commit event
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2016-01-08 17:25:30 +08:00
Dong Chen 7e266f18ed Name constants.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-07 15:55:12 -08:00
Dong Chen 58a0e1719d Update failureCount scenario and test cases.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-01-06 10:33:51 -08:00
Dong Chen 995866d76c Improve node management.
1. Introduce pending state. Pending nodes need validation before moving to healthy state. Resolve issues of duplicate ID and dead node drop issues.
2. Expose error and last update time in docker info.
3. Use connect success/failure to drive state transition between healthy and unhealthy.

Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-12-30 13:25:43 -08:00
Dong Chen 02553d0727 Cover connection failure error reported by dockerclient and by proxy cases.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-12-15 19:20:29 -08:00
Dong Chen 9bc6c35321 Use engine connection error to fail engine fast.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-12-15 19:13:03 -08:00
Dong Chen ec3b00c484 Reorganize engine failure detection procedure. Change engine option 'RefreshRetry' to 'FailureRetry'.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-12-15 19:13:03 -08:00
Dong Chen 4d24256c19 Use failureCount as a secondary health indicator.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-12-15 19:13:03 -08:00
Daniel Hiltgen dde577d154 Add token pass-thru for Authconfig
This augments the CreateContainer call to detect the AuthConfig header
and use any supplied auth for pull operations.  This will allow pulling
of protected image on to specific node during the create operation.

CLI usage example using username/password:

    # Calculate the header
    REPO_USER=yourusername
    read -s PASSWORD
    HEADER=$(echo "{\"username\":\"${REPO_USER}\",\"password\":\"${PASSWORD}\"}"|base64 -w 0 )
    unset PASSWORD
    echo HEADER=$HEADER

    # Then add the following to your ~/.docker/config.json
    "HttpHeaders": {
        "X-Registry-Auth": "<HEADER string from above>"
    }

    # Now run a private image against swarm:
    docker run --rm -it yourprivateimage:latest

CLI usage example using registry tokens: (Required engine 1.10 with new auth token support)

    REPO=yourrepo/yourimage
    REPO_USER=yourusername
    read -s PASSWORD
    AUTH_URL=https://auth.docker.io/token
    TOKEN=$(curl -s -u "${REPO_USER}:${PASSWORD}" "${AUTH_URL}?scope=repository:${REPO}:pull&service=registry.docker.io" |
        jq -r ".token")
    HEADER=$(echo "{\"registrytoken\":\"${TOKEN}\"}"|base64 -w 0 )
    echo HEADER=$HEADER

    # Update the docker config as above, but the token will expire quickly...

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2015-12-11 18:36:55 -08:00
Alexandre Beslic f21efa4337 Increase default TTL and heartbeat value
Increases the default ttl and heartbeat value for discovery.
Because the node will still be listed for a long period on
`docker info`, there is now a Status to know if a node is
in the healthy or unhealthy state.

Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-12-04 17:11:33 -08:00
Alexandre Beslic e82752cace Merge pull request #1363 from dongluochen/refreshConfiguration
add engine options for refresh interval
2015-11-25 14:30:16 -08:00
Dong Chen a150a0d521 Add cli test for engine refresh options
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-11-18 13:45:39 -08:00
Victor Vieux 3b6d9b6820 monitor events just after the info
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-11-02 17:04:01 -08:00
Victor Vieux 3f29299afd refresh volumes after creating a container
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-11-02 16:31:57 -08:00
Victor Vieux 0fa9b97f4e refresh images after a rmi
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-11-02 16:20:24 -08:00
Victor Vieux d2c5446ea0 Merge pull request #1340 from jimmyxian/volume-driver
Move VolumeDriver to HostConfig
2015-10-28 15:28:53 -07:00
Dong Chen c9f3471dba add engine options for refresh interval
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2015-10-28 12:56:48 -07:00
Xian Chaobo 588c29c3cc move VolumeDriver to HostConfig
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-10-28 10:58:24 +08:00
Daniel Nephin e001980b5c Add filter by image name support to /images/json
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-27 11:00:37 -04:00
Roman Iuvshin 40a22e5a13 Fix log info message
Signed-off-by: Roman Iuvshin <riuvshin@codenvy.com>
2015-10-23 17:22:53 +03:00
Alexandre Beslic 1e30ce215f Merge pull request #1262 from vieux/libnetwork
add 'docker network' support
2015-10-13 11:09:27 -07:00
Jia Mi 660299f749 Engine should refresh the container on container rename event
Signed-off-by: Jia Mi <winters.mi@gmail.com>
2015-10-10 15:17:48 +08:00
Andrea Luzzardi cb2ceea702 engine: Added a concurrent safe refresh delayer.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-10-09 11:32:03 -07:00
Victor Vieux 78ecf8497c Add network rm
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-10-08 22:36:13 -07:00
Victor Vieux b007cae8b2 Add docker network create
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-10-08 22:35:07 -07:00
Victor Vieux e634df03a7 add 'docker network ls' support
add 'docker network inspect' suport

Signed-off-by: Victor Vieux <vieux@docker.com>
2015-10-08 22:35:07 -07:00
Andrea Luzzardi f1782fed90 engine cleanup: Don't mess with the global random.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-10-07 17:27:41 -07:00
Andrea Luzzardi 13483451da engine: More robust refresh loop.
- Random heartbeat (between 30 and 60 seconds).
- Requires 3 failures before marking a node as dead.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-10-06 19:39:39 -07:00
Daniel Nephin 8abf7d32e9 Support filtering images by labels
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 15:45:52 -04:00
Victor Vieux 79d1ee4861 add volume create
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-09-18 03:23:22 -07:00
Victor Vieux 440a379860 docker volume rm
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-09-18 03:22:57 -07:00
Victor Vieux 77c96908f0 add support for docker volume ls & inspect
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-09-05 07:56:22 -07:00
Victor Vieux d571b7e39e Revert "prevent double starts with mesos"
This reverts commit 9a93dcf46b.

Signed-off-by: Victor Vieux <vieux@docker.com>
2015-09-02 20:33:49 -07:00
Chanwit Kaewkasi 987dc06365 Merge pull request #1168 from abronan/fix_refresh
Fix panic on Container/Image refresh after Engine removal
2015-09-03 13:16:40 +07:00
Chanwit Kaewkasi 4cdbe875b8 Merge pull request #1155 from vieux/fix_mesos_logs
prevent double logs with mesos
2015-09-03 13:10:52 +07:00
Alexandre Beslic a7303ecc5e Fix panic on various calls when assigning Engine client to nil
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-09-02 09:41:51 -07:00
Victor Vieux 42bb1f3f5b Merge pull request #1159 from jimmyxian/fix-tag-images
fix tag image
2015-09-01 11:25:48 -07:00
Victor Vieux 9a93dcf46b prevent double starts with mesos
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-08-31 22:52:43 -07:00
Xian Chaobo 29df83a349 fix tag image
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-08-31 07:17:30 -04:00
Xian Chaobo 12e956e681 add support force remove images
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-08-19 23:09:02 -04:00
Victor Vieux 58482a13d2 enable better refresh with mesos 0.23
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-08-14 17:11:19 -07:00
Xian Chaobo d4daee4f27 add support images -a
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-08-12 07:39:11 -04:00
James Wang Yong Qiao 88bbdff2e0 Fix the spell error.
Signed-off-by: James Wang Yong Qiao <jamesyongqiao@gmail.com>
2015-08-05 02:44:31 -04:00
Victor Vieux 2606db4486 Merge pull request #1085 from jimmyxian/improve-build
Improve build
2015-08-04 11:44:17 -07:00
Xian Chaobo a3cf5b9e9c improve build
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-08-04 02:45:06 -04:00
mariusz 2605d398b6 Updated the identifier as requested by @aluzzardi
Signed-off-by: Mariusz Borsa <mborsa@polyverse.io>
Tickle Jenkins
2015-07-31 16:32:12 -07:00
mariusz e1daa7c47b Error from Engine when refresh doesn't pickup new container
Fix for https://github.com/docker/swarm/issues/1081
    Signed-off-by: Mariusz Borsa <mborsa@polyverse.io>
2015-07-31 11:21:24 -07:00
Peeyush Gupta fa0cc6d1df Fixing spelling of again
Signed-off-by: Peeyush Gupta <gpeeyush@linux.vnet.ibm.com>
2015-07-07 11:09:39 +05:30
ealang 15fc8d8210 Prevent panic if a container is removed during a refresh
If InspectContainer fails, Engine.containers gets set to nil.

Log cause of updateContainer failure.

Signed-off-by: Eric Lang <ealang@gmail.com>
2015-06-29 22:04:15 -05:00
Andrea Luzzardi 82fc920e90 Engine: fix panic in disconnect with events.
Replaces #937

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-06-12 18:51:05 -07:00
Victor Vieux 1afc1be2d1 support only 1.6.0+
update test/regression/run.sh
uddate doc
update tests

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-12 13:27:15 -07:00
Marco Mancini 9e27ae9140 Fix reserved cpus computation
Added test as Vieux suggested/Fixed CpuShare computation

Signed-off-by: Marco Mancini <marcomancini72@gmail.com>
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-04 18:59:15 -07:00
Victor Vieux 15a8b73ab6 fix cpus
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-04 17:26:32 -07:00
Victor Vieux e8445ed8ce fix panic is disconnect
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-04 11:27:17 -07:00
Xian 8da3de3cc4 add import unit test
Signed-off-by: Xian <xianchaobo@huawei.com>
2015-05-27 22:11:05 +08:00
Xian Chaobo 1f20358b5d add support import
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-05-27 22:11:03 +08:00
Isabel Jimenez 19c14fde2e Adding integration tests, decline offers after 'SWARM_MESOS_OFFER_TIMEOUT', Tracking tasks and managing offers, refactoring list of slaves, queue create requests before processing them
Signed-off-by: Isabel Jimenez <contact.isabeljimenez@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-05-26 16:21:54 -04:00
Isabel Jimenez 18235bee97 cluster mesos with engine
Signed-off-by: Timothy Chen <tnachen@gmail.com>
Signed-off-by: Isabel Jimenez <contact.isabeljimenez@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-05-26 16:18:33 -04:00
Victor Vieux 9db6bce98b Merge pull request #823 from vieux/containers
create containers.go
2015-05-26 13:05:26 -07:00
Victor Vieux b5094bde55 create Containers type
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-26 12:01:48 -07:00
Victor Vieux 0b24992d7c Merge pull request #815 from jimmyxian/rmi_by_name
Fix image match
2015-05-26 10:43:59 -07:00
Victor Vieux b3222a8f11 rename Destroy ro RemoveContainer for consistency
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-20 12:53:02 -07:00
Xian Chaobo e6ce59794e merge two image match func
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-05-19 21:39:10 -04:00
Andrea Luzzardi 7c0dba5de6 engine: Support for disconnection
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:55:13 -07:00
Victor Vieux faf26a62f4 fix container matching algorithm
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-15 17:57:40 -07:00
Victor Vieux 2cb0395acf remove images by name or ID, not always ID
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-14 15:22:06 -07:00
Andrea Luzzardi b6a7c3d7f5 swarm ID: Remove backward compatibility.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-11 16:56:08 -07:00
Andrea Luzzardi 5c801d2c6a swarm id: Handle compatibility.
Containers created with Swarm<0.3.0 or directly on the host without
going through Swarm don't have a Swarm ID. We are going to fake it by
using the Container ID.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-11 16:56:08 -07:00
Andrea Luzzardi abfe5e6f4c Add support for Swarm IDs.
- Every container that gets created through Swarm gets a Swarm ID
  assigned (as a label).
- All API operations (start, stop, ...) can be performed by using either
  the container ID or the swarm ID.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-11 16:56:07 -07:00
Andrea Luzzardi 8a00a5ff10 engine: Force full refresh when container changes state.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-06 23:38:32 -07:00
Andrea Luzzardi 1d2e073813 Embed ContainerConfig into Container.
The cluster configuration is now embedded into the container. It's
guaranteed to be correct (as in, generated by BuildContainerConfig) at
all times.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-30 18:15:22 -07:00