Commit Graph

230 Commits

Author SHA1 Message Date
Alexandre Beslic 4537b9f2ba Remove unused code
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 12:57:43 -07:00
Alexandre Beslic f81de46ab4 Fix Consul and etcd with latest changes, use etcd v2.0.11 for integration tests, remove call to SyncCluster for now (breaks the integration tests)
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 10:25:31 -07:00
Alexandre Beslic d5915b2a09 Merge pull request #811 from aluzzardi/node-removal
Handle Node Removal from Discovery correctly
2015-05-19 10:11:10 -07:00
Xian Chaobo 064e91cd23 fix image match and fix docker save
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-05-19 05:21:14 -04:00
Isabel Jimenez 8001455ecf adding ip as an option for flags
Signed-off-by: Isabel Jimenez <contact.isabeljimenez@gmail.com>
2015-05-18 20:34:57 -04:00
Isabel Jimenez 19d51f4a1a adding environment variable option when treating flags
Signed-off-by: Isabel Jimenez <contact.isabeljimenez@gmail.com>
2015-05-18 20:16:21 -04:00
Andrea Luzzardi d7b8734e97 cluster: Handle node removal
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:55:13 -07:00
Andrea Luzzardi 7c0dba5de6 engine: Support for disconnection
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:55:13 -07:00
Andrea Luzzardi 3d6f833f6f fix --heartbeat flag.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:15 -07:00
Andrea Luzzardi 0c72bcaf40 discovery cleanup: heartbeat is a time.Duration.
- Use a time.Duration instead of a uint64 for hb
- Flags can accept durations: --heartbeat 25s

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:14 -07:00
Andrea Luzzardi f33c03af93 discovery: Push watch errors to a channel
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:14 -07:00
Andrea Luzzardi 97984881c3 discovery: New channel based API.
- Watch() issues updates by channel rather than by callback
- Fetch() is gone
- Watch() can be stopped at any time by closing the stop channel
- Watch() is now resilient to errors and will try over and over

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:13 -07:00
Victor Vieux 4b03d7fa0c handle collision
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-18 13:35:33 -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 1f5d66d1f1 fix match
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-15 16:28:39 -07:00
Xian Chaobo 4af3e30f64 Fix:#748 add refresh container
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-05-15 04:46:02 -04: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 ece52698d6 Merge pull request #783 from vieux/fix_image_match
fix image.Match to take only repo or repo:tag
2015-05-13 19:05:30 -07:00
Victor Vieux f9b457f152 fix image.Match
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-13 17:36:08 -07:00
Victor Vieux 69bdf1a87b fix heartbeat default value
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-13 16:50:01 -07:00
Victor Vieux 59cd11b946 change swarm.heartbeat to swarm.discovery.heartbeat
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-13 15:48:07 -07:00
Victor Vieux 5db3a9cd0e remove options struct, yay!
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-13 15:36:30 -07:00
Victor Vieux c29404e272 add --cluster-driver and --cluster-opt
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-12 17:49:00 -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 054702fedc container config: Add Swarm ID helpers.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-11 16:56:07 -07:00
Andrea Luzzardi 0bd4b1faca Merge pull request #732 from vieux/fix_name_unique
fix name checks in create and rename
2015-05-07 16:24:16 -07:00
Victor Vieux a74d00d1c5 fix name checks
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-07 15:50:34 -07:00
Andrea Luzzardi 5ee115fcd5 container: Use state strings from dockerclient instead of embedding
them.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-07 15:42:26 -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 4cf0a32e4d container: Add Status() and StateString() formatters.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-06 23:38:32 -07:00
Andrea Luzzardi 7865004ec9 Merge pull request #725 from aluzzardi/discovery-integration-cleanup
Discovery integration cleanup
2015-05-06 10:50:11 -07:00
Andrea Luzzardi 9124f3a0c7 cluster: Improved discovery duplication error messaging.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-05 19:13:57 -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
Andrea Luzzardi cd3a0f03fc container config builder: Make all modifications on a copy, never alter original.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-30 18:06:26 -07:00
Andrea Luzzardi 67fbac56a6 cleanup config asserts
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-30 15:35:46 -07:00
Victor Vieux f53b5df834 store constaints and affinities in labels
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-30 14:33:21 -07:00
Victor Vieux 6eceffacf9 use cluster.ContainerConfig
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-30 11:44:25 -07:00
Victor Vieux e5f4243dad support pulling private images from docker pull
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-28 11:17:44 -07:00
Xian Chaobo 40a3eb1aa1 fix return value
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-27 21:35:46 -04:00
Andrea Luzzardi 24396d8509 Merge pull request #669 from jimmyxian/improve-rename
improve rename
2015-04-27 12:39:48 -07:00
Xian Chaobo 3d2537eb84 move check into cluster and rename func
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-27 08:20:55 -04:00
Xian Chaobo b47e002e6c improve rename and update dockerclient
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-24 21:09:26 -04:00
Andrea Luzzardi d6011b4bc6 Merge pull request #609 from jimmyxian/add-support-imageload
Add support "docker load" api
2015-04-24 17:21:11 -07:00
Sriram Natarajan 9f29e95abc Add Node Labels to Cluster Info information
Updates: docker info output and /info API
Check for labels in API integration tests

Signed-off-by: Sriram Natarajan <natarajan.sriram@gmail.com>
2015-04-21 20:30:19 +00:00
Xian Chaobo 5c068de28c add force-refresh when commit/tag/pull
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-20 02:45:06 -04:00
Xian Chaobo 0b44d9615b add force fresh images
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-19 23:02:26 -04:00
Xian Chaobo 59c5b6b317 use WaitGroup and move test in api.bats
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-16 22:10:39 -04:00
Xian Chaobo 6ad2a7847c stream load and output nothing if load successfully
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-16 21:50:46 -04:00
Xian Chaobo 34e0c78d1d gofmt check
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-16 21:50:46 -04:00
Xian Chaobo ccc32635d5 Add support Load Image
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
2015-04-16 21:50:46 -04:00
Andrea Luzzardi 9ac7dd2402 Merge pull request #603 from vieux/add_build
Proposal: Add build support on a random node
2015-04-16 16:21:38 -07:00
Victor Vieux 05b01c7b43 forcerefresh after build and add test
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-04-16 12:22:09 -07:00
Andrea Luzzardi 4db132e20e Merge pull request #594 from noxiouz/add_rlocks_to_swarm_cluster
Add Rlocks to swarm cluster
2015-04-16 12:20:58 -07:00
Victor Vieux d74e872952 add build
improve random selection

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-16 12:19:09 -07:00
Victor Vieux 8506acbed2 fix proxyRandom even without container
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-16 12:17:38 -07:00
Andrea Luzzardi 442217d6dc Cleanup events handler.
- Renamed Events() to RegisterEventHandler() in Engine.
- Added RegisterEventHandler() to the Cluster interface.
- Removed EventHandler requirement from swarm's Cluster constructor.
- Make API's events handler private.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-15 15:59:55 -07:00
Sriram Natarajan 49f644934c Improve Error message to show node's Name and IP
Signed-off-by: Sriram Natarajan <natarajan.sriram@gmail.com>
2015-04-14 11:27:02 -07:00
Sriram Natarajan b174aa26de Change heartbeat type to unsigned int
Check if heartbeat value is greater than zero

Signed-off-by: Sriram Natarajan <natarajan.sriram@gmail.com>
2015-04-09 00:04:50 +00:00
Anton Tiurin 2b4bbf1ef2 [SwarmCluster] Add RLock to Cluster.Pull
Use sync.WaitGroup (go-way) to wait for a collection
of pulling goroutines.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-04-08 22:30:23 +03:00
Anton Tiurin b221baf4ed [SwarmCluster] Add RLock to Cluster.hasEngine
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-04-08 22:25:54 +03:00
Anton Tiurin e66abdf7bb [SwarmCluster] Remove an extra RLock in Engine.Container
Engine.Container uses an array of containers from Engine.Containers, which is
built under an internal RLock, so the external RLock is useless.
Also allocate enough memory for the array of containers (images).

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-04-08 00:41:28 +03:00
Victor Vieux 853aaf6027 nodes -> engines
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-07 11:46:33 -07:00
Victor Vieux 0c1782c7c0 fix proxyRandom and cleanup node -> engine
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-06 13:38:10 -07:00
Victor Vieux 1297a4cef2 transform node interface to engine struct
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-06 13:19:37 -07:00
Alexandre Beslic 88b69e0671 Merge pull request #573 from aluzzardi/container-update-fix
Fix container update flow.
2015-04-03 17:03:14 -07:00
Victor Vieux 820527be7e Sort docker info by name
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-03 16:37:27 -07:00
Andrea Luzzardi 23d52249fa Fix container update flow.
This guarantees that containers get fully updated before being inserted
in the node (and returned by .Containers()).

Fixes #560

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-03 16:21:48 -07:00
Victor Vieux 20ec7a889e add strategy and filters to docker info
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-03 15:56:26 -07:00
Victor Vieux c41d73dd50 add error message
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-04-03 01:28:08 +00:00
Victor Vieux 58b282a4a3 Merge pull request #545 from aluzzardi/synchronous-creater-destroy
Make container creation and destruction synchronous.
2015-04-01 15:41:26 -07:00
Victor Vieux b304a453f4 use 1024 as total cpushare for a machine
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-04-01 11:49:00 -07:00
Andrea Luzzardi ca05173e41 Make container creation and destruction synchronous.
This is in order to fix race conditions. Currently, container creation
can happen in parallel which means that the scheduler operates on stale
data.

Fixes #427

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-03-31 14:11:51 -07:00
Matt Bajor d87c48ae4e Fix lint violations
This changeset fixes all lint violations that show up with a
min_confidence of 1

- Issue #500: Run golint on codebase

Signed-off-by: Matt Bajor <matt@notevenremotelydorky.com>
2015-03-27 21:17:44 -06:00
Alexandre Beslic 904c720ea5 Merge pull request #446 from vieux/rmi
add docker rmi
2015-03-24 16:04:35 -07:00
Victor Vieux 64d01b4e4a add fixme
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-03-19 10:02:33 -07:00
Victor Vieux e6b3b04150 do not leak dockerclient
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-03-18 13:48:09 -07:00
Victor Vieux c969fcdae6 use dockerclient
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-17 17:41:46 -07:00
Victor Vieux b4a88ad622 Add match in images.go
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-17 17:41:46 -07:00
Victor Vieux 649b6cf577 add docker rmi
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-17 17:41:46 -07:00
Victor Vieux 8c09bba1de mitigate race in pull while we wait for a proper store
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-17 23:29:42 +00:00
Victor Vieux b9e600d38d pull only latest if no tag
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-03-17 16:19:35 -07:00
Victor Vieux de62579f8d handle errors in pull
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-11 14:34:47 -07:00
Victor Vieux 0fca58b069 add Node back to inspect
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-06 16:40:55 -08:00
Victor Vieux 0e7f970d4d use a single callback
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-06 11:22:14 -08:00
Victor Vieux e0fa132ec9 add parallel
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-05 17:09:08 -08:00
Victor Vieux 7ad8a3705f add support for pull and rmi
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-05 17:09:08 -08:00
Victor Vieux eccaf6e5eb Cleanup: Make swarm Node and Cluster functions private
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-05 11:53:40 -08:00
Victor Vieux 0569f7d4dd swarm.Node -> swarm.node && some method now private
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-02 18:02:31 -08:00
Victor Vieux 92ab1e347c cleanup swarm scheduler code
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-03-02 17:55:06 -08:00
Victor Vieux 8b7afe2c73 remove mesos.go to move it to it's own PR
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:25:50 -08:00
Victor Vieux a8885ab997 removed nodes.go
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:25:50 -08:00
Victor Vieux d8042f9677 add Node interface
Usable -> Total & Reserved -> Used

Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:25:50 -08:00
Victor Vieux 4bfeb4b640 move list of node to swarm only
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00
Victor Vieux 47e03120f5 remove Nodes(), add Images() and Images()
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00
Victor Vieux fa8a06685b remove events from the cluster interface
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00
Victor Vieux 6348fdd849 move discovery out of the cluster interface
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00
Victor Vieux ce98e66c63 cluster API instead of scheduler API
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00
Victor Vieux 126f550317 add SchedulerOptions
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-27 14:20:37 -08:00